diff --git a/.circleci/config.yml b/.circleci/config.yml index 9609c48394..450adb8572 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -91,14 +91,39 @@ commands: # Find the last update of any contract - run: | git log -1 -- \ + utils/common-config/hardhat.config.ts \ utils/core-modules/contracts \ + utils/core-modules/cannonfile.test.toml \ + utils/core-modules/hardhat.config.ts \ + utils/core-modules/storage.dump.sol \ utils/core-contracts/contracts \ + utils/core-contracts/hardhat.config.ts \ protocol/synthetix/contracts \ + protocol/synthetix/cannonfile.test.toml \ + protocol/synthetix/cannonfile.toml \ + protocol/synthetix/hardhat.config.ts \ + protocol/synthetix/storage.dump.sol \ protocol/governance/contracts \ + protocol/governance/cannonfile.toml \ + protocol/governance/hardhat.config.ts \ protocol/oracle-manager/contracts \ + protocol/oracle-manager/cannonfile.test.toml \ + protocol/oracle-manager/cannonfile.toml \ + protocol/oracle-manager/hardhat.config.ts \ + protocol/oracle-manager/storage.dump.sol \ markets/spot-market/contracts \ + markets/spot-market/cannonfile.test.toml \ + markets/spot-market/cannonfile.toml \ + markets/spot-market/hardhat.config.ts \ + markets/spot-market/storage.dump.sol \ markets/perps-market/contracts \ + markets/perps-market/cannonfile.test.toml \ + markets/perps-market/cannonfile.toml \ + markets/perps-market/hardhat.config.ts \ + markets/perps-market/storage.dump.sol \ markets/legacy-market/contracts \ + markets/legacy-market/hardhat.config.ts \ + markets/legacy-market/cannonfile.toml \ > /tmp/version--contracts.txt - run: cat /tmp/version--contracts.txt @@ -151,7 +176,7 @@ jobs: - restore_cache: keys: - testable-hardhat-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "/tmp/version--contracts.txt" }} - - run: yarn workspaces foreach --topological-dev --verbose run build-testable + - run: CANNON_REGISTRY_PRIORITY=local yarn workspaces foreach --topological-dev --verbose run build-testable - save_cache: key: testable-hardhat-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "/tmp/version--contracts.txt" }} paths: diff --git a/.env.sample b/.env.sample index 67a88ed020..a4fc581e89 100644 --- a/.env.sample +++ b/.env.sample @@ -3,4 +3,5 @@ INFURA_API_KEY= INFURA_IPFS_ID= INFURA_IPFS_SECRET= ETHERSCAN_API_KEY= -OVM_ETHERSCAN_API_KEY= \ No newline at end of file +OVM_ETHERSCAN_API_KEY= +CANNON_REGISTRY_PRIORITY= \ No newline at end of file diff --git a/.eslintignore b/.eslintignore index f5c21b47f6..6d7cf7d3b3 100644 --- a/.eslintignore +++ b/.eslintignore @@ -6,6 +6,6 @@ utils/*/utils **/contracts/generated **/test/generated **/artifacts -**/subgraph/deployments +**/subgraph/**/deployments **/subgraph/build **/subgraph/.bin diff --git a/.github/workflows/simulate-release.yml b/.github/workflows/simulate-release.yml index 3902f49469..abe5e53e05 100644 --- a/.github/workflows/simulate-release.yml +++ b/.github/workflows/simulate-release.yml @@ -54,7 +54,7 @@ jobs: cannonPackage: "synthetix-spot-market" impersonate: "0x48914229deDd5A9922f44441ffCCfC2Cb7856Ee9" proxy: "InitialProxy" - chains: "mainnet optimistic-mainnet goerli optimistic-goerli" + chains: "optimistic-mainnet optimistic-goerli" # - workspace: "@synthetixio/perps-market" # cannonPackage: "synthetix-perps-market" diff --git a/.prettierignore b/.prettierignore index a5b985a273..8ae6c75049 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,5 @@ +.yarn/ +node_mudules/ *.dump.sol **/coverage* build/ @@ -6,7 +8,7 @@ node_modules/ **/contracts/routers **/dist/ **/node_modules/ -**/typechain-types +**/typechain-types/ utils/*/utils utils/*/test/generated protocol/*/test/generated @@ -21,3 +23,4 @@ lerna.json **/artifacts/ **/cache/ **/docs/ +**/tests/.latest.json diff --git a/.prettierrc b/.prettierrc index ac9ba0c15a..107d32688e 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,8 +1,19 @@ { "overrides": [ + { + "files": "*.toml", + "options": { + "plugins": ["prettier-plugin-toml"], + "tabWidth": 4, + "useTabs": false, + "singleQuote": false, + "bracketSpacing": false + } + }, { "files": "*.sol", "options": { + "plugins": ["prettier-plugin-solidity"], "printWidth": 100, "tabWidth": 4, "useTabs": false, @@ -11,11 +22,7 @@ } }, { - "files": [ - "*.js", - "*.ts", - "*.md" - ], + "files": ["*.js", "*.ts", "*.md"], "options": { "printWidth": 100, "semi": true, @@ -25,11 +32,7 @@ } }, { - "files": [ - "*.js", - "*.ts", - "*.json" - ], + "files": ["*.js", "*.ts", "*.json"], "options": { "useTabs": false } diff --git a/.solhint.json b/.solhint.json index 305275a4e3..78d0c2a21f 100644 --- a/.solhint.json +++ b/.solhint.json @@ -21,7 +21,6 @@ "maxLength": 32 } ], - "numcast/safe-cast": "error", - "no-global-import": "off" + "numcast/safe-cast": "error" } } diff --git a/.yarn/cache/@aashutoshrathi-word-wrap-npm-1.2.6-5b1d95e487-ada901b9e7.zip b/.yarn/cache/@aashutoshrathi-word-wrap-npm-1.2.6-5b1d95e487-ada901b9e7.zip new file mode 100644 index 0000000000..9334304c2a Binary files /dev/null and b/.yarn/cache/@aashutoshrathi-word-wrap-npm-1.2.6-5b1d95e487-ada901b9e7.zip differ diff --git a/.yarn/cache/@babel-parser-npm-7.16.4-d2e53039b9-ce0a8f92f4.zip b/.yarn/cache/@babel-parser-npm-7.16.4-d2e53039b9-ce0a8f92f4.zip deleted file mode 100644 index 9f1778566b..0000000000 Binary files a/.yarn/cache/@babel-parser-npm-7.16.4-d2e53039b9-ce0a8f92f4.zip and /dev/null differ diff --git a/.yarn/cache/@chevrotain-cst-dts-gen-npm-11.0.3-1ac7b26815-414229a827.zip b/.yarn/cache/@chevrotain-cst-dts-gen-npm-11.0.3-1ac7b26815-414229a827.zip new file mode 100644 index 0000000000..b60d044620 Binary files /dev/null and b/.yarn/cache/@chevrotain-cst-dts-gen-npm-11.0.3-1ac7b26815-414229a827.zip differ diff --git a/.yarn/cache/@chevrotain-gast-npm-11.0.3-ae07e98aa6-5190ba3a3f.zip b/.yarn/cache/@chevrotain-gast-npm-11.0.3-ae07e98aa6-5190ba3a3f.zip new file mode 100644 index 0000000000..5ea6a48202 Binary files /dev/null and b/.yarn/cache/@chevrotain-gast-npm-11.0.3-ae07e98aa6-5190ba3a3f.zip differ diff --git a/.yarn/cache/@chevrotain-regexp-to-ast-npm-11.0.3-0ca6c6ac3e-5d665b3340.zip b/.yarn/cache/@chevrotain-regexp-to-ast-npm-11.0.3-0ca6c6ac3e-5d665b3340.zip new file mode 100644 index 0000000000..1c22bbc40b Binary files /dev/null and b/.yarn/cache/@chevrotain-regexp-to-ast-npm-11.0.3-0ca6c6ac3e-5d665b3340.zip differ diff --git a/.yarn/cache/@chevrotain-types-npm-11.0.3-6044522d0c-4496bf1955.zip b/.yarn/cache/@chevrotain-types-npm-11.0.3-6044522d0c-4496bf1955.zip new file mode 100644 index 0000000000..22ce2d71ce Binary files /dev/null and b/.yarn/cache/@chevrotain-types-npm-11.0.3-6044522d0c-4496bf1955.zip differ diff --git a/.yarn/cache/@chevrotain-utils-npm-11.0.3-856b0ac246-099f0aa65f.zip b/.yarn/cache/@chevrotain-utils-npm-11.0.3-856b0ac246-099f0aa65f.zip new file mode 100644 index 0000000000..e4f911418b Binary files /dev/null and b/.yarn/cache/@chevrotain-utils-npm-11.0.3-856b0ac246-099f0aa65f.zip differ diff --git a/.yarn/cache/@eslint-community-eslint-utils-npm-4.4.0-d1791bd5a3-cdfe3ae42b.zip b/.yarn/cache/@eslint-community-eslint-utils-npm-4.4.0-d1791bd5a3-cdfe3ae42b.zip new file mode 100644 index 0000000000..4e48357020 Binary files /dev/null and b/.yarn/cache/@eslint-community-eslint-utils-npm-4.4.0-d1791bd5a3-cdfe3ae42b.zip differ diff --git a/.yarn/cache/@eslint-community-regexpp-npm-4.8.1-f3c3ae5aa9-82d62c845e.zip b/.yarn/cache/@eslint-community-regexpp-npm-4.8.1-f3c3ae5aa9-82d62c845e.zip new file mode 100644 index 0000000000..ebed14e93c Binary files /dev/null and b/.yarn/cache/@eslint-community-regexpp-npm-4.8.1-f3c3ae5aa9-82d62c845e.zip differ diff --git a/.yarn/cache/@eslint-eslintrc-npm-1.4.1-007f670de2-cd3e5a8683.zip b/.yarn/cache/@eslint-eslintrc-npm-1.4.1-007f670de2-cd3e5a8683.zip deleted file mode 100644 index b51019b7a1..0000000000 Binary files a/.yarn/cache/@eslint-eslintrc-npm-1.4.1-007f670de2-cd3e5a8683.zip and /dev/null differ diff --git a/.yarn/cache/@eslint-eslintrc-npm-2.1.2-feb0771c9f-bc742a1e3b.zip b/.yarn/cache/@eslint-eslintrc-npm-2.1.2-feb0771c9f-bc742a1e3b.zip new file mode 100644 index 0000000000..43f6713681 Binary files /dev/null and b/.yarn/cache/@eslint-eslintrc-npm-2.1.2-feb0771c9f-bc742a1e3b.zip differ diff --git a/.yarn/cache/@eslint-js-npm-8.49.0-e8f6510b47-a6601807c8.zip b/.yarn/cache/@eslint-js-npm-8.49.0-e8f6510b47-a6601807c8.zip new file mode 100644 index 0000000000..f0acb5bec4 Binary files /dev/null and b/.yarn/cache/@eslint-js-npm-8.49.0-e8f6510b47-a6601807c8.zip differ diff --git a/.yarn/cache/@humanwhocodes-config-array-npm-0.11.10-7b63df9e7f-1b1302e240.zip b/.yarn/cache/@humanwhocodes-config-array-npm-0.11.11-e3582554ee-db84507375.zip similarity index 51% rename from .yarn/cache/@humanwhocodes-config-array-npm-0.11.10-7b63df9e7f-1b1302e240.zip rename to .yarn/cache/@humanwhocodes-config-array-npm-0.11.11-e3582554ee-db84507375.zip index 3970ef9bcb..2409a83fb2 100644 Binary files a/.yarn/cache/@humanwhocodes-config-array-npm-0.11.10-7b63df9e7f-1b1302e240.zip and b/.yarn/cache/@humanwhocodes-config-array-npm-0.11.11-e3582554ee-db84507375.zip differ diff --git a/.yarn/cache/@nomicfoundation-ethereumjs-block-npm-5.0.1-36ba33b8af-02591bc9ba.zip b/.yarn/cache/@nomicfoundation-ethereumjs-block-npm-5.0.2-4d950628bb-7ff744f44a.zip similarity index 95% rename from .yarn/cache/@nomicfoundation-ethereumjs-block-npm-5.0.1-36ba33b8af-02591bc9ba.zip rename to .yarn/cache/@nomicfoundation-ethereumjs-block-npm-5.0.2-4d950628bb-7ff744f44a.zip index a553b67b74..89bf65fb46 100644 Binary files a/.yarn/cache/@nomicfoundation-ethereumjs-block-npm-5.0.1-36ba33b8af-02591bc9ba.zip and b/.yarn/cache/@nomicfoundation-ethereumjs-block-npm-5.0.2-4d950628bb-7ff744f44a.zip differ diff --git a/.yarn/cache/@nomicfoundation-ethereumjs-blockchain-npm-7.0.1-70afb79069-8b7a4e3613.zip b/.yarn/cache/@nomicfoundation-ethereumjs-blockchain-npm-7.0.2-d9705709ea-b7e440dcd7.zip similarity index 98% rename from .yarn/cache/@nomicfoundation-ethereumjs-blockchain-npm-7.0.1-70afb79069-8b7a4e3613.zip rename to .yarn/cache/@nomicfoundation-ethereumjs-blockchain-npm-7.0.2-d9705709ea-b7e440dcd7.zip index c44db4abc2..33cb1c432f 100644 Binary files a/.yarn/cache/@nomicfoundation-ethereumjs-blockchain-npm-7.0.1-70afb79069-8b7a4e3613.zip and b/.yarn/cache/@nomicfoundation-ethereumjs-blockchain-npm-7.0.2-d9705709ea-b7e440dcd7.zip differ diff --git a/.yarn/cache/@nomicfoundation-ethereumjs-common-npm-4.0.1-db8034d032-af5b599bcc.zip b/.yarn/cache/@nomicfoundation-ethereumjs-common-npm-4.0.2-2a486d4209-f0d84704d6.zip similarity index 99% rename from .yarn/cache/@nomicfoundation-ethereumjs-common-npm-4.0.1-db8034d032-af5b599bcc.zip rename to .yarn/cache/@nomicfoundation-ethereumjs-common-npm-4.0.2-2a486d4209-f0d84704d6.zip index 19b88bc3e6..db5653296d 100644 Binary files a/.yarn/cache/@nomicfoundation-ethereumjs-common-npm-4.0.1-db8034d032-af5b599bcc.zip and b/.yarn/cache/@nomicfoundation-ethereumjs-common-npm-4.0.2-2a486d4209-f0d84704d6.zip differ diff --git a/.yarn/cache/@nomicfoundation-ethereumjs-ethash-npm-3.0.1-1306100131-beeec9788a.zip b/.yarn/cache/@nomicfoundation-ethereumjs-ethash-npm-3.0.2-cc0ebd2006-e4011e4019.zip similarity index 95% rename from .yarn/cache/@nomicfoundation-ethereumjs-ethash-npm-3.0.1-1306100131-beeec9788a.zip rename to .yarn/cache/@nomicfoundation-ethereumjs-ethash-npm-3.0.2-cc0ebd2006-e4011e4019.zip index 7a36680db8..c63a2c11af 100644 Binary files a/.yarn/cache/@nomicfoundation-ethereumjs-ethash-npm-3.0.1-1306100131-beeec9788a.zip and b/.yarn/cache/@nomicfoundation-ethereumjs-ethash-npm-3.0.2-cc0ebd2006-e4011e4019.zip differ diff --git a/.yarn/cache/@nomicfoundation-ethereumjs-evm-npm-2.0.1-d5164cbc38-0aa2e1460e.zip b/.yarn/cache/@nomicfoundation-ethereumjs-evm-npm-2.0.2-f0d731b2a8-a23cf57083.zip similarity index 85% rename from .yarn/cache/@nomicfoundation-ethereumjs-evm-npm-2.0.1-d5164cbc38-0aa2e1460e.zip rename to .yarn/cache/@nomicfoundation-ethereumjs-evm-npm-2.0.2-f0d731b2a8-a23cf57083.zip index 77c5348cf3..2a27b0da8a 100644 Binary files a/.yarn/cache/@nomicfoundation-ethereumjs-evm-npm-2.0.1-d5164cbc38-0aa2e1460e.zip and b/.yarn/cache/@nomicfoundation-ethereumjs-evm-npm-2.0.2-f0d731b2a8-a23cf57083.zip differ diff --git a/.yarn/cache/@nomicfoundation-ethereumjs-rlp-npm-5.0.1-57535e6ba3-5a51d2cf92.zip b/.yarn/cache/@nomicfoundation-ethereumjs-rlp-npm-5.0.2-4779aec89a-a74434cade.zip similarity index 94% rename from .yarn/cache/@nomicfoundation-ethereumjs-rlp-npm-5.0.1-57535e6ba3-5a51d2cf92.zip rename to .yarn/cache/@nomicfoundation-ethereumjs-rlp-npm-5.0.2-4779aec89a-a74434cade.zip index 1fe185dffe..33aa21aa04 100644 Binary files a/.yarn/cache/@nomicfoundation-ethereumjs-rlp-npm-5.0.1-57535e6ba3-5a51d2cf92.zip and b/.yarn/cache/@nomicfoundation-ethereumjs-rlp-npm-5.0.2-4779aec89a-a74434cade.zip differ diff --git a/.yarn/cache/@nomicfoundation-ethereumjs-statemanager-npm-2.0.1-2dbc89ff8f-157b503fa3.zip b/.yarn/cache/@nomicfoundation-ethereumjs-statemanager-npm-2.0.2-5465bc8cbc-3ab6578e25.zip similarity index 94% rename from .yarn/cache/@nomicfoundation-ethereumjs-statemanager-npm-2.0.1-2dbc89ff8f-157b503fa3.zip rename to .yarn/cache/@nomicfoundation-ethereumjs-statemanager-npm-2.0.2-5465bc8cbc-3ab6578e25.zip index 7de76f8935..e5d2dbbaf8 100644 Binary files a/.yarn/cache/@nomicfoundation-ethereumjs-statemanager-npm-2.0.1-2dbc89ff8f-157b503fa3.zip and b/.yarn/cache/@nomicfoundation-ethereumjs-statemanager-npm-2.0.2-5465bc8cbc-3ab6578e25.zip differ diff --git a/.yarn/cache/@nomicfoundation-ethereumjs-trie-npm-6.0.1-d6e8b61c63-7001c32041.zip b/.yarn/cache/@nomicfoundation-ethereumjs-trie-npm-6.0.2-405eaf4fb6-d4da918d33.zip similarity index 92% rename from .yarn/cache/@nomicfoundation-ethereumjs-trie-npm-6.0.1-d6e8b61c63-7001c32041.zip rename to .yarn/cache/@nomicfoundation-ethereumjs-trie-npm-6.0.2-405eaf4fb6-d4da918d33.zip index 53cd9efe6b..26c443437a 100644 Binary files a/.yarn/cache/@nomicfoundation-ethereumjs-trie-npm-6.0.1-d6e8b61c63-7001c32041.zip and b/.yarn/cache/@nomicfoundation-ethereumjs-trie-npm-6.0.2-405eaf4fb6-d4da918d33.zip differ diff --git a/.yarn/cache/@nomicfoundation-ethereumjs-tx-npm-5.0.1-25e56e165c-aa3829e4a4.zip b/.yarn/cache/@nomicfoundation-ethereumjs-tx-npm-5.0.2-d7824094e9-0bbcea7578.zip similarity index 95% rename from .yarn/cache/@nomicfoundation-ethereumjs-tx-npm-5.0.1-25e56e165c-aa3829e4a4.zip rename to .yarn/cache/@nomicfoundation-ethereumjs-tx-npm-5.0.2-d7824094e9-0bbcea7578.zip index 7ad7854f6d..8811079157 100644 Binary files a/.yarn/cache/@nomicfoundation-ethereumjs-tx-npm-5.0.1-25e56e165c-aa3829e4a4.zip and b/.yarn/cache/@nomicfoundation-ethereumjs-tx-npm-5.0.2-d7824094e9-0bbcea7578.zip differ diff --git a/.yarn/cache/@nomicfoundation-ethereumjs-util-npm-9.0.1-6715066745-5f8a50a25c.zip b/.yarn/cache/@nomicfoundation-ethereumjs-util-npm-9.0.2-8b4899e586-3a08f7b880.zip similarity index 69% rename from .yarn/cache/@nomicfoundation-ethereumjs-util-npm-9.0.1-6715066745-5f8a50a25c.zip rename to .yarn/cache/@nomicfoundation-ethereumjs-util-npm-9.0.2-8b4899e586-3a08f7b880.zip index 9d13503dfb..e888355d8b 100644 Binary files a/.yarn/cache/@nomicfoundation-ethereumjs-util-npm-9.0.1-6715066745-5f8a50a25c.zip and b/.yarn/cache/@nomicfoundation-ethereumjs-util-npm-9.0.2-8b4899e586-3a08f7b880.zip differ diff --git a/.yarn/cache/@nomicfoundation-ethereumjs-vm-npm-7.0.1-01921364a3-0f63731632.zip b/.yarn/cache/@nomicfoundation-ethereumjs-vm-npm-7.0.2-cd9b4fb94e-1c25ba4d06.zip similarity index 95% rename from .yarn/cache/@nomicfoundation-ethereumjs-vm-npm-7.0.1-01921364a3-0f63731632.zip rename to .yarn/cache/@nomicfoundation-ethereumjs-vm-npm-7.0.2-cd9b4fb94e-1c25ba4d06.zip index 2e9b03496e..04427a6ebe 100644 Binary files a/.yarn/cache/@nomicfoundation-ethereumjs-vm-npm-7.0.1-01921364a3-0f63731632.zip and b/.yarn/cache/@nomicfoundation-ethereumjs-vm-npm-7.0.2-cd9b4fb94e-1c25ba4d06.zip differ diff --git a/.yarn/cache/@solidity-parser-parser-npm-0.16.1-f17d5f8350-d9e2f70424.zip b/.yarn/cache/@solidity-parser-parser-npm-0.16.1-f17d5f8350-d9e2f70424.zip new file mode 100644 index 0000000000..5a3bb4cc3e Binary files /dev/null and b/.yarn/cache/@solidity-parser-parser-npm-0.16.1-f17d5f8350-d9e2f70424.zip differ diff --git a/.yarn/cache/@synthetixio-router-npm-3.1.4-97d58f1412-da369169a1.zip b/.yarn/cache/@synthetixio-router-npm-3.1.4-97d58f1412-da369169a1.zip deleted file mode 100644 index b737c96147..0000000000 Binary files a/.yarn/cache/@synthetixio-router-npm-3.1.4-97d58f1412-da369169a1.zip and /dev/null differ diff --git a/.yarn/cache/@synthetixio-router-npm-3.3.0-4bb2ae4429-923709d5b5.zip b/.yarn/cache/@synthetixio-router-npm-3.3.0-4bb2ae4429-923709d5b5.zip new file mode 100644 index 0000000000..67bbf971b4 Binary files /dev/null and b/.yarn/cache/@synthetixio-router-npm-3.3.0-4bb2ae4429-923709d5b5.zip differ diff --git a/.yarn/cache/@toml-tools-lexer-npm-1.0.0-dec5cd125a-9a0915903a.zip b/.yarn/cache/@toml-tools-lexer-npm-1.0.0-dec5cd125a-9a0915903a.zip new file mode 100644 index 0000000000..ce4cd8b883 Binary files /dev/null and b/.yarn/cache/@toml-tools-lexer-npm-1.0.0-dec5cd125a-9a0915903a.zip differ diff --git a/.yarn/cache/@toml-tools-parser-npm-1.0.0-3b84adb889-3846d9dd7b.zip b/.yarn/cache/@toml-tools-parser-npm-1.0.0-3b84adb889-3846d9dd7b.zip new file mode 100644 index 0000000000..cccc0bd3ac Binary files /dev/null and b/.yarn/cache/@toml-tools-parser-npm-1.0.0-3b84adb889-3846d9dd7b.zip differ diff --git a/.yarn/cache/@types-node-npm-18.11.10-cca0d46cb2-0f60cb090b.zip b/.yarn/cache/@types-node-npm-18.11.10-cca0d46cb2-0f60cb090b.zip deleted file mode 100644 index 6eb3b914b3..0000000000 Binary files a/.yarn/cache/@types-node-npm-18.11.10-cca0d46cb2-0f60cb090b.zip and /dev/null differ diff --git a/.yarn/cache/@types-node-npm-18.17.15-eb331be5c4-eed11d4398.zip b/.yarn/cache/@types-node-npm-18.17.15-eb331be5c4-eed11d4398.zip new file mode 100644 index 0000000000..52a4411d2d Binary files /dev/null and b/.yarn/cache/@types-node-npm-18.17.15-eb331be5c4-eed11d4398.zip differ diff --git a/.yarn/cache/@typescript-eslint-eslint-plugin-npm-5.45.0-af83fa2940-7cff671a9b.zip b/.yarn/cache/@typescript-eslint-eslint-plugin-npm-5.45.0-af83fa2940-7cff671a9b.zip deleted file mode 100644 index 2ad879306b..0000000000 Binary files a/.yarn/cache/@typescript-eslint-eslint-plugin-npm-5.45.0-af83fa2940-7cff671a9b.zip and /dev/null differ diff --git a/.yarn/cache/@typescript-eslint-eslint-plugin-npm-5.62.0-c48b9a5492-fc104b389c.zip b/.yarn/cache/@typescript-eslint-eslint-plugin-npm-5.62.0-c48b9a5492-fc104b389c.zip new file mode 100644 index 0000000000..8b0150ead9 Binary files /dev/null and b/.yarn/cache/@typescript-eslint-eslint-plugin-npm-5.62.0-c48b9a5492-fc104b389c.zip differ diff --git a/.yarn/cache/@typescript-eslint-parser-npm-5.45.0-e50ccdfed6-b8ce3af72d.zip b/.yarn/cache/@typescript-eslint-parser-npm-5.45.0-e50ccdfed6-b8ce3af72d.zip deleted file mode 100644 index 9d35031f31..0000000000 Binary files a/.yarn/cache/@typescript-eslint-parser-npm-5.45.0-e50ccdfed6-b8ce3af72d.zip and /dev/null differ diff --git a/.yarn/cache/@typescript-eslint-parser-npm-5.62.0-c6b29fa302-d168f4c7f2.zip b/.yarn/cache/@typescript-eslint-parser-npm-5.62.0-c6b29fa302-d168f4c7f2.zip new file mode 100644 index 0000000000..183218a4b6 Binary files /dev/null and b/.yarn/cache/@typescript-eslint-parser-npm-5.62.0-c6b29fa302-d168f4c7f2.zip differ diff --git a/.yarn/cache/@typescript-eslint-scope-manager-npm-5.45.0-fc139bdd39-8f686be8ee.zip b/.yarn/cache/@typescript-eslint-scope-manager-npm-5.62.0-c0013838b0-6062d6b797.zip similarity index 61% rename from .yarn/cache/@typescript-eslint-scope-manager-npm-5.45.0-fc139bdd39-8f686be8ee.zip rename to .yarn/cache/@typescript-eslint-scope-manager-npm-5.62.0-c0013838b0-6062d6b797.zip index 31fefffd42..2a092c7e5b 100644 Binary files a/.yarn/cache/@typescript-eslint-scope-manager-npm-5.45.0-fc139bdd39-8f686be8ee.zip and b/.yarn/cache/@typescript-eslint-scope-manager-npm-5.62.0-c0013838b0-6062d6b797.zip differ diff --git a/.yarn/cache/@typescript-eslint-type-utils-npm-5.45.0-3605eae0e9-be96c89b91.zip b/.yarn/cache/@typescript-eslint-type-utils-npm-5.45.0-3605eae0e9-be96c89b91.zip deleted file mode 100644 index e1fdae7536..0000000000 Binary files a/.yarn/cache/@typescript-eslint-type-utils-npm-5.45.0-3605eae0e9-be96c89b91.zip and /dev/null differ diff --git a/.yarn/cache/@typescript-eslint-type-utils-npm-5.62.0-220216d668-fc41eece5f.zip b/.yarn/cache/@typescript-eslint-type-utils-npm-5.62.0-220216d668-fc41eece5f.zip new file mode 100644 index 0000000000..4a7472419a Binary files /dev/null and b/.yarn/cache/@typescript-eslint-type-utils-npm-5.62.0-220216d668-fc41eece5f.zip differ diff --git a/.yarn/cache/@typescript-eslint-types-npm-5.45.0-6888e693c2-43d5336229.zip b/.yarn/cache/@typescript-eslint-types-npm-5.45.0-6888e693c2-43d5336229.zip deleted file mode 100644 index d75b430c49..0000000000 Binary files a/.yarn/cache/@typescript-eslint-types-npm-5.45.0-6888e693c2-43d5336229.zip and /dev/null differ diff --git a/.yarn/cache/@typescript-eslint-types-npm-5.62.0-5c2e0aab15-48c8711738.zip b/.yarn/cache/@typescript-eslint-types-npm-5.62.0-5c2e0aab15-48c8711738.zip new file mode 100644 index 0000000000..9ec0c41955 Binary files /dev/null and b/.yarn/cache/@typescript-eslint-types-npm-5.62.0-5c2e0aab15-48c8711738.zip differ diff --git a/.yarn/cache/@typescript-eslint-typescript-estree-npm-5.45.0-b269876c58-8f48b3c75c.zip b/.yarn/cache/@typescript-eslint-typescript-estree-npm-5.45.0-b269876c58-8f48b3c75c.zip deleted file mode 100644 index 8e3936ce87..0000000000 Binary files a/.yarn/cache/@typescript-eslint-typescript-estree-npm-5.45.0-b269876c58-8f48b3c75c.zip and /dev/null differ diff --git a/.yarn/cache/@typescript-eslint-typescript-estree-npm-5.62.0-5d1ea132a9-3624520abb.zip b/.yarn/cache/@typescript-eslint-typescript-estree-npm-5.62.0-5d1ea132a9-3624520abb.zip new file mode 100644 index 0000000000..6c917f1f0e Binary files /dev/null and b/.yarn/cache/@typescript-eslint-typescript-estree-npm-5.62.0-5d1ea132a9-3624520abb.zip differ diff --git a/.yarn/cache/@typescript-eslint-utils-npm-5.45.0-1d0f09fec7-33a383881e.zip b/.yarn/cache/@typescript-eslint-utils-npm-5.62.0-907f2d579e-ee9398c8c5.zip similarity index 58% rename from .yarn/cache/@typescript-eslint-utils-npm-5.45.0-1d0f09fec7-33a383881e.zip rename to .yarn/cache/@typescript-eslint-utils-npm-5.62.0-907f2d579e-ee9398c8c5.zip index ffe4285542..e08069beec 100644 Binary files a/.yarn/cache/@typescript-eslint-utils-npm-5.45.0-1d0f09fec7-33a383881e.zip and b/.yarn/cache/@typescript-eslint-utils-npm-5.62.0-907f2d579e-ee9398c8c5.zip differ diff --git a/.yarn/cache/@typescript-eslint-visitor-keys-npm-5.45.0-b57c6a9548-050cc4275d.zip b/.yarn/cache/@typescript-eslint-visitor-keys-npm-5.62.0-da1af55f83-976b05d103.zip similarity index 67% rename from .yarn/cache/@typescript-eslint-visitor-keys-npm-5.45.0-b57c6a9548-050cc4275d.zip rename to .yarn/cache/@typescript-eslint-visitor-keys-npm-5.62.0-da1af55f83-976b05d103.zip index a456834f6f..0cd4232480 100644 Binary files a/.yarn/cache/@typescript-eslint-visitor-keys-npm-5.45.0-b57c6a9548-050cc4275d.zip and b/.yarn/cache/@typescript-eslint-visitor-keys-npm-5.62.0-da1af55f83-976b05d103.zip differ diff --git a/.yarn/cache/@usecannon-builder-npm-2.5.1-50cae24e32-f884038063.zip b/.yarn/cache/@usecannon-builder-npm-2.5.1-50cae24e32-f884038063.zip deleted file mode 100644 index 39d466378c..0000000000 Binary files a/.yarn/cache/@usecannon-builder-npm-2.5.1-50cae24e32-f884038063.zip and /dev/null differ diff --git a/.yarn/cache/@usecannon-builder-npm-2.7.1-5addce26b0-547e76098e.zip b/.yarn/cache/@usecannon-builder-npm-2.7.1-5addce26b0-547e76098e.zip new file mode 100644 index 0000000000..c5885f1f32 Binary files /dev/null and b/.yarn/cache/@usecannon-builder-npm-2.7.1-5addce26b0-547e76098e.zip differ diff --git a/.yarn/cache/@usecannon-cli-npm-2.5.1-85b9f517e8-7b31ace8d8.zip b/.yarn/cache/@usecannon-cli-npm-2.5.1-85b9f517e8-7b31ace8d8.zip deleted file mode 100644 index aeac0eeea9..0000000000 Binary files a/.yarn/cache/@usecannon-cli-npm-2.5.1-85b9f517e8-7b31ace8d8.zip and /dev/null differ diff --git a/.yarn/cache/@usecannon-cli-npm-2.7.1-96459b1cd2-c506e76581.zip b/.yarn/cache/@usecannon-cli-npm-2.7.1-96459b1cd2-c506e76581.zip new file mode 100644 index 0000000000..44fb868188 Binary files /dev/null and b/.yarn/cache/@usecannon-cli-npm-2.7.1-96459b1cd2-c506e76581.zip differ diff --git a/.yarn/cache/acorn-npm-6.4.2-94943eb66c-44b0705372.zip b/.yarn/cache/acorn-npm-6.4.2-94943eb66c-44b0705372.zip deleted file mode 100644 index 3d795b4550..0000000000 Binary files a/.yarn/cache/acorn-npm-6.4.2-94943eb66c-44b0705372.zip and /dev/null differ diff --git a/.yarn/cache/acorn-npm-8.10.0-2230c9e83e-538ba38af0.zip b/.yarn/cache/acorn-npm-8.10.0-2230c9e83e-538ba38af0.zip new file mode 100644 index 0000000000..6820207002 Binary files /dev/null and b/.yarn/cache/acorn-npm-8.10.0-2230c9e83e-538ba38af0.zip differ diff --git a/.yarn/cache/acorn-npm-8.9.0-4ebbf0f638-25dfb94952.zip b/.yarn/cache/acorn-npm-8.9.0-4ebbf0f638-25dfb94952.zip deleted file mode 100644 index dda62ad32c..0000000000 Binary files a/.yarn/cache/acorn-npm-8.9.0-4ebbf0f638-25dfb94952.zip and /dev/null differ diff --git a/.yarn/cache/ansi-escapes-npm-5.0.0-8a26b6a77d-d4b5eb8207.zip b/.yarn/cache/ansi-escapes-npm-5.0.0-8a26b6a77d-d4b5eb8207.zip new file mode 100644 index 0000000000..b0fcfc9250 Binary files /dev/null and b/.yarn/cache/ansi-escapes-npm-5.0.0-8a26b6a77d-d4b5eb8207.zip differ diff --git a/.yarn/cache/antlr4-npm-4.13.1-4914d024d1-76dcb0c8ed.zip b/.yarn/cache/antlr4-npm-4.13.1-4914d024d1-76dcb0c8ed.zip new file mode 100644 index 0000000000..2883797318 Binary files /dev/null and b/.yarn/cache/antlr4-npm-4.13.1-4914d024d1-76dcb0c8ed.zip differ diff --git a/.yarn/cache/antlr4-npm-4.7.1-29e15722cd-ac8644a82a.zip b/.yarn/cache/antlr4-npm-4.7.1-29e15722cd-ac8644a82a.zip deleted file mode 100644 index ec8667d6c9..0000000000 Binary files a/.yarn/cache/antlr4-npm-4.7.1-29e15722cd-ac8644a82a.zip and /dev/null differ diff --git a/.yarn/cache/astral-regex-npm-1.0.0-2df7c41332-93417fc087.zip b/.yarn/cache/astral-regex-npm-1.0.0-2df7c41332-93417fc087.zip deleted file mode 100644 index d8a1b724e6..0000000000 Binary files a/.yarn/cache/astral-regex-npm-1.0.0-2df7c41332-93417fc087.zip and /dev/null differ diff --git a/.yarn/cache/caller-callsite-npm-2.0.0-9cf308d7bb-b685e9d126.zip b/.yarn/cache/caller-callsite-npm-2.0.0-9cf308d7bb-b685e9d126.zip deleted file mode 100644 index 95186fffc6..0000000000 Binary files a/.yarn/cache/caller-callsite-npm-2.0.0-9cf308d7bb-b685e9d126.zip and /dev/null differ diff --git a/.yarn/cache/caller-path-npm-2.0.0-7ff6a26cb9-3e12ccd0c7.zip b/.yarn/cache/caller-path-npm-2.0.0-7ff6a26cb9-3e12ccd0c7.zip deleted file mode 100644 index 28b874141a..0000000000 Binary files a/.yarn/cache/caller-path-npm-2.0.0-7ff6a26cb9-3e12ccd0c7.zip and /dev/null differ diff --git a/.yarn/cache/callsite-npm-1.0.0-897924017b-569686d622.zip b/.yarn/cache/callsite-npm-1.0.0-897924017b-569686d622.zip new file mode 100644 index 0000000000..11f54fb99d Binary files /dev/null and b/.yarn/cache/callsite-npm-1.0.0-897924017b-569686d622.zip differ diff --git a/.yarn/cache/callsites-npm-2.0.0-cc39942b7f-be2f67b247.zip b/.yarn/cache/callsites-npm-2.0.0-cc39942b7f-be2f67b247.zip deleted file mode 100644 index ec8d690cd8..0000000000 Binary files a/.yarn/cache/callsites-npm-2.0.0-cc39942b7f-be2f67b247.zip and /dev/null differ diff --git a/.yarn/cache/cannon-plugin-router-npm-1.0.16-ef08f102ec-27f6f54141.zip b/.yarn/cache/cannon-plugin-router-npm-1.0.16-ef08f102ec-27f6f54141.zip deleted file mode 100644 index 0ef029b381..0000000000 Binary files a/.yarn/cache/cannon-plugin-router-npm-1.0.16-ef08f102ec-27f6f54141.zip and /dev/null differ diff --git a/.yarn/cache/chalk-npm-5.3.0-d181999efb-623922e077.zip b/.yarn/cache/chalk-npm-5.3.0-d181999efb-623922e077.zip new file mode 100644 index 0000000000..cdc3e793d5 Binary files /dev/null and b/.yarn/cache/chalk-npm-5.3.0-d181999efb-623922e077.zip differ diff --git a/.yarn/cache/chevrotain-npm-11.0.3-0664cabc35-43abce4ef2.zip b/.yarn/cache/chevrotain-npm-11.0.3-0664cabc35-43abce4ef2.zip new file mode 100644 index 0000000000..8214f27dbb Binary files /dev/null and b/.yarn/cache/chevrotain-npm-11.0.3-0664cabc35-43abce4ef2.zip differ diff --git a/.yarn/cache/cli-cursor-npm-2.1.0-3920629c9c-d88e97bfda.zip b/.yarn/cache/cli-cursor-npm-2.1.0-3920629c9c-d88e97bfda.zip deleted file mode 100644 index b8aff0b465..0000000000 Binary files a/.yarn/cache/cli-cursor-npm-2.1.0-3920629c9c-d88e97bfda.zip and /dev/null differ diff --git a/.yarn/cache/cli-cursor-npm-4.0.0-08e7cbaf41-ab3f3ea207.zip b/.yarn/cache/cli-cursor-npm-4.0.0-08e7cbaf41-ab3f3ea207.zip new file mode 100644 index 0000000000..38e63c54f5 Binary files /dev/null and b/.yarn/cache/cli-cursor-npm-4.0.0-08e7cbaf41-ab3f3ea207.zip differ diff --git a/.yarn/cache/cli-truncate-npm-3.1.0-654d2989ef-c3243e4197.zip b/.yarn/cache/cli-truncate-npm-3.1.0-654d2989ef-c3243e4197.zip new file mode 100644 index 0000000000..6ad23df2a1 Binary files /dev/null and b/.yarn/cache/cli-truncate-npm-3.1.0-654d2989ef-c3243e4197.zip differ diff --git a/.yarn/cache/cli-width-npm-2.2.1-4bdb77393c-3c21b897a2.zip b/.yarn/cache/cli-width-npm-2.2.1-4bdb77393c-3c21b897a2.zip deleted file mode 100644 index c75e542aa2..0000000000 Binary files a/.yarn/cache/cli-width-npm-2.2.1-4bdb77393c-3c21b897a2.zip and /dev/null differ diff --git a/.yarn/cache/colorette-npm-2.0.20-692d428726-0c016fea2b.zip b/.yarn/cache/colorette-npm-2.0.20-692d428726-0c016fea2b.zip new file mode 100644 index 0000000000..3de261a7f1 Binary files /dev/null and b/.yarn/cache/colorette-npm-2.0.20-692d428726-0c016fea2b.zip differ diff --git a/.yarn/cache/commander-npm-10.0.1-f17613b72b-436901d64a.zip b/.yarn/cache/commander-npm-10.0.1-f17613b72b-436901d64a.zip new file mode 100644 index 0000000000..6e5dd2648d Binary files /dev/null and b/.yarn/cache/commander-npm-10.0.1-f17613b72b-436901d64a.zip differ diff --git a/.yarn/cache/commander-npm-11.0.0-7def992f0c-6621954e1e.zip b/.yarn/cache/commander-npm-11.0.0-7def992f0c-6621954e1e.zip new file mode 100644 index 0000000000..978e8ee244 Binary files /dev/null and b/.yarn/cache/commander-npm-11.0.0-7def992f0c-6621954e1e.zip differ diff --git a/.yarn/cache/commander-npm-2.18.0-cee684e8c4-3a31585348.zip b/.yarn/cache/commander-npm-2.18.0-cee684e8c4-3a31585348.zip deleted file mode 100644 index b696535c33..0000000000 Binary files a/.yarn/cache/commander-npm-2.18.0-cee684e8c4-3a31585348.zip and /dev/null differ diff --git a/.yarn/cache/cosmiconfig-npm-5.2.1-4a84462a41-8b6f1d3c8a.zip b/.yarn/cache/cosmiconfig-npm-5.2.1-4a84462a41-8b6f1d3c8a.zip deleted file mode 100644 index 9581de64fc..0000000000 Binary files a/.yarn/cache/cosmiconfig-npm-5.2.1-4a84462a41-8b6f1d3c8a.zip and /dev/null differ diff --git a/.yarn/cache/cosmiconfig-npm-8.3.6-a5566e2779-dc339ebea4.zip b/.yarn/cache/cosmiconfig-npm-8.3.6-a5566e2779-dc339ebea4.zip new file mode 100644 index 0000000000..d8849f72c7 Binary files /dev/null and b/.yarn/cache/cosmiconfig-npm-8.3.6-a5566e2779-dc339ebea4.zip differ diff --git a/.yarn/cache/depcheck-npm-1.4.3-c87d7e7d48-122631cab3.zip b/.yarn/cache/depcheck-npm-1.4.3-c87d7e7d48-122631cab3.zip deleted file mode 100644 index 827b11651e..0000000000 Binary files a/.yarn/cache/depcheck-npm-1.4.3-c87d7e7d48-122631cab3.zip and /dev/null differ diff --git a/.yarn/cache/depcheck-npm-1.4.6-f71c78330d-028c110453.zip b/.yarn/cache/depcheck-npm-1.4.6-f71c78330d-028c110453.zip new file mode 100644 index 0000000000..f0c699af08 Binary files /dev/null and b/.yarn/cache/depcheck-npm-1.4.6-f71c78330d-028c110453.zip differ diff --git a/.yarn/cache/detect-file-npm-1.0.0-a22ca7c5b6-1861e41461.zip b/.yarn/cache/detect-file-npm-1.0.0-a22ca7c5b6-1861e41461.zip new file mode 100644 index 0000000000..0faffbd9f3 Binary files /dev/null and b/.yarn/cache/detect-file-npm-1.0.0-a22ca7c5b6-1861e41461.zip differ diff --git a/.yarn/cache/emoji-regex-npm-10.2.1-463e5e2567-1aa2d16881.zip b/.yarn/cache/emoji-regex-npm-10.2.1-463e5e2567-1aa2d16881.zip deleted file mode 100644 index 75c10d7a4b..0000000000 Binary files a/.yarn/cache/emoji-regex-npm-10.2.1-463e5e2567-1aa2d16881.zip and /dev/null differ diff --git a/.yarn/cache/eslint-config-prettier-npm-8.5.0-a1dd58b6d8-0d0f5c32e7.zip b/.yarn/cache/eslint-config-prettier-npm-8.5.0-a1dd58b6d8-0d0f5c32e7.zip deleted file mode 100644 index 3e369149fe..0000000000 Binary files a/.yarn/cache/eslint-config-prettier-npm-8.5.0-a1dd58b6d8-0d0f5c32e7.zip and /dev/null differ diff --git a/.yarn/cache/eslint-npm-5.16.0-91d3d3fc21-53c6b94209.zip b/.yarn/cache/eslint-npm-5.16.0-91d3d3fc21-53c6b94209.zip deleted file mode 100644 index 8945be9185..0000000000 Binary files a/.yarn/cache/eslint-npm-5.16.0-91d3d3fc21-53c6b94209.zip and /dev/null differ diff --git a/.yarn/cache/eslint-npm-8.29.0-289be12b40-e05204b059.zip b/.yarn/cache/eslint-npm-8.29.0-289be12b40-e05204b059.zip deleted file mode 100644 index 5a4ab3e845..0000000000 Binary files a/.yarn/cache/eslint-npm-8.29.0-289be12b40-e05204b059.zip and /dev/null differ diff --git a/.yarn/cache/eslint-npm-8.49.0-1b802e43a1-4dfe257e1e.zip b/.yarn/cache/eslint-npm-8.49.0-1b802e43a1-4dfe257e1e.zip new file mode 100644 index 0000000000..352a7a1594 Binary files /dev/null and b/.yarn/cache/eslint-npm-8.49.0-1b802e43a1-4dfe257e1e.zip differ diff --git a/.yarn/cache/eslint-scope-npm-4.0.3-1492c6d263-c5f835f681.zip b/.yarn/cache/eslint-scope-npm-4.0.3-1492c6d263-c5f835f681.zip deleted file mode 100644 index ad2e0ed872..0000000000 Binary files a/.yarn/cache/eslint-scope-npm-4.0.3-1492c6d263-c5f835f681.zip and /dev/null differ diff --git a/.yarn/cache/eslint-scope-npm-7.2.0-88784f5a38-64591a2d8b.zip b/.yarn/cache/eslint-scope-npm-7.2.2-53cb0df8e8-ec97dbf5fb.zip similarity index 64% rename from .yarn/cache/eslint-scope-npm-7.2.0-88784f5a38-64591a2d8b.zip rename to .yarn/cache/eslint-scope-npm-7.2.2-53cb0df8e8-ec97dbf5fb.zip index 466323f2bc..29b002eb98 100644 Binary files a/.yarn/cache/eslint-scope-npm-7.2.0-88784f5a38-64591a2d8b.zip and b/.yarn/cache/eslint-scope-npm-7.2.2-53cb0df8e8-ec97dbf5fb.zip differ diff --git a/.yarn/cache/eslint-utils-npm-1.4.3-b8f8bce3ac-a20630e686.zip b/.yarn/cache/eslint-utils-npm-1.4.3-b8f8bce3ac-a20630e686.zip deleted file mode 100644 index 765c77f2e1..0000000000 Binary files a/.yarn/cache/eslint-utils-npm-1.4.3-b8f8bce3ac-a20630e686.zip and /dev/null differ diff --git a/.yarn/cache/eslint-utils-npm-3.0.0-630b3a4013-0668fe02f5.zip b/.yarn/cache/eslint-utils-npm-3.0.0-630b3a4013-0668fe02f5.zip deleted file mode 100644 index 1ece43c644..0000000000 Binary files a/.yarn/cache/eslint-utils-npm-3.0.0-630b3a4013-0668fe02f5.zip and /dev/null differ diff --git a/.yarn/cache/eslint-visitor-keys-npm-1.3.0-c07780a0fb-37a19b712f.zip b/.yarn/cache/eslint-visitor-keys-npm-1.3.0-c07780a0fb-37a19b712f.zip deleted file mode 100644 index 070b3cb788..0000000000 Binary files a/.yarn/cache/eslint-visitor-keys-npm-1.3.0-c07780a0fb-37a19b712f.zip and /dev/null differ diff --git a/.yarn/cache/eslint-visitor-keys-npm-2.1.0-c31806b6b9-e3081d7dd2.zip b/.yarn/cache/eslint-visitor-keys-npm-2.1.0-c31806b6b9-e3081d7dd2.zip deleted file mode 100644 index a99eddbc6a..0000000000 Binary files a/.yarn/cache/eslint-visitor-keys-npm-2.1.0-c31806b6b9-e3081d7dd2.zip and /dev/null differ diff --git a/.yarn/cache/eslint-visitor-keys-npm-3.4.1-a5d0a58208-f05121d868.zip b/.yarn/cache/eslint-visitor-keys-npm-3.4.3-a356ac7e46-36e9ef87fc.zip similarity index 78% rename from .yarn/cache/eslint-visitor-keys-npm-3.4.1-a5d0a58208-f05121d868.zip rename to .yarn/cache/eslint-visitor-keys-npm-3.4.3-a356ac7e46-36e9ef87fc.zip index e442ca3b41..7c61b814bf 100644 Binary files a/.yarn/cache/eslint-visitor-keys-npm-3.4.1-a5d0a58208-f05121d868.zip and b/.yarn/cache/eslint-visitor-keys-npm-3.4.3-a356ac7e46-36e9ef87fc.zip differ diff --git a/.yarn/cache/espree-npm-5.0.1-abcab55b28-a091aac2bd.zip b/.yarn/cache/espree-npm-5.0.1-abcab55b28-a091aac2bd.zip deleted file mode 100644 index e7baca3a20..0000000000 Binary files a/.yarn/cache/espree-npm-5.0.1-abcab55b28-a091aac2bd.zip and /dev/null differ diff --git a/.yarn/cache/espree-npm-9.5.2-5fc9506cda-6506289d6e.zip b/.yarn/cache/espree-npm-9.5.2-5fc9506cda-6506289d6e.zip deleted file mode 100644 index 4c6380f990..0000000000 Binary files a/.yarn/cache/espree-npm-9.5.2-5fc9506cda-6506289d6e.zip and /dev/null differ diff --git a/.yarn/cache/espree-npm-9.6.1-a50722a5a9-eb8c149c7a.zip b/.yarn/cache/espree-npm-9.6.1-a50722a5a9-eb8c149c7a.zip new file mode 100644 index 0000000000..0014c0574a Binary files /dev/null and b/.yarn/cache/espree-npm-9.6.1-a50722a5a9-eb8c149c7a.zip differ diff --git a/.yarn/cache/eventemitter3-npm-5.0.1-5e423b7df3-543d6c858a.zip b/.yarn/cache/eventemitter3-npm-5.0.1-5e423b7df3-543d6c858a.zip new file mode 100644 index 0000000000..d7bc3706f4 Binary files /dev/null and b/.yarn/cache/eventemitter3-npm-5.0.1-5e423b7df3-543d6c858a.zip differ diff --git a/.yarn/cache/execa-npm-4.1.0-cc675b4189-e30d298934.zip b/.yarn/cache/execa-npm-4.1.0-cc675b4189-e30d298934.zip deleted file mode 100644 index bffd898183..0000000000 Binary files a/.yarn/cache/execa-npm-4.1.0-cc675b4189-e30d298934.zip and /dev/null differ diff --git a/.yarn/cache/execa-npm-7.2.0-7797cafb24-14fd17ba0c.zip b/.yarn/cache/execa-npm-7.2.0-7797cafb24-14fd17ba0c.zip new file mode 100644 index 0000000000..ecc5564581 Binary files /dev/null and b/.yarn/cache/execa-npm-7.2.0-7797cafb24-14fd17ba0c.zip differ diff --git a/.yarn/cache/expand-tilde-npm-2.0.2-a4020a62f5-2efe6ed407.zip b/.yarn/cache/expand-tilde-npm-2.0.2-a4020a62f5-2efe6ed407.zip new file mode 100644 index 0000000000..fc0ee70eb1 Binary files /dev/null and b/.yarn/cache/expand-tilde-npm-2.0.2-a4020a62f5-2efe6ed407.zip differ diff --git a/.yarn/cache/figures-npm-2.0.0-f2db814eec-081beb16ea.zip b/.yarn/cache/figures-npm-2.0.0-f2db814eec-081beb16ea.zip deleted file mode 100644 index 6f6dfbb7d4..0000000000 Binary files a/.yarn/cache/figures-npm-2.0.0-f2db814eec-081beb16ea.zip and /dev/null differ diff --git a/.yarn/cache/file-entry-cache-npm-5.0.1-7212af17f3-9014b17766.zip b/.yarn/cache/file-entry-cache-npm-5.0.1-7212af17f3-9014b17766.zip deleted file mode 100644 index 7a48922c93..0000000000 Binary files a/.yarn/cache/file-entry-cache-npm-5.0.1-7212af17f3-9014b17766.zip and /dev/null differ diff --git a/.yarn/cache/findup-sync-npm-5.0.0-3de27edc83-576716c77a.zip b/.yarn/cache/findup-sync-npm-5.0.0-3de27edc83-576716c77a.zip new file mode 100644 index 0000000000..ce93f7927f Binary files /dev/null and b/.yarn/cache/findup-sync-npm-5.0.0-3de27edc83-576716c77a.zip differ diff --git a/.yarn/cache/flat-cache-npm-2.0.1-abf037b0b9-0f5e664676.zip b/.yarn/cache/flat-cache-npm-2.0.1-abf037b0b9-0f5e664676.zip deleted file mode 100644 index d23a3828df..0000000000 Binary files a/.yarn/cache/flat-cache-npm-2.0.1-abf037b0b9-0f5e664676.zip and /dev/null differ diff --git a/.yarn/cache/flatted-npm-2.0.2-ccb06e14ff-473c754db7.zip b/.yarn/cache/flatted-npm-2.0.2-ccb06e14ff-473c754db7.zip deleted file mode 100644 index ee141710fd..0000000000 Binary files a/.yarn/cache/flatted-npm-2.0.2-ccb06e14ff-473c754db7.zip and /dev/null differ diff --git a/.yarn/cache/get-stream-npm-5.2.0-2cfd3b452b-8bc1a23174.zip b/.yarn/cache/get-stream-npm-5.2.0-2cfd3b452b-8bc1a23174.zip deleted file mode 100644 index f5e0b29aa2..0000000000 Binary files a/.yarn/cache/get-stream-npm-5.2.0-2cfd3b452b-8bc1a23174.zip and /dev/null differ diff --git a/.yarn/cache/glob-npm-8.1.0-65f64af8b1-92fbea3221.zip b/.yarn/cache/glob-npm-8.1.0-65f64af8b1-92fbea3221.zip new file mode 100644 index 0000000000..3fc76b5789 Binary files /dev/null and b/.yarn/cache/glob-npm-8.1.0-65f64af8b1-92fbea3221.zip differ diff --git a/.yarn/cache/global-modules-npm-1.0.0-70c522e57a-10be68796c.zip b/.yarn/cache/global-modules-npm-1.0.0-70c522e57a-10be68796c.zip new file mode 100644 index 0000000000..af94b3e109 Binary files /dev/null and b/.yarn/cache/global-modules-npm-1.0.0-70c522e57a-10be68796c.zip differ diff --git a/.yarn/cache/global-prefix-npm-1.0.2-a96996834b-061b43470f.zip b/.yarn/cache/global-prefix-npm-1.0.2-a96996834b-061b43470f.zip new file mode 100644 index 0000000000..9ad747f1e7 Binary files /dev/null and b/.yarn/cache/global-prefix-npm-1.0.2-a96996834b-061b43470f.zip differ diff --git a/.yarn/cache/grapheme-splitter-npm-1.0.4-648f2bf509-0c22ec54de.zip b/.yarn/cache/grapheme-splitter-npm-1.0.4-648f2bf509-0c22ec54de.zip deleted file mode 100644 index 1eb26cc6a9..0000000000 Binary files a/.yarn/cache/grapheme-splitter-npm-1.0.4-648f2bf509-0c22ec54de.zip and /dev/null differ diff --git a/.yarn/cache/graphemer-npm-1.4.0-0627732d35-bab8f0be9b.zip b/.yarn/cache/graphemer-npm-1.4.0-0627732d35-bab8f0be9b.zip new file mode 100644 index 0000000000..e04f8d3724 Binary files /dev/null and b/.yarn/cache/graphemer-npm-1.4.0-0627732d35-bab8f0be9b.zip differ diff --git a/.yarn/cache/hardhat-cannon-npm-2.5.1-966d2a1418-043c553eda.zip b/.yarn/cache/hardhat-cannon-npm-2.5.1-966d2a1418-043c553eda.zip deleted file mode 100644 index 1318658ab4..0000000000 Binary files a/.yarn/cache/hardhat-cannon-npm-2.5.1-966d2a1418-043c553eda.zip and /dev/null differ diff --git a/.yarn/cache/hardhat-cannon-npm-2.7.1-ac0ccef2ca-1bf091eb6d.zip b/.yarn/cache/hardhat-cannon-npm-2.7.1-ac0ccef2ca-1bf091eb6d.zip new file mode 100644 index 0000000000..a404e0063f Binary files /dev/null and b/.yarn/cache/hardhat-cannon-npm-2.7.1-ac0ccef2ca-1bf091eb6d.zip differ diff --git a/.yarn/cache/hardhat-npm-2.15.0-8314009c1c-46767f0eb7.zip b/.yarn/cache/hardhat-npm-2.15.0-8314009c1c-46767f0eb7.zip deleted file mode 100644 index 458334b0fa..0000000000 Binary files a/.yarn/cache/hardhat-npm-2.15.0-8314009c1c-46767f0eb7.zip and /dev/null differ diff --git a/.yarn/cache/hardhat-npm-2.17.2-1d415d2ac1-7c80f45354.zip b/.yarn/cache/hardhat-npm-2.17.2-1d415d2ac1-7c80f45354.zip new file mode 100644 index 0000000000..45426f155a Binary files /dev/null and b/.yarn/cache/hardhat-npm-2.17.2-1d415d2ac1-7c80f45354.zip differ diff --git a/.yarn/cache/homedir-polyfill-npm-1.0.3-da1a29ce00-18dd4db870.zip b/.yarn/cache/homedir-polyfill-npm-1.0.3-da1a29ce00-18dd4db870.zip new file mode 100644 index 0000000000..fca8dc7f43 Binary files /dev/null and b/.yarn/cache/homedir-polyfill-npm-1.0.3-da1a29ce00-18dd4db870.zip differ diff --git a/.yarn/cache/human-signals-npm-1.1.1-616b2586c2-d587647c9e.zip b/.yarn/cache/human-signals-npm-1.1.1-616b2586c2-d587647c9e.zip deleted file mode 100644 index 1dcc5877fe..0000000000 Binary files a/.yarn/cache/human-signals-npm-1.1.1-616b2586c2-d587647c9e.zip and /dev/null differ diff --git a/.yarn/cache/human-signals-npm-4.3.1-d723001512-6f12958df3.zip b/.yarn/cache/human-signals-npm-4.3.1-d723001512-6f12958df3.zip new file mode 100644 index 0000000000..cbe609e775 Binary files /dev/null and b/.yarn/cache/human-signals-npm-4.3.1-d723001512-6f12958df3.zip differ diff --git a/.yarn/cache/ignore-npm-4.0.6-66c0d6543e-248f82e50a.zip b/.yarn/cache/ignore-npm-4.0.6-66c0d6543e-248f82e50a.zip deleted file mode 100644 index f5bcbcf28e..0000000000 Binary files a/.yarn/cache/ignore-npm-4.0.6-66c0d6543e-248f82e50a.zip and /dev/null differ diff --git a/.yarn/cache/import-fresh-npm-2.0.0-8b4e6073aa-610255f975.zip b/.yarn/cache/import-fresh-npm-2.0.0-8b4e6073aa-610255f975.zip deleted file mode 100644 index d672e73ecb..0000000000 Binary files a/.yarn/cache/import-fresh-npm-2.0.0-8b4e6073aa-610255f975.zip and /dev/null differ diff --git a/.yarn/cache/inquirer-npm-6.5.2-4f6408c247-175ad4cd1e.zip b/.yarn/cache/inquirer-npm-6.5.2-4f6408c247-175ad4cd1e.zip deleted file mode 100644 index 20b2deb196..0000000000 Binary files a/.yarn/cache/inquirer-npm-6.5.2-4f6408c247-175ad4cd1e.zip and /dev/null differ diff --git a/.yarn/cache/invariant-npm-2.2.4-717fbdb119-cc3182d793.zip b/.yarn/cache/invariant-npm-2.2.4-717fbdb119-cc3182d793.zip deleted file mode 100644 index 710cf6cd91..0000000000 Binary files a/.yarn/cache/invariant-npm-2.2.4-717fbdb119-cc3182d793.zip and /dev/null differ diff --git a/.yarn/cache/is-directory-npm-0.3.1-e835db28ed-dce9a9d398.zip b/.yarn/cache/is-directory-npm-0.3.1-e835db28ed-dce9a9d398.zip deleted file mode 100644 index 9c193acc61..0000000000 Binary files a/.yarn/cache/is-directory-npm-0.3.1-e835db28ed-dce9a9d398.zip and /dev/null differ diff --git a/.yarn/cache/is-fullwidth-code-point-npm-4.0.0-848488b60d-8ae89bf505.zip b/.yarn/cache/is-fullwidth-code-point-npm-4.0.0-848488b60d-8ae89bf505.zip new file mode 100644 index 0000000000..dbeb234d28 Binary files /dev/null and b/.yarn/cache/is-fullwidth-code-point-npm-4.0.0-848488b60d-8ae89bf505.zip differ diff --git a/.yarn/cache/is-stream-npm-3.0.0-a77ac9a62e-172093fe99.zip b/.yarn/cache/is-stream-npm-3.0.0-a77ac9a62e-172093fe99.zip new file mode 100644 index 0000000000..71e7d6518f Binary files /dev/null and b/.yarn/cache/is-stream-npm-3.0.0-a77ac9a62e-172093fe99.zip differ diff --git a/.yarn/cache/lilconfig-npm-2.1.0-a179261924-8549bb352b.zip b/.yarn/cache/lilconfig-npm-2.1.0-a179261924-8549bb352b.zip new file mode 100644 index 0000000000..44e3230ea2 Binary files /dev/null and b/.yarn/cache/lilconfig-npm-2.1.0-a179261924-8549bb352b.zip differ diff --git a/.yarn/cache/lint-staged-npm-14.0.1-50e37043be-8c5d740cb3.zip b/.yarn/cache/lint-staged-npm-14.0.1-50e37043be-8c5d740cb3.zip new file mode 100644 index 0000000000..b1cfbb47c9 Binary files /dev/null and b/.yarn/cache/lint-staged-npm-14.0.1-50e37043be-8c5d740cb3.zip differ diff --git a/.yarn/cache/listr2-npm-6.6.1-74fafa58ff-99600e8a51.zip b/.yarn/cache/listr2-npm-6.6.1-74fafa58ff-99600e8a51.zip new file mode 100644 index 0000000000..5c15aba425 Binary files /dev/null and b/.yarn/cache/listr2-npm-6.6.1-74fafa58ff-99600e8a51.zip differ diff --git a/.yarn/cache/lodash-es-npm-4.17.21-b45832dfce-05cbffad6e.zip b/.yarn/cache/lodash-es-npm-4.17.21-b45832dfce-05cbffad6e.zip new file mode 100644 index 0000000000..c95a052eeb Binary files /dev/null and b/.yarn/cache/lodash-es-npm-4.17.21-b45832dfce-05cbffad6e.zip differ diff --git a/.yarn/cache/log-update-npm-5.0.1-1e016d7086-2c6b47dcce.zip b/.yarn/cache/log-update-npm-5.0.1-1e016d7086-2c6b47dcce.zip new file mode 100644 index 0000000000..fce549b896 Binary files /dev/null and b/.yarn/cache/log-update-npm-5.0.1-1e016d7086-2c6b47dcce.zip differ diff --git a/.yarn/cache/loose-envify-npm-1.4.0-6307b72ccf-6517e24e0c.zip b/.yarn/cache/loose-envify-npm-1.4.0-6307b72ccf-6517e24e0c.zip deleted file mode 100644 index ba25b876ce..0000000000 Binary files a/.yarn/cache/loose-envify-npm-1.4.0-6307b72ccf-6517e24e0c.zip and /dev/null differ diff --git a/.yarn/cache/mimic-fn-npm-1.2.0-960bf15ab7-69c0820515.zip b/.yarn/cache/mimic-fn-npm-1.2.0-960bf15ab7-69c0820515.zip deleted file mode 100644 index ae711478fd..0000000000 Binary files a/.yarn/cache/mimic-fn-npm-1.2.0-960bf15ab7-69c0820515.zip and /dev/null differ diff --git a/.yarn/cache/mimic-fn-npm-4.0.0-feaeda79f7-995dcece15.zip b/.yarn/cache/mimic-fn-npm-4.0.0-feaeda79f7-995dcece15.zip new file mode 100644 index 0000000000..f990f1de11 Binary files /dev/null and b/.yarn/cache/mimic-fn-npm-4.0.0-feaeda79f7-995dcece15.zip differ diff --git a/.yarn/cache/mri-npm-1.2.0-8ecee0357d-83f515abbc.zip b/.yarn/cache/mri-npm-1.2.0-8ecee0357d-83f515abbc.zip deleted file mode 100644 index 89ae2ac72e..0000000000 Binary files a/.yarn/cache/mri-npm-1.2.0-8ecee0357d-83f515abbc.zip and /dev/null differ diff --git a/.yarn/cache/multimatch-npm-4.0.0-8c467f035e-bdb6a98dad.zip b/.yarn/cache/multimatch-npm-4.0.0-8c467f035e-bdb6a98dad.zip deleted file mode 100644 index abb6cf60c2..0000000000 Binary files a/.yarn/cache/multimatch-npm-4.0.0-8c467f035e-bdb6a98dad.zip and /dev/null differ diff --git a/.yarn/cache/mute-stream-npm-0.0.7-22b59a65dd-a9d4772c1c.zip b/.yarn/cache/mute-stream-npm-0.0.7-22b59a65dd-a9d4772c1c.zip deleted file mode 100644 index b1d92e46c3..0000000000 Binary files a/.yarn/cache/mute-stream-npm-0.0.7-22b59a65dd-a9d4772c1c.zip and /dev/null differ diff --git a/.yarn/cache/npm-run-path-npm-5.1.0-79c0668d42-dc184eb5ec.zip b/.yarn/cache/npm-run-path-npm-5.1.0-79c0668d42-dc184eb5ec.zip new file mode 100644 index 0000000000..9b9a307b43 Binary files /dev/null and b/.yarn/cache/npm-run-path-npm-5.1.0-79c0668d42-dc184eb5ec.zip differ diff --git a/.yarn/cache/onetime-npm-2.0.1-6c39ecc911-bb44015ac7.zip b/.yarn/cache/onetime-npm-2.0.1-6c39ecc911-bb44015ac7.zip deleted file mode 100644 index df76b4087b..0000000000 Binary files a/.yarn/cache/onetime-npm-2.0.1-6c39ecc911-bb44015ac7.zip and /dev/null differ diff --git a/.yarn/cache/onetime-npm-6.0.0-4f3684e29a-0846ce78e4.zip b/.yarn/cache/onetime-npm-6.0.0-4f3684e29a-0846ce78e4.zip new file mode 100644 index 0000000000..05f13202f3 Binary files /dev/null and b/.yarn/cache/onetime-npm-6.0.0-4f3684e29a-0846ce78e4.zip differ diff --git a/.yarn/cache/optionator-npm-0.9.1-577e397aae-dbc6fa0656.zip b/.yarn/cache/optionator-npm-0.9.1-577e397aae-dbc6fa0656.zip deleted file mode 100644 index 6e6efe345b..0000000000 Binary files a/.yarn/cache/optionator-npm-0.9.1-577e397aae-dbc6fa0656.zip and /dev/null differ diff --git a/.yarn/cache/optionator-npm-0.9.3-56c3a4bf80-0928199944.zip b/.yarn/cache/optionator-npm-0.9.3-56c3a4bf80-0928199944.zip new file mode 100644 index 0000000000..06266323c5 Binary files /dev/null and b/.yarn/cache/optionator-npm-0.9.3-56c3a4bf80-0928199944.zip differ diff --git a/.yarn/cache/parse-passwd-npm-1.0.0-ace6effa1d-4e55e0231d.zip b/.yarn/cache/parse-passwd-npm-1.0.0-ace6effa1d-4e55e0231d.zip new file mode 100644 index 0000000000..8181edb9be Binary files /dev/null and b/.yarn/cache/parse-passwd-npm-1.0.0-ace6effa1d-4e55e0231d.zip differ diff --git a/.yarn/cache/path-is-inside-npm-1.0.2-7dd0711668-0b5b6c92d3.zip b/.yarn/cache/path-is-inside-npm-1.0.2-7dd0711668-0b5b6c92d3.zip deleted file mode 100644 index bfca0c80e8..0000000000 Binary files a/.yarn/cache/path-is-inside-npm-1.0.2-7dd0711668-0b5b6c92d3.zip and /dev/null differ diff --git a/.yarn/cache/path-key-npm-4.0.0-2bce99f089-8e6c314ae6.zip b/.yarn/cache/path-key-npm-4.0.0-2bce99f089-8e6c314ae6.zip new file mode 100644 index 0000000000..271eb03454 Binary files /dev/null and b/.yarn/cache/path-key-npm-4.0.0-2bce99f089-8e6c314ae6.zip differ diff --git a/.yarn/cache/pidtree-npm-0.6.0-3d92e16117-8fbc073ede.zip b/.yarn/cache/pidtree-npm-0.6.0-3d92e16117-8fbc073ede.zip new file mode 100644 index 0000000000..e8ebaafb71 Binary files /dev/null and b/.yarn/cache/pidtree-npm-0.6.0-3d92e16117-8fbc073ede.zip differ diff --git a/.yarn/cache/prettier-npm-3.0.3-fced695dae-e10b9af02b.zip b/.yarn/cache/prettier-npm-3.0.3-fced695dae-e10b9af02b.zip new file mode 100644 index 0000000000..f1682d4dcb Binary files /dev/null and b/.yarn/cache/prettier-npm-3.0.3-fced695dae-e10b9af02b.zip differ diff --git a/.yarn/cache/prettier-plugin-solidity-npm-1.0.0-ad10eeb761-2ca347d66f.zip b/.yarn/cache/prettier-plugin-solidity-npm-1.0.0-ad10eeb761-2ca347d66f.zip deleted file mode 100644 index 972ab4d727..0000000000 Binary files a/.yarn/cache/prettier-plugin-solidity-npm-1.0.0-ad10eeb761-2ca347d66f.zip and /dev/null differ diff --git a/.yarn/cache/prettier-plugin-solidity-npm-1.1.3-3e3ef1d4d5-d5aadfa411.zip b/.yarn/cache/prettier-plugin-solidity-npm-1.1.3-3e3ef1d4d5-d5aadfa411.zip new file mode 100644 index 0000000000..dc88aa0146 Binary files /dev/null and b/.yarn/cache/prettier-plugin-solidity-npm-1.1.3-3e3ef1d4d5-d5aadfa411.zip differ diff --git a/.yarn/cache/prettier-plugin-toml-npm-1.0.0-adfede52f0-6c88367061.zip b/.yarn/cache/prettier-plugin-toml-npm-1.0.0-adfede52f0-6c88367061.zip new file mode 100644 index 0000000000..7b97fbd2a8 Binary files /dev/null and b/.yarn/cache/prettier-plugin-toml-npm-1.0.0-adfede52f0-6c88367061.zip differ diff --git a/.yarn/cache/pretty-quick-npm-3.1.3-b3fdb9cf9e-28bdc32571.zip b/.yarn/cache/pretty-quick-npm-3.1.3-b3fdb9cf9e-28bdc32571.zip deleted file mode 100644 index 19901481e0..0000000000 Binary files a/.yarn/cache/pretty-quick-npm-3.1.3-b3fdb9cf9e-28bdc32571.zip and /dev/null differ diff --git a/.yarn/cache/progress-npm-2.0.3-d1f87e2ac6-f67403fe7b.zip b/.yarn/cache/progress-npm-2.0.3-d1f87e2ac6-f67403fe7b.zip deleted file mode 100644 index 0585bd0a62..0000000000 Binary files a/.yarn/cache/progress-npm-2.0.3-d1f87e2ac6-f67403fe7b.zip and /dev/null differ diff --git a/.yarn/cache/pump-npm-3.0.0-0080bf6a7a-e42e9229fb.zip b/.yarn/cache/pump-npm-3.0.0-0080bf6a7a-e42e9229fb.zip deleted file mode 100644 index 0585683621..0000000000 Binary files a/.yarn/cache/pump-npm-3.0.0-0080bf6a7a-e42e9229fb.zip and /dev/null differ diff --git a/.yarn/cache/query-ast-npm-1.0.5-2a31f26c3c-4b7ae79bc9.zip b/.yarn/cache/query-ast-npm-1.0.5-2a31f26c3c-4b7ae79bc9.zip deleted file mode 100644 index 48090f1c35..0000000000 Binary files a/.yarn/cache/query-ast-npm-1.0.5-2a31f26c3c-4b7ae79bc9.zip and /dev/null differ diff --git a/.yarn/cache/regexpp-npm-2.0.1-ac47f2bc1e-1f41cf80ac.zip b/.yarn/cache/regexpp-npm-2.0.1-ac47f2bc1e-1f41cf80ac.zip deleted file mode 100644 index 43f2b03538..0000000000 Binary files a/.yarn/cache/regexpp-npm-2.0.1-ac47f2bc1e-1f41cf80ac.zip and /dev/null differ diff --git a/.yarn/cache/regexpp-npm-3.2.0-2513f32cfc-a78dc5c715.zip b/.yarn/cache/regexpp-npm-3.2.0-2513f32cfc-a78dc5c715.zip deleted file mode 100644 index 9dac209df2..0000000000 Binary files a/.yarn/cache/regexpp-npm-3.2.0-2513f32cfc-a78dc5c715.zip and /dev/null differ diff --git a/.yarn/cache/resolve-dir-npm-1.0.1-0a95903c18-ef736b8ed6.zip b/.yarn/cache/resolve-dir-npm-1.0.1-0a95903c18-ef736b8ed6.zip new file mode 100644 index 0000000000..448e0e0b44 Binary files /dev/null and b/.yarn/cache/resolve-dir-npm-1.0.1-0a95903c18-ef736b8ed6.zip differ diff --git a/.yarn/cache/restore-cursor-npm-2.0.0-80278eb6b7-482e13d02d.zip b/.yarn/cache/restore-cursor-npm-2.0.0-80278eb6b7-482e13d02d.zip deleted file mode 100644 index 3b01b88c0e..0000000000 Binary files a/.yarn/cache/restore-cursor-npm-2.0.0-80278eb6b7-482e13d02d.zip and /dev/null differ diff --git a/.yarn/cache/restore-cursor-npm-4.0.0-d42254f39d-5b675c5a59.zip b/.yarn/cache/restore-cursor-npm-4.0.0-d42254f39d-5b675c5a59.zip new file mode 100644 index 0000000000..f1f1637093 Binary files /dev/null and b/.yarn/cache/restore-cursor-npm-4.0.0-d42254f39d-5b675c5a59.zip differ diff --git a/.yarn/cache/rimraf-npm-2.6.3-f34c6c72ec-3ea587b981.zip b/.yarn/cache/rimraf-npm-2.6.3-f34c6c72ec-3ea587b981.zip deleted file mode 100644 index 8749dff0a0..0000000000 Binary files a/.yarn/cache/rimraf-npm-2.6.3-f34c6c72ec-3ea587b981.zip and /dev/null differ diff --git a/.yarn/cache/rxjs-npm-6.6.7-055046ea3c-bc334edef1.zip b/.yarn/cache/rxjs-npm-6.6.7-055046ea3c-bc334edef1.zip deleted file mode 100644 index ba92cebbd3..0000000000 Binary files a/.yarn/cache/rxjs-npm-6.6.7-055046ea3c-bc334edef1.zip and /dev/null differ diff --git a/.yarn/cache/sass-npm-1.63.6-f415fe5e15-3372319904.zip b/.yarn/cache/sass-npm-1.63.6-f415fe5e15-3372319904.zip deleted file mode 100644 index 7e8cd0d43c..0000000000 Binary files a/.yarn/cache/sass-npm-1.63.6-f415fe5e15-3372319904.zip and /dev/null differ diff --git a/.yarn/cache/scss-parser-npm-1.0.6-2d17cabd8b-f1424d73e9.zip b/.yarn/cache/scss-parser-npm-1.0.6-2d17cabd8b-f1424d73e9.zip deleted file mode 100644 index 0161e2c920..0000000000 Binary files a/.yarn/cache/scss-parser-npm-1.0.6-2d17cabd8b-f1424d73e9.zip and /dev/null differ diff --git a/.yarn/cache/semver-npm-7.5.3-275095dbf3-9d58db1652.zip b/.yarn/cache/semver-npm-7.5.4-c4ad957fcd-12d8ad952f.zip similarity index 77% rename from .yarn/cache/semver-npm-7.5.3-275095dbf3-9d58db1652.zip rename to .yarn/cache/semver-npm-7.5.4-c4ad957fcd-12d8ad952f.zip index 79b7d4718c..f8689471f5 100644 Binary files a/.yarn/cache/semver-npm-7.5.3-275095dbf3-9d58db1652.zip and b/.yarn/cache/semver-npm-7.5.4-c4ad957fcd-12d8ad952f.zip differ diff --git a/.yarn/cache/slice-ansi-npm-2.1.0-02505ccc06-4e82995aa5.zip b/.yarn/cache/slice-ansi-npm-2.1.0-02505ccc06-4e82995aa5.zip deleted file mode 100644 index 23b558a262..0000000000 Binary files a/.yarn/cache/slice-ansi-npm-2.1.0-02505ccc06-4e82995aa5.zip and /dev/null differ diff --git a/.yarn/cache/slice-ansi-npm-5.0.0-8cd4f226df-7e600a2a55.zip b/.yarn/cache/slice-ansi-npm-5.0.0-8cd4f226df-7e600a2a55.zip new file mode 100644 index 0000000000..d3e5c6f1ab Binary files /dev/null and b/.yarn/cache/slice-ansi-npm-5.0.0-8cd4f226df-7e600a2a55.zip differ diff --git a/.yarn/cache/solc-npm-0.8.20-6c9aca8747-8ff85f5e4a.zip b/.yarn/cache/solc-npm-0.8.20-6c9aca8747-8ff85f5e4a.zip deleted file mode 100644 index 206b1d455d..0000000000 Binary files a/.yarn/cache/solc-npm-0.8.20-6c9aca8747-8ff85f5e4a.zip and /dev/null differ diff --git a/.yarn/cache/solhint-npm-3.3.7-a5123c8b6c-140a4660b6.zip b/.yarn/cache/solhint-npm-3.3.7-a5123c8b6c-140a4660b6.zip deleted file mode 100644 index c871fe817d..0000000000 Binary files a/.yarn/cache/solhint-npm-3.3.7-a5123c8b6c-140a4660b6.zip and /dev/null differ diff --git a/.yarn/cache/solhint-npm-3.6.2-b4d7eceddf-96c2ab3c14.zip b/.yarn/cache/solhint-npm-3.6.2-b4d7eceddf-96c2ab3c14.zip new file mode 100644 index 0000000000..e37a178927 Binary files /dev/null and b/.yarn/cache/solhint-npm-3.6.2-b4d7eceddf-96c2ab3c14.zip differ diff --git a/.yarn/cache/string-argv-npm-0.3.2-6e057a88f1-8703ad3f3d.zip b/.yarn/cache/string-argv-npm-0.3.2-6e057a88f1-8703ad3f3d.zip new file mode 100644 index 0000000000..8c003baeda Binary files /dev/null and b/.yarn/cache/string-argv-npm-0.3.2-6e057a88f1-8703ad3f3d.zip differ diff --git a/.yarn/cache/strip-final-newline-npm-3.0.0-7972cbec8b-23ee263adf.zip b/.yarn/cache/strip-final-newline-npm-3.0.0-7972cbec8b-23ee263adf.zip new file mode 100644 index 0000000000..9cbcced9e8 Binary files /dev/null and b/.yarn/cache/strip-final-newline-npm-3.0.0-7972cbec8b-23ee263adf.zip differ diff --git a/.yarn/cache/table-npm-5.4.6-190b118384-9e35d3efa7.zip b/.yarn/cache/table-npm-5.4.6-190b118384-9e35d3efa7.zip deleted file mode 100644 index 386d1baae9..0000000000 Binary files a/.yarn/cache/table-npm-5.4.6-190b118384-9e35d3efa7.zip and /dev/null differ diff --git a/.yarn/cache/type-fest-npm-1.4.0-7dd848962a-b011c33886.zip b/.yarn/cache/type-fest-npm-1.4.0-7dd848962a-b011c33886.zip new file mode 100644 index 0000000000..9dbe9785ac Binary files /dev/null and b/.yarn/cache/type-fest-npm-1.4.0-7dd848962a-b011c33886.zip differ diff --git a/.yarn/cache/typescript-npm-4.9.3-228c75fdd3-17b8f81605.zip b/.yarn/cache/typescript-npm-4.9.5-6427b65ee6-ee000bc268.zip similarity index 59% rename from .yarn/cache/typescript-npm-4.9.3-228c75fdd3-17b8f81605.zip rename to .yarn/cache/typescript-npm-4.9.5-6427b65ee6-ee000bc268.zip index 3f908f4b5c..5434f6e631 100644 Binary files a/.yarn/cache/typescript-npm-4.9.3-228c75fdd3-17b8f81605.zip and b/.yarn/cache/typescript-npm-4.9.5-6427b65ee6-ee000bc268.zip differ diff --git a/.yarn/cache/typescript-patch-38a6667774-d7bdcf5e18.zip b/.yarn/cache/typescript-patch-f8edcd7439-1f8f3b6aae.zip similarity index 58% rename from .yarn/cache/typescript-patch-38a6667774-d7bdcf5e18.zip rename to .yarn/cache/typescript-patch-f8edcd7439-1f8f3b6aae.zip index 6dc4e649c2..f3332e3fed 100644 Binary files a/.yarn/cache/typescript-patch-38a6667774-d7bdcf5e18.zip and b/.yarn/cache/typescript-patch-f8edcd7439-1f8f3b6aae.zip differ diff --git a/.yarn/cache/write-npm-1.0.3-1bac756049-6496197ceb.zip b/.yarn/cache/write-npm-1.0.3-1bac756049-6496197ceb.zip deleted file mode 100644 index b789c936a2..0000000000 Binary files a/.yarn/cache/write-npm-1.0.3-1bac756049-6496197ceb.zip and /dev/null differ diff --git a/.yarn/cache/yaml-npm-2.3.1-743f5688d1-2c7bc9a7cd.zip b/.yarn/cache/yaml-npm-2.3.1-743f5688d1-2c7bc9a7cd.zip new file mode 100644 index 0000000000..abc6f7ce01 Binary files /dev/null and b/.yarn/cache/yaml-npm-2.3.1-743f5688d1-2c7bc9a7cd.zip differ diff --git a/.yarnrc.yml b/.yarnrc.yml index 083a71ee53..5734849230 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -1,7 +1,5 @@ checksumBehavior: ignore -defaultSemverRangePrefix: "" - nodeLinker: node-modules npmRegistryServer: "https://registry.npmjs.org" diff --git a/README.md b/README.md index 14fc089b4b..7dab045f6b 100644 --- a/README.md +++ b/README.md @@ -75,4 +75,4 @@ To prepare for system upgrades, this repository is used to release new versions - Publish the release with `yarn publish:dev` for the pre-release (no git tag, version looks like `1.2.3-.0`)> and `yarn publish:release` for the proper semver release. - If you aren't using [Frame](https://frame.sh/), prepend `CANNON_REGISTRY_PROVIDER_URL= CANNON_PRIVATE_KEY=` to the commands above. - In case Cannon publish fails you can run `yarn publish-contracts` in the root to retry publishing all Cannon packages. Or run `yarn publish-contracts` in each failed package separately. -- In all of the package.json files, revert dependencies' version changes back to "workspaces:*"` (leaving the change to `gitHead`, if applicable), commit, and push. +- In all the package.json files, revert dependencies' version changes back to `"workspaces:*"` (leaving the change to `gitHead`, if applicable), commit, and push. diff --git a/docs/Contracts.md b/docs/Contracts.md new file mode 100644 index 0000000000..19b050a0b9 --- /dev/null +++ b/docs/Contracts.md @@ -0,0 +1,6951 @@ +# Smart Contracts + +- [Synthetix Core](#synthetix-core) +- [Spot Market](#spot-market) +- [Perps Market](#perps-market) +- [Governance](#governance) +- [Oracle Manager](#oracle-manager) + +## Synthetix Core + +### Account Module + +#### getAccountPermissions + +```solidity +function getAccountPermissions(uint128 accountId) external view returns (struct IAccountModule.AccountPermissions[] accountPerms) +``` + +Returns an array of `AccountPermission` for the provided `accountId`. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account whose permissions are being retrieved. + +**Returns** + +- `accountPerms` (_struct IAccountModule.AccountPermissions[]_) - An array of AccountPermission objects describing the permissions granted to the account. + +#### createAccount + +```solidity +function createAccount(uint128 requestedAccountId) external +``` + +Mints an account token with id `requestedAccountId` to `msg.sender`. + +**Parameters** + +- `requestedAccountId` (_uint128_) - The id requested for the account being created. Reverts if id already exists. Requirements: - `requestedAccountId` must not already be minted. - `requestedAccountId` must be less than type(uint128).max / 2 Emits a {AccountCreated} event. + +#### createAccount + +```solidity +function createAccount() external returns (uint128 accountId) +``` + +Mints an account token with an available id to `msg.sender`. + +Emits a {AccountCreated} event. + +#### notifyAccountTransfer + +```solidity +function notifyAccountTransfer(address to, uint128 accountId) external +``` + +Called by AccountTokenModule to notify the system when the account token is transferred. + +Resets user permissions and assigns ownership of the account token to the new holder. + +**Parameters** + +- `to` (_address_) - The new holder of the account NFT. +- `accountId` (_uint128_) - The id of the account that was just transferred. Requirements: - `msg.sender` must be the account token. + +#### grantPermission + +```solidity +function grantPermission(uint128 accountId, bytes32 permission, address user) external +``` + +Grants `permission` to `user` for account `accountId`. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account that granted the permission. +- `permission` (_bytes32_) - The bytes32 identifier of the permission. +- `user` (_address_) - The target address that received the permission. Requirements: - `msg.sender` must own the account token with ID `accountId` or have the "admin" permission. Emits a {PermissionGranted} event. + +#### revokePermission + +```solidity +function revokePermission(uint128 accountId, bytes32 permission, address user) external +``` + +Revokes `permission` from `user` for account `accountId`. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account that revoked the permission. +- `permission` (_bytes32_) - The bytes32 identifier of the permission. +- `user` (_address_) - The target address that no longer has the permission. Requirements: - `msg.sender` must own the account token with ID `accountId` or have the "admin" permission. Emits a {PermissionRevoked} event. + +#### renouncePermission + +```solidity +function renouncePermission(uint128 accountId, bytes32 permission) external +``` + +Revokes `permission` from `msg.sender` for account `accountId`. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account whose permission was renounced. +- `permission` (_bytes32_) - The bytes32 identifier of the permission. Emits a {PermissionRevoked} event. + +#### hasPermission + +```solidity +function hasPermission(uint128 accountId, bytes32 permission, address user) external view returns (bool hasPermission) +``` + +Returns `true` if `user` has been granted `permission` for account `accountId`. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account whose permission is being queried. +- `permission` (_bytes32_) - The bytes32 identifier of the permission. +- `user` (_address_) - The target address whose permission is being queried. + +**Returns** + +- `hasPermission` (_bool_) - A boolean with the response of the query. + +#### isAuthorized + +```solidity +function isAuthorized(uint128 accountId, bytes32 permission, address target) external view returns (bool isAuthorized) +``` + +Returns `true` if `target` is authorized to `permission` for account `accountId`. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account whose permission is being queried. +- `permission` (_bytes32_) - The bytes32 identifier of the permission. +- `target` (_address_) - The target address whose permission is being queried. + +**Returns** + +- `isAuthorized` (_bool_) - A boolean with the response of the query. + +#### getAccountTokenAddress + +```solidity +function getAccountTokenAddress() external view returns (address accountNftToken) +``` + +Returns the address for the account token used by the module. + +**Returns** + +- `accountNftToken` (_address_) - The address of the account token. + +#### getAccountOwner + +```solidity +function getAccountOwner(uint128 accountId) external view returns (address owner) +``` + +Returns the address that owns a given account, as recorded by the system. + +**Parameters** + +- `accountId` (_uint128_) - The account id whose owner is being retrieved. + +**Returns** + +- `owner` (_address_) - The owner of the given account id. + +#### getAccountLastInteraction + +```solidity +function getAccountLastInteraction(uint128 accountId) external view returns (uint256 timestamp) +``` + +Returns the last unix timestamp that a permissioned action was taken with this account + +**Parameters** + +- `accountId` (_uint128_) - The account id to check + +**Returns** + +- `timestamp` (_uint256_) - The unix timestamp of the last time a permissioned action occured with the account + +#### AccountCreated + +```solidity +event AccountCreated(uint128 accountId, address owner) +``` + +Emitted when an account token with id `accountId` is minted to `sender`. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account. +- `owner` (_address_) - The address that owns the created account. + +#### PermissionGranted + +```solidity +event PermissionGranted(uint128 accountId, bytes32 permission, address user, address sender) +``` + +Emitted when `user` is granted `permission` by `sender` for account `accountId`. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account that granted the permission. +- `permission` (_bytes32_) - The bytes32 identifier of the permission. +- `user` (_address_) - The target address to whom the permission was granted. +- `sender` (_address_) - The Address that granted the permission. + +#### PermissionRevoked + +```solidity +event PermissionRevoked(uint128 accountId, bytes32 permission, address user, address sender) +``` + +Emitted when `user` has `permission` renounced or revoked by `sender` for account `accountId`. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account that has had the permission revoked. +- `permission` (_bytes32_) - The bytes32 identifier of the permission. +- `user` (_address_) - The target address for which the permission was revoked. +- `sender` (_address_) - The address that revoked the permission. + +### Account Token Module + +#### isInitialized + +```solidity +function isInitialized() external returns (bool) +``` + +Returns whether the token has been initialized. + +**Returns** + +- `[0]` (_bool_) - A boolean with the result of the query. + +#### initialize + +```solidity +function initialize(string tokenName, string tokenSymbol, string uri) external +``` + +Initializes the token with name, symbol, and uri. + +#### mint + +```solidity +function mint(address to, uint256 tokenId) external +``` + +Allows the owner to mint tokens. + +**Parameters** + +- `to` (_address_) - The address to receive the newly minted tokens. +- `tokenId` (_uint256_) - The ID of the newly minted token + +#### safeMint + +```solidity +function safeMint(address to, uint256 tokenId, bytes data) external +``` + +Allows the owner to mint tokens. Verifies that the receiver can receive the token + +**Parameters** + +- `to` (_address_) - The address to receive the newly minted token. +- `tokenId` (_uint256_) - The ID of the newly minted token +- `data` (_bytes_) - any data which should be sent to the receiver + +#### burn + +```solidity +function burn(uint256 tokenId) external +``` + +Allows the owner to burn tokens. + +**Parameters** + +- `tokenId` (_uint256_) - The token to burn + +#### setAllowance + +```solidity +function setAllowance(uint256 tokenId, address spender) external +``` + +Allows an address that holds tokens to provide allowance to another. + +**Parameters** + +- `tokenId` (_uint256_) - The token which should be allowed to spender +- `spender` (_address_) - The address that is given allowance. + +#### setBaseTokenURI + +```solidity +function setBaseTokenURI(string uri) external +``` + +Allows the owner to update the base token URI. + +**Parameters** + +- `uri` (_string_) - The new base token uri + +#### totalSupply + +```solidity +function totalSupply() external view returns (uint256) +``` + +Returns the total amount of tokens stored by the contract. + +#### tokenOfOwnerByIndex + +```solidity +function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256) +``` + +Returns a token ID owned by `owner` at a given `index` of its token list. +Use along with {balanceOf} to enumerate all of `owner`'s tokens. + +Requirements: + +- `owner` must be a valid address +- `index` must be less than the balance of the tokens for the owner + +#### tokenByIndex + +```solidity +function tokenByIndex(uint256 index) external view returns (uint256) +``` + +Returns a token ID at a given `index` of all the tokens stored by the contract. +Use along with {totalSupply} to enumerate all tokens. + +Requirements: + +- `index` must be less than the total supply of the tokens + +#### balanceOf + +```solidity +function balanceOf(address holder) external view returns (uint256 balance) +``` + +Returns the number of tokens in `owner`'s account. + +Requirements: + +- `holder` must be a valid address + +#### ownerOf + +```solidity +function ownerOf(uint256 tokenId) external view returns (address owner) +``` + +Returns the owner of the `tokenId` token. + +Requirements: + +- `tokenId` must exist. + +#### safeTransferFrom + +```solidity +function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) external +``` + +Safely transfers `tokenId` token from `from` to `to`. + +Requirements: + +- `from` cannot be the zero address. +- `to` cannot be the zero address. +- `tokenId` token must exist and be owned by `from`. +- If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. +- If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. + +Emits a {Transfer} event. + +#### safeTransferFrom + +```solidity +function safeTransferFrom(address from, address to, uint256 tokenId) external +``` + +Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients +are aware of the ERC721 protocol to prevent tokens from being forever locked. + +Requirements: + +- `from` cannot be the zero address. +- `to` cannot be the zero address. +- `tokenId` token must exist and be owned by `from`. +- If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. +- If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. + +Emits a {Transfer} event. + +#### transferFrom + +```solidity +function transferFrom(address from, address to, uint256 tokenId) external +``` + +Transfers `tokenId` token from `from` to `to`. + +WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. + +Requirements: + +- `from` cannot be the zero address. +- `to` cannot be the zero address. +- `tokenId` token must be owned by `from`. +- If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. + +Emits a {Transfer} event. + +#### approve + +```solidity +function approve(address to, uint256 tokenId) external +``` + +Gives permission to `to` to transfer `tokenId` token to another account. +The approval is cleared when the token is transferred. + +Only a single account can be approved at a time, so approving the zero address clears previous approvals. + +Requirements: + +- The caller must own the token or be an approved operator. +- `tokenId` must exist. + +Emits an {Approval} event. + +#### setApprovalForAll + +```solidity +function setApprovalForAll(address operator, bool approved) external +``` + +Approve or remove `operator` as an operator for the caller. +Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. + +Requirements: + +- The `operator` cannot be the caller. + +Emits an {ApprovalForAll} event. + +#### getApproved + +```solidity +function getApproved(uint256 tokenId) external view returns (address operator) +``` + +Returns the account approved for `tokenId` token. + +Requirements: + +- `tokenId` must exist. + +#### isApprovedForAll + +```solidity +function isApprovedForAll(address owner, address operator) external view returns (bool) +``` + +Returns if the `operator` is allowed to manage all of the assets of `owner`. + +See {setApprovalForAll} + +#### Transfer + +```solidity +event Transfer(address from, address to, uint256 tokenId) +``` + +Emitted when `tokenId` token is transferred from `from` to `to`. + +#### Approval + +```solidity +event Approval(address owner, address approved, uint256 tokenId) +``` + +Emitted when `owner` enables `approved` to manage the `tokenId` token. + +#### ApprovalForAll + +```solidity +event ApprovalForAll(address owner, address operator, bool approved) +``` + +Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. + +### Associate Debt Module + +#### associateDebt + +```solidity +function associateDebt(uint128 marketId, uint128 poolId, address collateralType, uint128 accountId, uint256 amount) external returns (int256 debtAmount) +``` + +Allows a market to associate debt with a specific position. +The specified debt will be removed from all vault participants pro-rata. After removing the debt, the amount will +be allocated directly to the specified account. +**NOTE**: if the specified account is an existing staker on the vault, their position will be included in the pro-rata +reduction. Ex: if there are 10 users staking 10 USD of debt on a pool, and associate debt is called with 10 USD on one of those users, +their debt after the operation is complete will be 19 USD. This might seem unusual, but its actually ideal behavior when +your market has incurred some new debt, and it wants to allocate this amount directly to a specific user. In this case, the user's +debt balance would increase pro rata, but then get decreased pro-rata, and then increased to the full amount on their account. All +other accounts would be left with no change to their debt, however. + +**Parameters** + +- `marketId` (_uint128_) - The id of the market to which debt was associated. +- `poolId` (_uint128_) - The id of the pool associated to the target market. +- `collateralType` (_address_) - The address of the collateral type that acts as collateral in the corresponding pool. +- `accountId` (_uint128_) - The id of the account whose debt is being associated. +- `amount` (_uint256_) - The amount of debt being associated with the specified account, denominated with 18 decimals of precision. + +**Returns** + +- `debtAmount` (_int256_) - The updated debt of the position, denominated with 18 decimals of precision. + +#### DebtAssociated + +```solidity +event DebtAssociated(uint128 marketId, uint128 poolId, address collateralType, uint128 accountId, uint256 amount, int256 updatedDebt) +``` + +Emitted when `associateDebt` is called. + +**Parameters** + +- `marketId` (_uint128_) - The id of the market to which debt was associated. +- `poolId` (_uint128_) - The id of the pool associated to the target market. +- `collateralType` (_address_) - The address of the collateral type that acts as collateral in the corresponding pool. +- `accountId` (_uint128_) - The id of the account whose debt is being associated. +- `amount` (_uint256_) - The amount of debt being associated with the specified account, denominated with 18 decimals of precision. +- `updatedDebt` (_int256_) - The total updated debt of the account, denominated with 18 decimals of precision + +### Collateral Configuration Module + +#### configureCollateral + +```solidity +function configureCollateral(struct CollateralConfiguration.Data config) external +``` + +Creates or updates the configuration for the given `collateralType`. + +**Parameters** + +- `config` (_struct CollateralConfiguration.Data_) - The CollateralConfiguration object describing the new configuration. Requirements: - `msg.sender` must be the owner of the system. Emits a {CollateralConfigured} event. + +#### getCollateralConfigurations + +```solidity +function getCollateralConfigurations(bool hideDisabled) external view returns (struct CollateralConfiguration.Data[] collaterals) +``` + +Returns a list of detailed information pertaining to all collateral types registered in the system. + +Optionally returns only those that are currently enabled. + +**Parameters** + +- `hideDisabled` (_bool_) - Wether to hide disabled collaterals or just return the full list of collaterals in the system. + +**Returns** + +- `collaterals` (_struct CollateralConfiguration.Data[]_) - The list of collateral configuration objects set in the system. + +#### getCollateralConfiguration + +```solidity +function getCollateralConfiguration(address collateralType) external view returns (struct CollateralConfiguration.Data collateral) +``` + +Returns detailed information pertaining the specified collateral type. + +**Parameters** + +- `collateralType` (_address_) - The address for the collateral whose configuration is being queried. + +**Returns** + +- `collateral` (_struct CollateralConfiguration.Data_) - The configuration object describing the given collateral. + +#### getCollateralPrice + +```solidity +function getCollateralPrice(address collateralType) external view returns (uint256 priceD18) +``` + +Returns the current value of a specified collateral type. + +**Parameters** + +- `collateralType` (_address_) - The address for the collateral whose price is being queried. + +**Returns** + +- `priceD18` (_uint256_) - The price of the given collateral, denominated with 18 decimals of precision. + +#### CollateralConfigured + +```solidity +event CollateralConfigured(address collateralType, struct CollateralConfiguration.Data config) +``` + +Emitted when a collateral type’s configuration is created or updated. + +**Parameters** + +- `collateralType` (_address_) - The address of the collateral type that was just configured. +- `config` (_struct CollateralConfiguration.Data_) - The object with the newly configured details. + +### Collateral Module + +#### deposit + +```solidity +function deposit(uint128 accountId, address collateralType, uint256 tokenAmount) external +``` + +Deposits `tokenAmount` of collateral of type `collateralType` into account `accountId`. + +Anyone can deposit into anyone's active account without restriction. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account that is making the deposit. +- `collateralType` (_address_) - The address of the token to be deposited. +- `tokenAmount` (_uint256_) - The amount being deposited, denominated in the token's native decimal representation. Emits a {Deposited} event. + +#### withdraw + +```solidity +function withdraw(uint128 accountId, address collateralType, uint256 tokenAmount) external +``` + +Withdraws `tokenAmount` of collateral of type `collateralType` from account `accountId`. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account that is making the withdrawal. +- `collateralType` (_address_) - The address of the token to be withdrawn. +- `tokenAmount` (_uint256_) - The amount being withdrawn, denominated in the token's native decimal representation. Requirements: - `msg.sender` must be the owner of the account, have the `ADMIN` permission, or have the `WITHDRAW` permission. Emits a {Withdrawn} event. + +#### getAccountCollateral + +```solidity +function getAccountCollateral(uint128 accountId, address collateralType) external view returns (uint256 totalDeposited, uint256 totalAssigned, uint256 totalLocked) +``` + +Returns the total values pertaining to account `accountId` for `collateralType`. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account whose collateral is being queried. +- `collateralType` (_address_) - The address of the collateral type whose amount is being queried. + +**Returns** + +- `totalDeposited` (_uint256_) - The total collateral deposited in the account, denominated with 18 decimals of precision. +- `totalAssigned` (_uint256_) - The amount of collateral in the account that is delegated to pools, denominated with 18 decimals of precision. +- `totalLocked` (_uint256_) - The amount of collateral in the account that cannot currently be undelegated from a pool, denominated with 18 decimals of precision. + +#### getAccountAvailableCollateral + +```solidity +function getAccountAvailableCollateral(uint128 accountId, address collateralType) external view returns (uint256 amountD18) +``` + +Returns the amount of collateral of type `collateralType` deposited with account `accountId` that can be withdrawn or delegated to pools. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account whose collateral is being queried. +- `collateralType` (_address_) - The address of the collateral type whose amount is being queried. + +**Returns** + +- `amountD18` (_uint256_) - The amount of collateral that is available for withdrawal or delegation, denominated with 18 decimals of precision. + +#### cleanExpiredLocks + +```solidity +function cleanExpiredLocks(uint128 accountId, address collateralType, uint256 offset, uint256 count) external returns (uint256 cleared) +``` + +Clean expired locks from locked collateral arrays for an account/collateral type. It includes offset and items to prevent gas exhaustion. If both, offset and items, are 0 it will traverse the whole array (unlimited). + +**Parameters** + +- `accountId` (_uint128_) - The id of the account whose locks are being cleared. +- `collateralType` (_address_) - The address of the collateral type to clean locks for. +- `offset` (_uint256_) - The index of the first lock to clear. +- `count` (_uint256_) - The number of slots to check for cleaning locks. Set to 0 to clean all locks at/after offset + +**Returns** + +- `cleared` (_uint256_) - the number of locks that were actually expired (and therefore cleared) + +#### getLocks + +```solidity +function getLocks(uint128 accountId, address collateralType, uint256 offset, uint256 count) external view returns (struct CollateralLock.Data[] locks) +``` + +Get a list of locks existing in account. Lists all locks in storage, even if they are expired + +**Parameters** + +- `accountId` (_uint128_) - The id of the account whose locks we want to read +- `collateralType` (_address_) - The address of the collateral type for locks we want to read +- `offset` (_uint256_) - The index of the first lock to read +- `count` (_uint256_) - The number of slots to check for cleaning locks. Set to 0 to read all locks after offset + +#### createLock + +```solidity +function createLock(uint128 accountId, address collateralType, uint256 amount, uint64 expireTimestamp) external +``` + +Create a new lock on the given account. you must have `admin` permission on the specified account to create a lock. + +Collateral can be withdrawn from the system if it is not assigned or delegated to a pool. Collateral locks are an additional restriction that applies on top of that. I.e. if collateral is not assigned to a pool, but has a lock, it cannot be withdrawn. +Collateral locks are initially intended for the Synthetix v2 to v3 migration, but may be used in the future by the Spartan Council, for example, to create and hand off accounts whose withdrawals from the system are locked for a given amount of time. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account for which a lock is to be created. +- `collateralType` (_address_) - The address of the collateral type for which the lock will be created. +- `amount` (_uint256_) - The amount of collateral tokens to wrap in the lock being created, denominated with 18 decimals of precision. +- `expireTimestamp` (_uint64_) - The date in which the lock will become clearable. + +#### Deposited + +```solidity +event Deposited(uint128 accountId, address collateralType, uint256 tokenAmount, address sender) +``` + +Emitted when `tokenAmount` of collateral of type `collateralType` is deposited to account `accountId` by `sender`. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account that deposited collateral. +- `collateralType` (_address_) - The address of the collateral that was deposited. +- `tokenAmount` (_uint256_) - The amount of collateral that was deposited, denominated in the token's native decimal representation. +- `sender` (_address_) - The address of the account that triggered the deposit. + +#### CollateralLockCreated + +```solidity +event CollateralLockCreated(uint128 accountId, address collateralType, uint256 tokenAmount, uint64 expireTimestamp) +``` + +Emitted when a lock is created on someone's account + +**Parameters** + +- `accountId` (_uint128_) - The id of the account that received a lock +- `collateralType` (_address_) - The address of the collateral type that was locked +- `tokenAmount` (_uint256_) - The amount of collateral that was locked, demoninated in system units (1e18) +- `expireTimestamp` (_uint64_) - unix timestamp at which the lock is due to expire + +#### CollateralLockExpired + +```solidity +event CollateralLockExpired(uint128 accountId, address collateralType, uint256 tokenAmount, uint64 expireTimestamp) +``` + +Emitted when a lock is cleared from an account due to expiration + +**Parameters** + +- `accountId` (_uint128_) - The id of the account that has the expired lock +- `collateralType` (_address_) - The address of the collateral type that was unlocked +- `tokenAmount` (_uint256_) - The amount of collateral that was unlocked, demoninated in system units (1e18) +- `expireTimestamp` (_uint64_) - unix timestamp at which the unlock is due to expire + +#### Withdrawn + +```solidity +event Withdrawn(uint128 accountId, address collateralType, uint256 tokenAmount, address sender) +``` + +Emitted when `tokenAmount` of collateral of type `collateralType` is withdrawn from account `accountId` by `sender`. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account that withdrew collateral. +- `collateralType` (_address_) - The address of the collateral that was withdrawn. +- `tokenAmount` (_uint256_) - The amount of collateral that was withdrawn, denominated in the token's native decimal representation. +- `sender` (_address_) - The address of the account that triggered the withdrawal. + +## Cross ChainUSD Module + +### transferCrossChain + +```solidity +function transferCrossChain(uint64 destChainId, uint256 amount) external payable returns (uint256 gasTokenUsed) +``` + +Allows users to transfer tokens cross-chain using CCIP. + +**Parameters** + +- `destChainId` (_uint64_) - The id of the chain where tokens are to be transferred to. +- `amount` (_uint256_) - The amount of tokens to be transferred, denominated with 18 decimals of precision. + +**Returns** + +- `gasTokenUsed` (_uint256_) - The amount of fees paid in the cross-chain transfer, denominated with 18 decimals of precision. + +### TransferCrossChainInitiated + +```solidity +event TransferCrossChainInitiated(uint64 destChainId, uint256 amount, address sender) +``` + +## IssueUSD Module + +#### transferCrossChain + +```solidity +function transferCrossChain(uint64 destChainId, uint256 amount) external payable returns (uint256 gasTokenUsed) +``` + +Allows users to transfer tokens cross-chain using CCIP. + +**Parameters** + +- `destChainId` (_uint64_) - The id of the chain where tokens are to be transferred to. +- `amount` (_uint256_) - The amount of tokens to be transferred, denominated with 18 decimals of precision. + +**Returns** + +- `gasTokenUsed` (_uint256_) - The amount of fees paid in the cross-chain transfer, denominated with 18 decimals of precision. + +#### TransferCrossChainInitiated + +```solidity +event TransferCrossChainInitiated(uint64 destChainId, uint256 amount, address sender) +``` + +### IssueUSD Module + +#### mintUsd + +```solidity +function mintUsd(uint128 accountId, uint128 poolId, address collateralType, uint256 amount) external +``` + +Mints {amount} of snxUSD with the specified liquidity position. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account that is minting snxUSD. +- `poolId` (_uint128_) - The id of the pool whose collateral will be used to back up the mint. +- `collateralType` (_address_) - The address of the collateral that will be used to back up the mint. +- `amount` (_uint256_) - The amount of snxUSD to be minted, denominated with 18 decimals of precision. Requirements: - `msg.sender` must be the owner of the account, have the `ADMIN` permission, or have the `MINT` permission. - After minting, the collateralization ratio of the liquidity position must not be below the target collateralization ratio for the corresponding collateral type. Emits a {UsdMinted} event. + +#### burnUsd + +```solidity +function burnUsd(uint128 accountId, uint128 poolId, address collateralType, uint256 amount) external +``` + +Burns {amount} of snxUSD with the specified liquidity position. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account that is burning snxUSD. +- `poolId` (_uint128_) - The id of the pool whose collateral was used to back up the snxUSD. +- `collateralType` (_address_) - The address of the collateral that was used to back up the snxUSD. +- `amount` (_uint256_) - The amount of snxUSD to be burnt, denominated with 18 decimals of precision. Emits a {UsdMinted} event. + +#### UsdMinted + +```solidity +event UsdMinted(uint128 accountId, uint128 poolId, address collateralType, uint256 amount, address sender) +``` + +Emitted when {sender} mints {amount} of snxUSD with the specified liquidity position. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account for which snxUSD was emitted. +- `poolId` (_uint128_) - The id of the pool whose collateral was used to emit the snxUSD. +- `collateralType` (_address_) - The address of the collateral that is backing up the emitted snxUSD. +- `amount` (_uint256_) - The amount of snxUSD emitted, denominated with 18 decimals of precision. +- `sender` (_address_) - The address that triggered the operation. + +#### UsdBurned + +```solidity +event UsdBurned(uint128 accountId, uint128 poolId, address collateralType, uint256 amount, address sender) +``` + +Emitted when {sender} burns {amount} of snxUSD with the specified liquidity position. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account for which snxUSD was burned. +- `poolId` (_uint128_) - The id of the pool whose collateral was used to emit the snxUSD. +- `collateralType` (_address_) - The address of the collateral that was backing up the emitted snxUSD. +- `amount` (_uint256_) - The amount of snxUSD burned, denominated with 18 decimals of precision. +- `sender` (_address_) - The address that triggered the operation. + +#### IssuanceFeePaid + +```solidity +event IssuanceFeePaid(uint128 accountId, uint128 poolId, address collateralType, uint256 feeAmount) +``` + +### Liquidation Module + +#### liquidate + +```solidity +function liquidate(uint128 accountId, uint128 poolId, address collateralType, uint128 liquidateAsAccountId) external returns (struct ILiquidationModule.LiquidationData liquidationData) +``` + +Liquidates a position by distributing its debt and collateral among other positions in its vault. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account whose position is to be liquidated. +- `poolId` (_uint128_) - The id of the pool which holds the position that is to be liquidated. +- `collateralType` (_address_) - The address of the collateral being used in the position that is to be liquidated. +- `liquidateAsAccountId` (_uint128_) - Account id that will receive the rewards from the liquidation. + +**Returns** + +- `liquidationData` (_struct ILiquidationModule.LiquidationData_) - Information about the position that was liquidated. + +#### liquidateVault + +```solidity +function liquidateVault(uint128 poolId, address collateralType, uint128 liquidateAsAccountId, uint256 maxUsd) external returns (struct ILiquidationModule.LiquidationData liquidationData) +``` + +Liquidates an entire vault. + +Can only be done if the vault itself is under collateralized. +LiquidateAsAccountId determines which account to deposit the seized collateral into (this is necessary particularly if the collateral in the vault is vesting). +Will only liquidate a portion of the debt for the vault if `maxUsd` is supplied. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool whose vault is being liquidated. +- `collateralType` (_address_) - The address of the collateral whose vault is being liquidated. +- `liquidateAsAccountId` (_uint128_) - +- `maxUsd` (_uint256_) - The maximum amount of USD that the liquidator is willing to provide for the liquidation, denominated with 18 decimals of precision. + +**Returns** + +- `liquidationData` (_struct ILiquidationModule.LiquidationData_) - Information about the vault that was liquidated. + +#### isPositionLiquidatable + +```solidity +function isPositionLiquidatable(uint128 accountId, uint128 poolId, address collateralType) external returns (bool canLiquidate) +``` + +Determines whether a specified position is liquidatable. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account whose position is being queried for liquidation. +- `poolId` (_uint128_) - The id of the pool whose position is being queried for liquidation. +- `collateralType` (_address_) - The address of the collateral backing up the position being queried for liquidation. + +**Returns** + +- `canLiquidate` (_bool_) - A boolean with the response to the query. + +#### isVaultLiquidatable + +```solidity +function isVaultLiquidatable(uint128 poolId, address collateralType) external returns (bool canVaultLiquidate) +``` + +Determines whether a specified vault is liquidatable. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool that owns the vault that is being queried for liquidation. +- `collateralType` (_address_) - The address of the collateral being held at the vault that is being queried for liquidation. + +**Returns** + +- `canVaultLiquidate` (_bool_) - A boolean with the response to the query. + +#### Liquidation + +```solidity +event Liquidation(uint128 accountId, uint128 poolId, address collateralType, struct ILiquidationModule.LiquidationData liquidationData, uint128 liquidateAsAccountId, address sender) +``` + +Emitted when an account is liquidated. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account that was liquidated. +- `poolId` (_uint128_) - The pool id of the position that was liquidated. +- `collateralType` (_address_) - The collateral type used in the position that was liquidated. +- `liquidationData` (_struct ILiquidationModule.LiquidationData_) - The amount of collateral liquidated, debt liquidated, and collateral awarded to the liquidator. +- `liquidateAsAccountId` (_uint128_) - Account id that will receive the rewards from the liquidation. +- `sender` (_address_) - The address of the account that is triggering the liquidation. + +#### VaultLiquidation + +```solidity +event VaultLiquidation(uint128 poolId, address collateralType, struct ILiquidationModule.LiquidationData liquidationData, uint128 liquidateAsAccountId, address sender) +``` + +Emitted when a vault is liquidated. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool whose vault was liquidated. +- `collateralType` (_address_) - The collateral address of the vault that was liquidated. +- `liquidationData` (_struct ILiquidationModule.LiquidationData_) - The amount of collateral liquidated, debt liquidated, and collateral awarded to the liquidator. +- `liquidateAsAccountId` (_uint128_) - Account id that will receive the rewards from the liquidation. +- `sender` (_address_) - The address of the account that is triggering the liquidation. + +### Market Collateral Module + +#### depositMarketCollateral + +```solidity +function depositMarketCollateral(uint128 marketId, address collateralType, uint256 amount) external +``` + +Allows a market to deposit collateral. + +**Parameters** + +- `marketId` (_uint128_) - The id of the market in which the collateral was directly deposited. +- `collateralType` (_address_) - The address of the collateral that was deposited in the market. +- `amount` (_uint256_) - The amount of collateral that was deposited, denominated in the token's native decimal representation. + +#### withdrawMarketCollateral + +```solidity +function withdrawMarketCollateral(uint128 marketId, address collateralType, uint256 amount) external +``` + +Allows a market to withdraw collateral that it has previously deposited. + +**Parameters** + +- `marketId` (_uint128_) - The id of the market from which the collateral was withdrawn. +- `collateralType` (_address_) - The address of the collateral that was withdrawn from the market. +- `amount` (_uint256_) - The amount of collateral that was withdrawn, denominated in the token's native decimal representation. + +#### configureMaximumMarketCollateral + +```solidity +function configureMaximumMarketCollateral(uint128 marketId, address collateralType, uint256 amount) external +``` + +Allow the system owner to configure the maximum amount of a given collateral type that a specified market is allowed to deposit. + +**Parameters** + +- `marketId` (_uint128_) - The id of the market for which the maximum is to be configured. +- `collateralType` (_address_) - The address of the collateral for which the maximum is to be applied. +- `amount` (_uint256_) - The amount that is to be set as the new maximum, denominated with 18 decimals of precision. + +#### getMaximumMarketCollateral + +```solidity +function getMaximumMarketCollateral(uint128 marketId, address collateralType) external returns (uint256 amountD18) +``` + +Return the total maximum amount of a given collateral type that a specified market is allowed to deposit. + +**Parameters** + +- `marketId` (_uint128_) - The id of the market for which the maximum is being queried. +- `collateralType` (_address_) - The address of the collateral for which the maximum is being queried. + +**Returns** + +- `amountD18` (_uint256_) - The maximum amount of collateral set for the market, denominated with 18 decimals of precision. + +#### getMarketCollateralAmount + +```solidity +function getMarketCollateralAmount(uint128 marketId, address collateralType) external view returns (uint256 amountD18) +``` + +Return the total amount of a given collateral type that a specified market has deposited. + +**Parameters** + +- `marketId` (_uint128_) - The id of the market for which the directly deposited collateral amount is being queried. +- `collateralType` (_address_) - The address of the collateral for which the amount is being queried. + +**Returns** + +- `amountD18` (_uint256_) - The total amount of collateral of this type delegated to the market, denominated with 18 decimals of precision. + +#### getMarketCollateralValue + +```solidity +function getMarketCollateralValue(uint128 marketId) external returns (uint256 valueD18) +``` + +Return the total value of collateral that a specified market has deposited. + +**Parameters** + +- `marketId` (_uint128_) - The id of the market for which the directly deposited collateral amount is being queried. + +**Returns** + +- `valueD18` (_uint256_) - The total value of collateral deposited by the market, denominated with 18 decimals of precision. + +#### MarketCollateralDeposited + +```solidity +event MarketCollateralDeposited(uint128 marketId, address collateralType, uint256 tokenAmount, address sender) +``` + +Emitted when `amount` of collateral of type `collateralType` is deposited to market `marketId` by `sender`. + +**Parameters** + +- `marketId` (_uint128_) - The id of the market in which collateral was deposited. +- `collateralType` (_address_) - The address of the collateral that was directly deposited in the market. +- `tokenAmount` (_uint256_) - The amount of tokens that were deposited, denominated in the token's native decimal representation. +- `sender` (_address_) - The address that triggered the deposit. + +#### MarketCollateralWithdrawn + +```solidity +event MarketCollateralWithdrawn(uint128 marketId, address collateralType, uint256 tokenAmount, address sender) +``` + +Emitted when `amount` of collateral of type `collateralType` is withdrawn from market `marketId` by `sender`. + +**Parameters** + +- `marketId` (_uint128_) - The id of the market from which collateral was withdrawn. +- `collateralType` (_address_) - The address of the collateral that was withdrawn from the market. +- `tokenAmount` (_uint256_) - The amount of tokens that were withdrawn, denominated in the token's native decimal representation. +- `sender` (_address_) - The address that triggered the withdrawal. + +#### MaximumMarketCollateralConfigured + +```solidity +event MaximumMarketCollateralConfigured(uint128 marketId, address collateralType, uint256 systemAmount, address owner) +``` + +Emitted when the system owner specifies the maximum depositable collateral of a given type in a given market. + +**Parameters** + +- `marketId` (_uint128_) - The id of the market for which the maximum was configured. +- `collateralType` (_address_) - The address of the collateral for which the maximum was configured. +- `systemAmount` (_uint256_) - The amount to which the maximum was set, denominated with 18 decimals of precision. +- `owner` (_address_) - The owner of the system, which triggered the configuration change. + +### Market Manager Module + +#### registerMarket + +```solidity +function registerMarket(address market) external returns (uint128 newMarketId) +``` + +Connects an external market to the system. + +Creates a Market object to track the external market, and returns the newly created market id. + +**Parameters** + +- `market` (_address_) - The address of the external market that is to be registered in the system. + +**Returns** + +- `newMarketId` (_uint128_) - The id with which the market will be registered in the system. + +#### depositMarketUsd + +```solidity +function depositMarketUsd(uint128 marketId, address target, uint256 amount) external returns (uint256 feeAmount) +``` + +Allows an external market connected to the system to deposit USD in the system. + +The system burns the incoming USD, increases the market's credit capacity, and reduces its issuance. +See `IMarket`. + +**Parameters** + +- `marketId` (_uint128_) - The id of the market in which snxUSD will be deposited. +- `target` (_address_) - The address of the account on who's behalf the deposit will be made. +- `amount` (_uint256_) - The amount of snxUSD to be deposited, denominated with 18 decimals of precision. + +**Returns** + +- `feeAmount` (_uint256_) - the amount of fees paid (billed as additional debt towards liquidity providers) + +#### withdrawMarketUsd + +```solidity +function withdrawMarketUsd(uint128 marketId, address target, uint256 amount) external returns (uint256 feeAmount) +``` + +Allows an external market connected to the system to withdraw snxUSD from the system. + +The system mints the requested snxUSD (provided that the market has sufficient credit), reduces the market's credit capacity, and increases its net issuance. +See `IMarket`. + +**Parameters** + +- `marketId` (_uint128_) - The id of the market from which snxUSD will be withdrawn. +- `target` (_address_) - The address of the account that will receive the withdrawn snxUSD. +- `amount` (_uint256_) - The amount of snxUSD to be withdraw, denominated with 18 decimals of precision. + +**Returns** + +- `feeAmount` (_uint256_) - the amount of fees paid (billed as additional debt towards liquidity providers) + +#### getMarketFees + +```solidity +function getMarketFees(uint128 marketId, uint256 amount) external view returns (uint256 depositFeeAmount, uint256 withdrawFeeAmount) +``` + +Get the amount of fees paid in USD for a call to `depositMarketUsd` and `withdrawMarketUsd` for the given market and amount + +**Parameters** + +- `marketId` (_uint128_) - The market to check fees for +- `amount` (_uint256_) - The amount deposited or withdrawn in USD + +**Returns** + +- `depositFeeAmount` (_uint256_) - the amount of USD paid for a call to `depositMarketUsd` +- `withdrawFeeAmount` (_uint256_) - the amount of USD paid for a call to `withdrawMarketUsd` + +#### getWithdrawableMarketUsd + +```solidity +function getWithdrawableMarketUsd(uint128 marketId) external view returns (uint256 withdrawableD18) +``` + +Returns the total withdrawable snxUSD amount for the specified market. + +**Parameters** + +- `marketId` (_uint128_) - The id of the market whose withdrawable USD amount is being queried. + +**Returns** + +- `withdrawableD18` (_uint256_) - The total amount of snxUSD that the market could withdraw at the time of the query, denominated with 18 decimals of precision. + +### getMarketAddress + +```solidity +function getMarketAddress(uint128 marketId) external view returns (address marketAddress) +``` + +Returns the contract address for the specified market. + +**Parameters** + +- `marketId` (_uint128_) - The id of the market + +**Returns** + +- `marketAddress` (_address_) - The contract address for the specified market + +### getMarketNetIssuance + +```solidity +function getMarketNetIssuance(uint128 marketId) external view returns (int128 issuanceD18) +``` + +Returns the net issuance of the specified market (snxUSD withdrawn - snxUSD deposited). + +**Parameters** + +- `marketId` (_uint128_) - The id of the market whose net issuance is being queried. + +**Returns** + +- `issuanceD18` (_int128_) - The net issuance of the market, denominated with 18 decimals of precision. + +#### getMarketReportedDebt + +```solidity +function getMarketReportedDebt(uint128 marketId) external view returns (uint256 reportedDebtD18) +``` + +Returns the reported debt of the specified market. + +**Parameters** + +- `marketId` (_uint128_) - The id of the market whose reported debt is being queried. + +**Returns** + +- `reportedDebtD18` (_uint256_) - The market's reported debt, denominated with 18 decimals of precision. + +#### getMarketTotalDebt + +```solidity +function getMarketTotalDebt(uint128 marketId) external view returns (int256 totalDebtD18) +``` + +Returns the total debt of the specified market. + +**Parameters** + +- `marketId` (_uint128_) - The id of the market whose debt is being queried. + +**Returns** + +- `totalDebtD18` (_int256_) - The total debt of the market, denominated with 18 decimals of precision. + +#### getMarketCollateral + +```solidity +function getMarketCollateral(uint128 marketId) external view returns (uint256 valueD18) +``` + +Returns the total snxUSD value of the collateral for the specified market. + +**Parameters** + +- `marketId` (_uint128_) - The id of the market whose collateral is being queried. + +**Returns** + +- `valueD18` (_uint256_) - The market's total snxUSD value of collateral, denominated with 18 decimals of precision. + +#### getMarketDebtPerShare + +```solidity +function getMarketDebtPerShare(uint128 marketId) external returns (int256 debtPerShareD18) +``` + +Returns the value per share of the debt of the specified market. + +This is not a view function, and actually updates the entire debt distribution chain. + +**Parameters** + +- `marketId` (_uint128_) - The id of the market whose debt per share is being queried. + +**Returns** + +- `debtPerShareD18` (_int256_) - The market's debt per share value, denominated with 18 decimals of precision. + +#### isMarketCapacityLocked + +```solidity +function isMarketCapacityLocked(uint128 marketId) external view returns (bool isLocked) +``` + +Returns whether the capacity of the specified market is locked. + +**Parameters** + +- `marketId` (_uint128_) - The id of the market whose capacity is being queried. + +**Returns** + +- `isLocked` (_bool_) - A boolean that is true if the market's capacity is locked at the time of the query. + +#### getUsdToken + +```solidity +function getUsdToken() external view returns (contract IERC20) +``` + +Returns the USD token associated with this synthetix core system + +#### getOracleManager + +```solidity +function getOracleManager() external view returns (contract IOracleManager) +``` + +Retrieve the systems' configured oracle manager address + +#### distributeDebtToPools + +```solidity +function distributeDebtToPools(uint128 marketId, uint256 maxIter) external returns (bool finishedDistributing) +``` + +Update a market's current debt registration with the system. +This function is provided as an escape hatch for pool griefing, preventing +overwhelming the system with a series of very small pools and creating high gas +costs to update an account. + +**Parameters** + +- `marketId` (_uint128_) - the id of the market that needs pools bumped +- `maxIter` (_uint256_) - + +**Returns** + +- `finishedDistributing` (_bool_) - whether or not all bumpable pools have been bumped and target price has been reached + +#### setMarketMinDelegateTime + +```solidity +function setMarketMinDelegateTime(uint128 marketId, uint32 minDelegateTime) external +``` + +allows for a market to set its minimum delegation time. This is useful for preventing stakers from frontrunning rewards or losses +by limiting the frequency of `delegateCollateral` (or `setPoolConfiguration`) calls. By default, there is no minimum delegation time. + +**Parameters** + +- `marketId` (_uint128_) - the id of the market that wants to set delegation time. +- `minDelegateTime` (_uint32_) - the minimum number of seconds between delegation calls. Note: this value must be less than the globally defined maximum minDelegateTime + +#### getMarketMinDelegateTime + +```solidity +function getMarketMinDelegateTime(uint128 marketId) external view returns (uint32) +``` + +Retrieve the minimum delegation time of a market + +**Parameters** + +- `marketId` (_uint128_) - the id of the market + +#### setMinLiquidityRatio + +```solidity +function setMinLiquidityRatio(uint128 marketId, uint256 minLiquidityRatio) external +``` + +Allows the system owner (not the pool owner) to set a market-specific minimum liquidity ratio. + +**Parameters** + +- `marketId` (_uint128_) - the id of the market +- `minLiquidityRatio` (_uint256_) - The new market-specific minimum liquidity ratio, denominated with 18 decimals of precision. (100% is represented by 1 followed by 18 zeros.) + +#### getMinLiquidityRatio + +```solidity +function getMinLiquidityRatio(uint128 marketId) external view returns (uint256 minRatioD18) +``` + +Retrieves the market-specific minimum liquidity ratio. + +**Parameters** + +- `marketId` (_uint128_) - the id of the market + +**Returns** + +- `minRatioD18` (_uint256_) - The current market-specific minimum liquidity ratio, denominated with 18 decimals of precision. (100% is represented by 1 followed by 18 zeros.) + +#### getMarketPools + +```solidity +function getMarketPools(uint128 marketId) external returns (uint128[] inRangePoolIds, uint128[] outRangePoolIds) +``` + +#### getMarketPoolDebtDistribution + +```solidity +function getMarketPoolDebtDistribution(uint128 marketId, uint128 poolId) external returns (uint256 sharesD18, uint128 totalSharesD18, int128 valuePerShareD27) +``` + +#### MarketRegistered + +```solidity +event MarketRegistered(address market, uint128 marketId, address sender) +``` + +Emitted when a new market is registered in the system. + +**Parameters** + +- `market` (_address_) - The address of the external market that was registered in the system. +- `marketId` (_uint128_) - The id with which the market was registered in the system. +- `sender` (_address_) - The account that trigger the registration of the market. + +#### MarketUsdDeposited + +```solidity +event MarketUsdDeposited(uint128 marketId, address target, uint256 amount, address market) +``` + +Emitted when a market deposits snxUSD in the system. + +**Parameters** + +- `marketId` (_uint128_) - The id of the market that deposited snxUSD in the system. +- `target` (_address_) - The address of the account that provided the snxUSD in the deposit. +- `amount` (_uint256_) - The amount of snxUSD deposited in the system, denominated with 18 decimals of precision. +- `market` (_address_) - The address of the external market that is depositing. + +#### MarketUsdWithdrawn + +```solidity +event MarketUsdWithdrawn(uint128 marketId, address target, uint256 amount, address market) +``` + +Emitted when a market withdraws snxUSD from the system. + +**Parameters** + +- `marketId` (_uint128_) - The id of the market that withdrew snxUSD from the system. +- `target` (_address_) - The address of the account that received the snxUSD in the withdrawal. +- `amount` (_uint256_) - The amount of snxUSD withdrawn from the system, denominated with 18 decimals of precision. +- `market` (_address_) - The address of the external market that is withdrawing. + +#### MarketSystemFeePaid + +```solidity +event MarketSystemFeePaid(uint128 marketId, uint256 feeAmount) +``` + +#### SetMinDelegateTime + +```solidity +event SetMinDelegateTime(uint128 marketId, uint32 minDelegateTime) +``` + +Emitted when a market sets an updated minimum delegation time + +**Parameters** + +- `marketId` (_uint128_) - The id of the market that the setting is applied to +- `minDelegateTime` (_uint32_) - The minimum amount of time between delegation changes + +#### SetMarketMinLiquidityRatio + +```solidity +event SetMarketMinLiquidityRatio(uint128 marketId, uint256 minLiquidityRatio) +``` + +Emitted when a market-specific minimum liquidity ratio is set + +**Parameters** + +- `marketId` (_uint128_) - The id of the market that the setting is applied to +- `minLiquidityRatio` (_uint256_) - The new market-specific minimum liquidity ratio + +### Multicall Module + +#### multicall + +```solidity +function multicall(bytes[] data) external payable returns (bytes[] results) +``` + +Executes multiple transaction payloads in a single transaction. + +Each transaction is executed using `delegatecall`, and targets the system address. + +**Parameters** + +- `data` (_bytes[]_) - Array of calldata objects, one for each function that is to be called in the system. + +**Returns** + +- `results` (_bytes[]_) - Array of each `delegatecall`'s response corresponding to the incoming calldata array. + +### Pool Configuration Module + +#### setPreferredPool + +```solidity +function setPreferredPool(uint128 poolId) external +``` + +Sets the unique system preferred pool. + +Note: The preferred pool does not receive any special treatment. It is only signaled as preferred here. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool that is to be set as preferred. + +#### addApprovedPool + +```solidity +function addApprovedPool(uint128 poolId) external +``` + +Marks a pool as approved by the system owner. + +Approved pools do not receive any special treatment. They are only signaled as approved here. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool that is to be approved. + +#### removeApprovedPool + +```solidity +function removeApprovedPool(uint128 poolId) external +``` + +Un-marks a pool as preferred by the system owner. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool that is to be no longer approved. + +#### getPreferredPool + +```solidity +function getPreferredPool() external view returns (uint128 poolId) +``` + +Retrieves the unique system preferred pool. + +**Returns** + +- `poolId` (_uint128_) - The id of the pool that is currently set as preferred in the system. + +#### getApprovedPools + +```solidity +function getApprovedPools() external view returns (uint256[] poolIds) +``` + +Retrieves the pool that are approved by the system owner. + +**Returns** + +- `poolIds` (_uint256[]_) - An array with all of the pool ids that are approved in the system. + +#### PreferredPoolSet + +```solidity +event PreferredPoolSet(uint256 poolId) +``` + +Emitted when the system owner sets the preferred pool. + +**Parameters** + +- `poolId` (_uint256_) - The id of the pool that was set as preferred. + +#### PoolApprovedAdded + +```solidity +event PoolApprovedAdded(uint256 poolId) +``` + +Emitted when the system owner adds an approved pool. + +**Parameters** + +- `poolId` (_uint256_) - The id of the pool that was approved. + +#### PoolApprovedRemoved + +```solidity +event PoolApprovedRemoved(uint256 poolId) +``` + +Emitted when the system owner removes an approved pool. + +**Parameters** + +- `poolId` (_uint256_) - The id of the pool that is no longer approved. + +### Pool Module + +#### createPool + +```solidity +function createPool(uint128 requestedPoolId, address owner) external +``` + +Creates a pool with the requested pool id. + +**Parameters** + +- `requestedPoolId` (_uint128_) - The requested id for the new pool. Reverts if the id is not available. +- `owner` (_address_) - The address that will own the newly created pool. + +#### setPoolConfiguration + +```solidity +function setPoolConfiguration(uint128 poolId, struct MarketConfiguration.Data[] marketDistribution) external +``` + +Allows the pool owner to configure the pool. + +The pool's configuration is composed of an array of MarketConfiguration objects, which describe which markets the pool provides liquidity to, in what proportion, and to what extent. +Incoming market ids need to be provided in ascending order. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool whose configuration is being set. +- `marketDistribution` (_struct MarketConfiguration.Data[]_) - The array of market configuration objects that define the list of markets that are connected to the system. + +#### getPoolConfiguration + +```solidity +function getPoolConfiguration(uint128 poolId) external view returns (struct MarketConfiguration.Data[] markets) +``` + +Retrieves the MarketConfiguration of the specified pool. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool whose configuration is being queried. + +**Returns** + +- `markets` (_struct MarketConfiguration.Data[]_) - The array of MarketConfiguration objects that describe the pool's configuration. + +#### setPoolName + +```solidity +function setPoolName(uint128 poolId, string name) external +``` + +Allows the owner of the pool to set the pool's name. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool whose name is being set. +- `name` (_string_) - The new name to give to the pool. + +#### getPoolName + +```solidity +function getPoolName(uint128 poolId) external view returns (string poolName) +``` + +Returns the pool's name. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool whose name is being queried. + +**Returns** + +- `poolName` (_string_) - The current name of the pool. + +#### nominatePoolOwner + +```solidity +function nominatePoolOwner(address nominatedOwner, uint128 poolId) external +``` + +Allows the current pool owner to nominate a new owner. + +**Parameters** + +- `nominatedOwner` (_address_) - The address to nominate os the new pool owner. +- `poolId` (_uint128_) - The id whose ownership is being transferred. + +#### acceptPoolOwnership + +```solidity +function acceptPoolOwnership(uint128 poolId) external +``` + +After a new pool owner has been nominated, allows it to accept the nomination and thus ownership of the pool. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool for which the caller is to accept ownership. + +#### revokePoolNomination + +```solidity +function revokePoolNomination(uint128 poolId) external +``` + +After a new pool owner has been nominated, allows it to reject the nomination. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool for which the new owner nomination is to be revoked. + +#### renouncePoolNomination + +```solidity +function renouncePoolNomination(uint128 poolId) external +``` + +Allows the current nominated owner to renounce the nomination. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool for which the caller is renouncing ownership nomination. + +#### getPoolOwner + +```solidity +function getPoolOwner(uint128 poolId) external view returns (address owner) +``` + +Returns the current pool owner. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool whose ownership is being queried. + +**Returns** + +- `owner` (_address_) - The current owner of the pool. + +#### getNominatedPoolOwner + +```solidity +function getNominatedPoolOwner(uint128 poolId) external view returns (address nominatedOwner) +``` + +Returns the current nominated pool owner. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool whose nominated owner is being queried. + +**Returns** + +- `nominatedOwner` (_address_) - The current nominated owner of the pool. + +#### setMinLiquidityRatio + +```solidity +function setMinLiquidityRatio(uint256 minLiquidityRatio) external +``` + +Allows the system owner (not the pool owner) to set the system-wide minimum liquidity ratio. + +**Parameters** + +- `minLiquidityRatio` (_uint256_) - The new system-wide minimum liquidity ratio, denominated with 18 decimals of precision. (100% is represented by 1 followed by 18 zeros.) + +#### getMinLiquidityRatio + +```solidity +function getMinLiquidityRatio() external view returns (uint256 minRatioD18) +``` + +Retrieves the system-wide minimum liquidity ratio. + +**Returns** + +- `minRatioD18` (_uint256_) - The current system-wide minimum liquidity ratio, denominated with 18 decimals of precision. (100% is represented by 1 followed by 18 zeros.) + +#### rebalancePool + +```solidity +function rebalancePool(uint128 poolId, address optionalCollateralType) external +``` + +Distributes cached debt in a pool to its vaults and updates market credit capacities. + +**Parameters** + +- `poolId` (_uint128_) - the pool to rebalance +- `optionalCollateralType` (_address_) - in addition to rebalancing the pool, calculate updated collaterals and debts for the specified vault + +#### PoolCreated + +```solidity +event PoolCreated(uint128 poolId, address owner, address sender) +``` + +Gets fired when pool will be created. + +**Parameters** + +- `poolId` (_uint128_) - The id of the newly created pool. +- `owner` (_address_) - The owner of the newly created pool. +- `sender` (_address_) - The address that triggered the creation of the pool. + +#### PoolOwnerNominated + +```solidity +event PoolOwnerNominated(uint128 poolId, address nominatedOwner, address owner) +``` + +Gets fired when pool owner proposes a new owner. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool for which the nomination ocurred. +- `nominatedOwner` (_address_) - The address that was nominated as the new owner of the pool. +- `owner` (_address_) - The address of the current owner of the pool. + +#### PoolOwnershipAccepted + +```solidity +event PoolOwnershipAccepted(uint128 poolId, address owner) +``` + +Gets fired when pool nominee accepts nomination. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool for which the owner nomination was accepted. +- `owner` (_address_) - The address of the new owner of the pool, which accepted the nomination. + +#### PoolNominationRevoked + +```solidity +event PoolNominationRevoked(uint128 poolId, address owner) +``` + +Gets fired when pool owner revokes nomination. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool in which the nomination was revoked. +- `owner` (_address_) - The current owner of the pool. + +#### PoolNominationRenounced + +```solidity +event PoolNominationRenounced(uint128 poolId, address owner) +``` + +Gets fired when pool nominee renounces nomination. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool for which the owner nomination was renounced. +- `owner` (_address_) - The current owner of the pool. + +#### PoolNameUpdated + +```solidity +event PoolNameUpdated(uint128 poolId, string name, address sender) +``` + +Gets fired when pool name changes. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool whose name was updated. +- `name` (_string_) - The new name of the pool. +- `sender` (_address_) - The address that triggered the rename of the pool. + +#### PoolConfigurationSet + +```solidity +event PoolConfigurationSet(uint128 poolId, struct MarketConfiguration.Data[] markets, address sender) +``` + +Gets fired when pool gets configured. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool whose configuration was set. +- `markets` (_struct MarketConfiguration.Data[]_) - Array of configuration data of the markets that were connected to the pool. +- `sender` (_address_) - The address that triggered the pool configuration. + +#### SetMinLiquidityRatio + +```solidity +event SetMinLiquidityRatio(uint256 minLiquidityRatio) +``` + +Emitted when a system-wide minimum liquidity ratio is set + +**Parameters** + +- `minLiquidityRatio` (_uint256_) - The new system-wide minimum liquidity ratio + +### Rewards Manager Module + +#### registerRewardsDistributor + +```solidity +function registerRewardsDistributor(uint128 poolId, address collateralType, address distributor) external +``` + +Called by pool owner to register rewards for vault participants. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool whose rewards are to be managed by the specified distributor. +- `collateralType` (_address_) - The address of the collateral used in the pool's rewards. +- `distributor` (_address_) - The address of the reward distributor to be registered. + +#### removeRewardsDistributor + +```solidity +function removeRewardsDistributor(uint128 poolId, address collateralType, address distributor) external +``` + +Called by pool owner to remove a registered rewards distributor for vault participants. +WARNING: if you remove a rewards distributor, the same address can never be re-registered again. If you +simply want to turn off +rewards, call `distributeRewards` with 0 emission. If you need to completely reset the rewards distributor +again, create a new rewards distributor at a new address and register the new one. +This function is provided since the number of rewards distributors added to an account is finite, +so you can remove an unused rewards distributor if need be. +NOTE: unclaimed rewards can still be claimed after a rewards distributor is removed (though any +rewards-over-time will be halted) + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool whose rewards are to be managed by the specified distributor. +- `collateralType` (_address_) - The address of the collateral used in the pool's rewards. +- `distributor` (_address_) - The address of the reward distributor to be registered. + +#### distributeRewards + +```solidity +function distributeRewards(uint128 poolId, address collateralType, uint256 amount, uint64 start, uint32 duration) external +``` + +Called by a registered distributor to set up rewards for vault participants. + +Will revert if the caller is not a registered distributor. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool to distribute rewards to. +- `collateralType` (_address_) - The address of the collateral used in the pool's rewards. +- `amount` (_uint256_) - The amount of rewards to be distributed. +- `start` (_uint64_) - The date at which the rewards will begin to be claimable. +- `duration` (_uint32_) - The period after which all distributed rewards will be claimable. + +#### claimRewards + +```solidity +function claimRewards(uint128 accountId, uint128 poolId, address collateralType, address distributor) external returns (uint256 amountClaimedD18) +``` + +Allows a user with appropriate permissions to claim rewards associated with a position. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account that is to claim the rewards. +- `poolId` (_uint128_) - The id of the pool to claim rewards on. +- `collateralType` (_address_) - The address of the collateral used in the pool's rewards. +- `distributor` (_address_) - The address of the rewards distributor associated with the rewards being claimed. + +**Returns** + +- `amountClaimedD18` (_uint256_) - The amount of rewards that were available for the account and thus claimed. + +#### updateRewards + +```solidity +function updateRewards(uint128 poolId, address collateralType, uint128 accountId) external returns (uint256[] claimableD18, address[] distributors) +``` + +For a given position, return the rewards that can currently be claimed. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool being queried. +- `collateralType` (_address_) - The address of the collateral used in the pool's rewards. +- `accountId` (_uint128_) - The id of the account whose available rewards are being queried. + +**Returns** + +- `claimableD18` (_uint256[]_) - An array of ids of the reward entries that are claimable by the position. +- `distributors` (_address[]_) - An array with the addresses of the reward distributors associated with the claimable rewards. + +#### getRewardRate + +```solidity +function getRewardRate(uint128 poolId, address collateralType, address distributor) external view returns (uint256 rateD18) +``` + +Returns the number of individual units of amount emitted per second per share for the given poolId, collateralType, distributor vault. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool being queried. +- `collateralType` (_address_) - The address of the collateral used in the pool's rewards. +- `distributor` (_address_) - The address of the rewards distributor associated with the rewards in question. + +**Returns** + +- `rateD18` (_uint256_) - The queried rewards rate. + +#### RewardsDistributed + +```solidity +event RewardsDistributed(uint128 poolId, address collateralType, address distributor, uint256 amount, uint256 start, uint256 duration) +``` + +Emitted when the pool owner or an existing reward distributor sets up rewards for vault participants. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool on which rewards were distributed. +- `collateralType` (_address_) - The collateral type of the pool on which rewards were distributed. +- `distributor` (_address_) - The reward distributor associated to the rewards that were distributed. +- `amount` (_uint256_) - The amount of rewards that were distributed. +- `start` (_uint256_) - The date one which the rewards will begin to be claimable. +- `duration` (_uint256_) - The time in which all of the distributed rewards will be claimable. + +#### RewardsClaimed + +```solidity +event RewardsClaimed(uint128 accountId, uint128 poolId, address collateralType, address distributor, uint256 amount) +``` + +Emitted when a vault participant claims rewards. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account that claimed the rewards. +- `poolId` (_uint128_) - The id of the pool where the rewards were claimed. +- `collateralType` (_address_) - The address of the collateral used in the pool's rewards. +- `distributor` (_address_) - The address of the rewards distributor associated with these rewards. +- `amount` (_uint256_) - The amount of rewards that were claimed. + +#### RewardsDistributorRegistered + +```solidity +event RewardsDistributorRegistered(uint128 poolId, address collateralType, address distributor) +``` + +Emitted when a new rewards distributor is registered. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool whose reward distributor was registered. +- `collateralType` (_address_) - The address of the collateral used in the pool's rewards. +- `distributor` (_address_) - The address of the newly registered reward distributor. + +#### RewardsDistributorRemoved + +```solidity +event RewardsDistributorRemoved(uint128 poolId, address collateralType, address distributor) +``` + +Emitted when an already registered rewards distributor is removed. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool whose reward distributor was registered. +- `collateralType` (_address_) - The address of the collateral used in the pool's rewards. +- `distributor` (_address_) - The address of the registered reward distributor. + +### USD Token Module + +#### burnWithAllowance + +```solidity +function burnWithAllowance(address from, address spender, uint256 amount) external +``` + +Allows the core system to burn snxUSD held by the `from` address, provided that it has given allowance to `spender`. + +**Parameters** + +- `from` (_address_) - The address that holds the snxUSD to be burned. +- `spender` (_address_) - The address to which the holder has given allowance to. +- `amount` (_uint256_) - The amount of snxUSD to be burned, denominated with 18 decimals of precision. + +### burn + +```solidity +function burn(uint256 amount) external +``` + +Destroys `amount` of snxUSD tokens from the caller. This is derived from ERC20Burnable.sol and is currently included for testing purposes with CCIP token pools. + +**Parameters** + +- `amount` (_uint256_) - The amount of snxUSD to be burned, denominated with 18 decimals of precision. + +### isInitialized + +```solidity +function isInitialized() external returns (bool) +``` + +Returns wether the token has been initialized. + +**Returns** + +- `[0]` (_bool_) - A boolean with the result of the query. + +#### initialize + +```solidity +function initialize(string tokenName, string tokenSymbol, uint8 tokenDecimals) external +``` + +Initializes the token with name, symbol, and decimals. + +#### mint + +```solidity +function mint(address to, uint256 amount) external +``` + +Allows the owner to mint tokens. + +**Parameters** + +- `to` (_address_) - The address to receive the newly minted tokens. +- `amount` (_uint256_) - The amount of tokens to mint. + +#### burn + +```solidity +function burn(address from, uint256 amount) external +``` + +Allows the owner to burn tokens. + +**Parameters** + +- `from` (_address_) - The address whose tokens will be burnt. +- `amount` (_uint256_) - The amount of tokens to burn. + +#### setAllowance + +```solidity +function setAllowance(address from, address spender, uint256 amount) external +``` + +Allows an address that holds tokens to provide allowance to another. + +**Parameters** + +- `from` (_address_) - The address that is providing allowance. +- `spender` (_address_) - The address that is given allowance. +- `amount` (_uint256_) - The amount of allowance being given. + +#### name + +```solidity +function name() external view returns (string) +``` + +Retrieves the name of the token, e.g. "Synthetix Network Token". + +**Returns** + +- `[0]` (_string_) - A string with the name of the token. + +#### symbol + +```solidity +function symbol() external view returns (string) +``` + +Retrieves the symbol of the token, e.g. "SNX". + +**Returns** + +- `[0]` (_string_) - A string with the symbol of the token. + +#### decimals + +```solidity +function decimals() external view returns (uint8) +``` + +Retrieves the number of decimals used by the token. The default is 18. + +**Returns** + +- `[0]` (_uint8_) - The number of decimals. + +#### totalSupply + +```solidity +function totalSupply() external view returns (uint256) +``` + +Returns the total number of tokens in circulation (minted - burnt). + +**Returns** + +- `[0]` (_uint256_) - The total number of tokens. + +#### balanceOf + +```solidity +function balanceOf(address owner) external view returns (uint256) +``` + +Returns the balance of a user. + +**Parameters** + +- `owner` (_address_) - The address whose balance is being retrieved. + +**Returns** + +- `[0]` (_uint256_) - The number of tokens owned by the user. + +#### allowance + +```solidity +function allowance(address owner, address spender) external view returns (uint256) +``` + +Returns how many tokens a user has allowed another user to transfer on its behalf. + +**Parameters** + +- `owner` (_address_) - The user who has given the allowance. +- `spender` (_address_) - The user who was given the allowance. + +**Returns** + +- `[0]` (_uint256_) - The amount of tokens `spender` can transfer on `owner`'s behalf. + +#### transfer + +```solidity +function transfer(address to, uint256 amount) external returns (bool) +``` + +Transfer tokens from one address to another. + +**Parameters** + +- `to` (_address_) - The address that will receive the tokens. +- `amount` (_uint256_) - The amount of tokens to be transferred. + +**Returns** + +- `[0]` (_bool_) - A boolean which is true if the operation succeeded. + +#### approve + +```solidity +function approve(address spender, uint256 amount) external returns (bool) +``` + +Allows users to provide allowance to other users so that they can transfer tokens on their behalf. + +**Parameters** + +- `spender` (_address_) - The address that is receiving the allowance. +- `amount` (_uint256_) - The amount of tokens that are being added to the allowance. + +**Returns** + +- `[0]` (_bool_) - A boolean which is true if the operation succeeded. + +#### increaseAllowance + +```solidity +function increaseAllowance(address spender, uint256 addedValue) external returns (bool) +``` + +Atomically increases the allowance granted to `spender` by the caller. + +This is an alternative to {approve} that can be used as a mitigation for +problems described in {IERC20-approve}. + +Emits an {Approval} event indicating the updated allowance. + +Requirements: + +- `spender` cannot be the zero address. + +#### decreaseAllowance + +```solidity +function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) +``` + +Atomically decreases the allowance granted to `spender` by the caller. + +This is an alternative to {approve} that can be used as a mitigation for +problems described in {IERC20-approve}. + +Emits an {Approval} event indicating the updated allowance. + +Requirements: + +- `spender` cannot be the zero address. +- `spender` must have allowance for the caller of at least + `subtractedValue`. + +#### transferFrom + +```solidity +function transferFrom(address from, address to, uint256 amount) external returns (bool) +``` + +Allows a user who has been given allowance to transfer tokens on another user's behalf. + +**Parameters** + +- `from` (_address_) - The address that owns the tokens that are being transferred. +- `to` (_address_) - The address that will receive the tokens. +- `amount` (_uint256_) - The number of tokens to transfer. + +**Returns** + +- `[0]` (_bool_) - A boolean which is true if the operation succeeded. + +#### Transfer + +```solidity +event Transfer(address from, address to, uint256 amount) +``` + +Emitted when tokens have been transferred. + +**Parameters** + +- `from` (_address_) - The address that originally owned the tokens. +- `to` (_address_) - The address that received the tokens. +- `amount` (_uint256_) - The number of tokens that were transferred. + +#### Approval + +```solidity +event Approval(address owner, address spender, uint256 amount) +``` + +Emitted when a user has provided allowance to another user for transferring tokens on its behalf. + +**Parameters** + +- `owner` (_address_) - The address that is providing the allowance. +- `spender` (_address_) - The address that received the allowance. +- `amount` (_uint256_) - The number of tokens that were added to `spender`'s allowance. + +### Vault Module + +#### delegateCollateral + +```solidity +function delegateCollateral(uint128 accountId, uint128 poolId, address collateralType, uint256 amount, uint256 leverage) external +``` + +Updates an account's delegated collateral amount for the specified pool and collateral type pair. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account associated with the position that will be updated. +- `poolId` (_uint128_) - The id of the pool associated with the position. +- `collateralType` (_address_) - The address of the collateral used in the position. +- `amount` (_uint256_) - The new amount of collateral delegated in the position, denominated with 18 decimals of precision. +- `leverage` (_uint256_) - The new leverage amount used in the position, denominated with 18 decimals of precision. Requirements: - `msg.sender` must be the owner of the account, have the `ADMIN` permission, or have the `DELEGATE` permission. - If increasing the amount delegated, it must not exceed the available collateral (`getAccountAvailableCollateral`) associated with the account. - If decreasing the amount delegated, the liquidity position must have a collateralization ratio greater than the target collateralization ratio for the corresponding collateral type. Emits a {DelegationUpdated} event. + +#### getPositionCollateralRatio + +```solidity +function getPositionCollateralRatio(uint128 accountId, uint128 poolId, address collateralType) external returns (uint256 ratioD18) +``` + +Returns the collateralization ratio of the specified liquidity position. If debt is negative, this function will return 0. + +Call this function using `callStatic` to treat it as a view function. +The return value is a percentage with 18 decimals places. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account whose collateralization ratio is being queried. +- `poolId` (_uint128_) - The id of the pool in which the account's position is held. +- `collateralType` (_address_) - The address of the collateral used in the queried position. + +**Returns** + +- `ratioD18` (_uint256_) - The collateralization ratio of the position (collateral / debt), denominated with 18 decimals of precision. + +#### getPositionDebt + +```solidity +function getPositionDebt(uint128 accountId, uint128 poolId, address collateralType) external returns (int256 debtD18) +``` + +Returns the debt of the specified liquidity position. Credit is expressed as negative debt. + +This is not a view function, and actually updates the entire debt distribution chain. +Call this function using `callStatic` to treat it as a view function. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account being queried. +- `poolId` (_uint128_) - The id of the pool in which the account's position is held. +- `collateralType` (_address_) - The address of the collateral used in the queried position. + +**Returns** + +- `debtD18` (_int256_) - The amount of debt held by the position, denominated with 18 decimals of precision. + +#### getPositionCollateral + +```solidity +function getPositionCollateral(uint128 accountId, uint128 poolId, address collateralType) external view returns (uint256 collateralAmountD18, uint256 collateralValueD18) +``` + +Returns the amount and value of the collateral associated with the specified liquidity position. + +Call this function using `callStatic` to treat it as a view function. +collateralAmount is represented as an integer with 18 decimals. +collateralValue is represented as an integer with the number of decimals specified by the collateralType. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account being queried. +- `poolId` (_uint128_) - The id of the pool in which the account's position is held. +- `collateralType` (_address_) - The address of the collateral used in the queried position. + +**Returns** + +- `collateralAmountD18` (_uint256_) - The amount of collateral used in the position, denominated with 18 decimals of precision. +- `collateralValueD18` (_uint256_) - The value of collateral used in the position, denominated with 18 decimals of precision. + +#### getPosition + +```solidity +function getPosition(uint128 accountId, uint128 poolId, address collateralType) external returns (uint256 collateralAmountD18, uint256 collateralValueD18, int256 debtD18, uint256 collateralizationRatioD18) +``` + +Returns all information pertaining to a specified liquidity position in the vault module. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account being queried. +- `poolId` (_uint128_) - The id of the pool in which the account's position is held. +- `collateralType` (_address_) - The address of the collateral used in the queried position. + +**Returns** + +- `collateralAmountD18` (_uint256_) - The amount of collateral used in the position, denominated with 18 decimals of precision. +- `collateralValueD18` (_uint256_) - The value of the collateral used in the position, denominated with 18 decimals of precision. +- `debtD18` (_int256_) - The amount of debt held in the position, denominated with 18 decimals of precision. +- `collateralizationRatioD18` (_uint256_) - The collateralization ratio of the position (collateral / debt), denominated with 18 decimals of precision. + +#### getVaultDebt + +```solidity +function getVaultDebt(uint128 poolId, address collateralType) external returns (int256 debtD18) +``` + +Returns the total debt (or credit) that the vault is responsible for. Credit is expressed as negative debt. + +This is not a view function, and actually updates the entire debt distribution chain. +Call this function using `callStatic` to treat it as a view function. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool that owns the vault whose debt is being queried. +- `collateralType` (_address_) - The address of the collateral of the associated vault. + +**Returns** + +- `debtD18` (_int256_) - The overall debt of the vault, denominated with 18 decimals of precision. + +#### getVaultCollateral + +```solidity +function getVaultCollateral(uint128 poolId, address collateralType) external returns (uint256 collateralAmountD18, uint256 collateralValueD18) +``` + +Returns the amount and value of the collateral held by the vault. + +Call this function using `callStatic` to treat it as a view function. +collateralAmount is represented as an integer with 18 decimals. +collateralValue is represented as an integer with the number of decimals specified by the collateralType. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool that owns the vault whose collateral is being queried. +- `collateralType` (_address_) - The address of the collateral of the associated vault. + +**Returns** + +- `collateralAmountD18` (_uint256_) - The collateral amount of the vault, denominated with 18 decimals of precision. +- `collateralValueD18` (_uint256_) - The collateral value of the vault, denominated with 18 decimals of precision. + +#### getVaultCollateralRatio + +```solidity +function getVaultCollateralRatio(uint128 poolId, address collateralType) external returns (uint256 ratioD18) +``` + +Returns the collateralization ratio of the vault. If debt is negative, this function will return 0. + +Call this function using `callStatic` to treat it as a view function. +The return value is a percentage with 18 decimals places. + +**Parameters** + +- `poolId` (_uint128_) - The id of the pool that owns the vault whose collateralization ratio is being queried. +- `collateralType` (_address_) - The address of the collateral of the associated vault. + +**Returns** + +- `ratioD18` (_uint256_) - The collateralization ratio of the vault, denominated with 18 decimals of precision. + +#### DelegationUpdated + +```solidity +event DelegationUpdated(uint128 accountId, uint128 poolId, address collateralType, uint256 amount, uint256 leverage, address sender) +``` + +Emitted when {sender} updates the delegation of collateral in the specified liquidity position. + +**Parameters** + +- `accountId` (_uint128_) - The id of the account whose position was updated. +- `poolId` (_uint128_) - The id of the pool in which the position was updated. +- `collateralType` (_address_) - The address of the collateral associated to the position. +- `amount` (_uint256_) - The new amount of the position, denominated with 18 decimals of precision. +- `leverage` (_uint256_) - The new leverage value of the position, denominated with 18 decimals of precision. +- `sender` (_address_) - The address that triggered the update of the position. + +## Spot Market + +- [Back to TOC](#smart-contracts) + +### Async Order Configuration Module + +#### addSettlementStrategy + +```solidity +function addSettlementStrategy(uint128 synthMarketId, struct SettlementStrategy.Data strategy) external returns (uint256 strategyId) +``` + +Adds new settlement strategy to the specified market id. + +**Parameters** + +- `synthMarketId` (_uint128_) - Id of the market to associate the strategy with. +- `strategy` (_struct SettlementStrategy.Data_) - Settlement strategy data. see SettlementStrategy.Data struct. + +**Returns** + +- `strategyId` (_uint256_) - newly created settlement strategy id. + +#### setSettlementStrategyEnabled + +```solidity +function setSettlementStrategyEnabled(uint128 synthMarketId, uint256 strategyId, bool enabled) external +``` + +Sets the strategy to enabled or disabled. + +when disabled, the strategy will be invalid for committing of new async orders. + +**Parameters** + +- `synthMarketId` (_uint128_) - Id of the market associated with the strategy. +- `strategyId` (_uint256_) - id of the strategy. +- `enabled` (_bool_) - set enabled/disabled. + +#### getSettlementStrategy + +```solidity +function getSettlementStrategy(uint128 marketId, uint256 strategyId) external view returns (struct SettlementStrategy.Data settlementStrategy) +``` + +Returns the settlement strategy data for given market/strategy id. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market associated with the strategy. +- `strategyId` (_uint256_) - id of the strategy. + +**Returns** + +- `settlementStrategy` (_struct SettlementStrategy.Data_) - + +#### SettlementStrategyAdded + +```solidity +event SettlementStrategyAdded(uint128 synthMarketId, uint256 strategyId) +``` + +Gets fired when new settlement strategy is added. + +**Parameters** + +- `synthMarketId` (_uint128_) - adds settlement strategy to this specific market. +- `strategyId` (_uint256_) - the newly created settlement strategy id. + +#### SettlementStrategyUpdated + +```solidity +event SettlementStrategyUpdated(uint128 synthMarketId, uint256 strategyId, bool enabled) +``` + +Gets fired when settlement strategy is enabled/disabled. + +currently only enabled/disabled flag can be updated. + +**Parameters** + +- `synthMarketId` (_uint128_) - adds settlement strategy to this specific market. +- `strategyId` (_uint256_) - id of the strategy. +- `enabled` (_bool_) - true/false. + +### Async Order Module + +#### commitOrder + +```solidity +function commitOrder(uint128 marketId, enum Transaction.Type orderType, uint256 amountProvided, uint256 settlementStrategyId, uint256 minimumSettlementAmount, address referrer) external returns (struct AsyncOrderClaim.Data asyncOrderClaim) +``` + +Commit an async order via this function + +commitment transfers the amountProvided into the contract and escrows the funds until settlement. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market used for the trade. +- `orderType` (_enum Transaction.Type_) - Should send either 2 or 3 which correlates to the transaction type enum defined in Transaction.Type. +- `amountProvided` (_uint256_) - amount of value provided by the user for trade. Should have enough allowance. +- `settlementStrategyId` (_uint256_) - id of the settlement strategy used for trade. +- `minimumSettlementAmount` (_uint256_) - minimum amount of value returned to trader after fees. +- `referrer` (_address_) - Optional address of the referrer, for fee share + +**Returns** + +- `asyncOrderClaim` (_struct AsyncOrderClaim.Data_) - claim details (see AsyncOrderClaim.Data struct). + +#### cancelOrder + +```solidity +function cancelOrder(uint128 marketId, uint128 asyncOrderId) external +``` + +Cancel an async order via this function + +cancellation transfers the amountProvided back to the trader without any fee collection +cancellation can only happen after the settlement time has passed +needs to satisfy commitmentTime + settlementDelay + settlementDuration < block.timestamp + +**Parameters** + +- `marketId` (_uint128_) - Id of the market used for the trade. +- `asyncOrderId` (_uint128_) - id of the async order created during commitment. + +#### getAsyncOrderClaim + +```solidity +function getAsyncOrderClaim(uint128 marketId, uint128 asyncOrderId) external view returns (struct AsyncOrderClaim.Data asyncOrderClaim) +``` + +Get async order claim details + +**Parameters** + +- `marketId` (_uint128_) - Id of the market used for the trade. +- `asyncOrderId` (_uint128_) - id of the async order created during commitment. + +**Returns** + +- `asyncOrderClaim` (_struct AsyncOrderClaim.Data_) - claim details (see AsyncOrderClaim.Data struct). + +#### OrderCommitted + +```solidity +event OrderCommitted(uint128 marketId, enum Transaction.Type orderType, uint256 amountProvided, uint128 asyncOrderId, address sender, address referrer) +``` + +Gets fired when a new order is committed. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market used for the trade. +- `orderType` (_enum Transaction.Type_) - Should send either 2 or 3 which correlates to the transaction type enum defined in Transaction.Type. +- `amountProvided` (_uint256_) - amount of value provided by the user for trade. +- `asyncOrderId` (_uint128_) - id of the async order created (used for settlements). +- `sender` (_address_) - trader address. +- `referrer` (_address_) - Optional address of the referrer, for fee share + +#### OrderCancelled + +```solidity +event OrderCancelled(uint128 marketId, uint128 asyncOrderId, struct AsyncOrderClaim.Data asyncOrderClaim, address sender) +``` + +Gets fired when an order is cancelled. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market used for the trade. +- `asyncOrderId` (_uint128_) - id of the async order. +- `asyncOrderClaim` (_struct AsyncOrderClaim.Data_) - claim details (see AsyncOrderClaim.Data struct). +- `sender` (_address_) - trader address and also the receiver of the funds. + +### Async Order Settlement Module + +#### settleOrder + +```solidity +function settleOrder(uint128 marketId, uint128 asyncOrderId) external returns (uint256 finalOrderAmount, struct OrderFees.Data) +``` + +Settle already created async order via this function + +if the strategy is onchain, the settlement is done similar to an atomic buy except with settlement time +if the strategy is offchain, this function will revert with OffchainLookup error and the client should perform offchain lookup and call the callback specified see: EIP-3668 + +**Parameters** + +- `marketId` (_uint128_) - Id of the market used for the trade. +- `asyncOrderId` (_uint128_) - id of the async order created during commitment. + +**Returns** + +- `finalOrderAmount` (_uint256_) - amount returned to trader after fees. +- `[1]` (_struct OrderFees.Data_) - OrderFees.Data breakdown of all the fees incurred for the transaction. + +#### settlePythOrder + +```solidity +function settlePythOrder(bytes result, bytes extraData) external payable returns (uint256 finalOrderAmount, struct OrderFees.Data fees) +``` + +Callback function for Pyth settlement strategy + +This is the selector specified as callback when settlement strategy is pyth offchain. +The data returned from the offchain lookup should be sent as "result" +The extraData is the same as the one sent during the offchain lookup revert error. It is used to retrieve the commitment claim. +this function expects ETH that is passed through to the Pyth contract for the fee it's charging. +To determine the fee, the client should first call getUpdateFee() from Pyth's verifier contract. + +**Parameters** + +- `result` (_bytes_) - result returned from the offchain lookup. +- `extraData` (_bytes_) - extra data sent during the offchain lookup revert error. + +**Returns** + +- `finalOrderAmount` (_uint256_) - amount returned to trader after fees. +- `fees` (_struct OrderFees.Data_) - breakdown of all the fees incurred for the transaction. + +#### OrderSettled + +```solidity +event OrderSettled(uint128 marketId, uint128 asyncOrderId, uint256 finalOrderAmount, struct OrderFees.Data fees, uint256 collectedFees, address settler, uint256 price, enum Transaction.Type orderType) +``` + +Gets fired when an order is settled. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market used for the trade. +- `asyncOrderId` (_uint128_) - id of the async order. +- `finalOrderAmount` (_uint256_) - amount returned to trader after fees. +- `fees` (_struct OrderFees.Data_) - breakdown of all the fees incurred for the transaction. +- `collectedFees` (_uint256_) - fees collected by the configured fee collector. +- `settler` (_address_) - address that settled the order. +- `price` (_uint256_) - +- `orderType` (_enum Transaction.Type_) - + +### Atomic Order Module + +#### buyExactIn + +```solidity +function buyExactIn(uint128 synthMarketId, uint256 amountUsd, uint256 minAmountReceived, address referrer) external returns (uint256 synthAmount, struct OrderFees.Data fees) +``` + +Initiates a buy trade returning synth for the specified amountUsd. + +Transfers the specified amountUsd, collects fees through configured fee collector, returns synth to the trader. +Leftover fees not collected get deposited into the market manager to improve market PnL. +Uses the buyFeedId configured for the market. + +**Parameters** + +- `synthMarketId` (_uint128_) - Id of the market used for the trade. +- `amountUsd` (_uint256_) - Amount of snxUSD trader is providing allowance for the trade. +- `minAmountReceived` (_uint256_) - Min Amount of synth is expected the trader to receive otherwise the transaction will revert. +- `referrer` (_address_) - Optional address of the referrer, for fee share + +**Returns** + +- `synthAmount` (_uint256_) - Synth received on the trade based on amount provided by trader. +- `fees` (_struct OrderFees.Data_) - breakdown of all the fees incurred for the transaction. + +#### buy + +```solidity +function buy(uint128 marketId, uint256 usdAmount, uint256 minAmountReceived, address referrer) external returns (uint256 synthAmount, struct OrderFees.Data fees) +``` + +alias for buyExactIn + +**Parameters** + +- `marketId` (_uint128_) - (see buyExactIn) +- `usdAmount` (_uint256_) - (see buyExactIn) +- `minAmountReceived` (_uint256_) - (see buyExactIn) +- `referrer` (_address_) - (see buyExactIn) + +**Returns** + +- `synthAmount` (_uint256_) - (see buyExactIn) +- `fees` (_struct OrderFees.Data_) - (see buyExactIn) + +#### buyExactOut + +```solidity +function buyExactOut(uint128 synthMarketId, uint256 synthAmount, uint256 maxUsdAmount, address referrer) external returns (uint256 usdAmountCharged, struct OrderFees.Data fees) +``` + +user provides the synth amount they'd like to buy, and the function charges the USD amount which includes fees + +the inverse of buyExactIn + +**Parameters** + +- `synthMarketId` (_uint128_) - market id value +- `synthAmount` (_uint256_) - the amount of synth the trader wants to buy +- `maxUsdAmount` (_uint256_) - max amount the trader is willing to pay for the specified synth +- `referrer` (_address_) - optional address of the referrer, for fee share + +**Returns** + +- `usdAmountCharged` (_uint256_) - amount of USD charged for the trade +- `fees` (_struct OrderFees.Data_) - breakdown of all the fees incurred for the transaction + +#### quoteBuyExactIn + +```solidity +function quoteBuyExactIn(uint128 synthMarketId, uint256 usdAmount) external view returns (uint256 synthAmount, struct OrderFees.Data fees) +``` + +quote for buyExactIn. same parameters and return values as buyExactIn + +**Parameters** + +- `synthMarketId` (_uint128_) - market id value +- `usdAmount` (_uint256_) - amount of USD to use for the trade + +**Returns** + +- `synthAmount` (_uint256_) - return amount of synth given the USD amount - fees +- `fees` (_struct OrderFees.Data_) - breakdown of all the quoted fees for the buy txn + +#### quoteBuyExactOut + +```solidity +function quoteBuyExactOut(uint128 synthMarketId, uint256 synthAmount) external view returns (uint256 usdAmountCharged, struct OrderFees.Data) +``` + +quote for buyExactOut. same parameters and return values as buyExactOut + +**Parameters** + +- `synthMarketId` (_uint128_) - market id value +- `synthAmount` (_uint256_) - amount of synth requested + +**Returns** + +- `usdAmountCharged` (_uint256_) - USD amount charged for the synth requested - fees +- `[1]` (_struct OrderFees.Data_) - fees breakdown of all the quoted fees for the buy txn + +#### sellExactIn + +```solidity +function sellExactIn(uint128 synthMarketId, uint256 sellAmount, uint256 minAmountReceived, address referrer) external returns (uint256 returnAmount, struct OrderFees.Data fees) +``` + +Initiates a sell trade returning snxUSD for the specified amount of synth (sellAmount) + +Transfers the specified synth, collects fees through configured fee collector, returns snxUSD to the trader. +Leftover fees not collected get deposited into the market manager to improve market PnL. + +**Parameters** + +- `synthMarketId` (_uint128_) - Id of the market used for the trade. +- `sellAmount` (_uint256_) - Amount of synth provided by trader for trade into snxUSD. +- `minAmountReceived` (_uint256_) - Min Amount of snxUSD trader expects to receive for the trade +- `referrer` (_address_) - Optional address of the referrer, for fee share + +**Returns** + +- `returnAmount` (_uint256_) - Amount of snxUSD returned to user +- `fees` (_struct OrderFees.Data_) - breakdown of all the fees incurred for the transaction. + +#### sellExactOut + +```solidity +function sellExactOut(uint128 marketId, uint256 usdAmount, uint256 maxSynthAmount, address referrer) external returns (uint256 synthToBurn, struct OrderFees.Data fees) +``` + +initiates a trade where trader specifies USD amount they'd like to receive + +the inverse of sellExactIn + +**Parameters** + +- `marketId` (_uint128_) - synth market id +- `usdAmount` (_uint256_) - amount of USD trader wants to receive +- `maxSynthAmount` (_uint256_) - max amount of synth trader is willing to use to receive the specified USD amount +- `referrer` (_address_) - optional address of the referrer, for fee share + +**Returns** + +- `synthToBurn` (_uint256_) - amount of synth charged for the specified usd amount +- `fees` (_struct OrderFees.Data_) - breakdown of all the fees incurred for the transaction + +#### sell + +```solidity +function sell(uint128 marketId, uint256 synthAmount, uint256 minUsdAmount, address referrer) external returns (uint256 usdAmountReceived, struct OrderFees.Data fees) +``` + +alias for sellExactIn + +**Parameters** + +- `marketId` (_uint128_) - (see sellExactIn) +- `synthAmount` (_uint256_) - (see sellExactIn) +- `minUsdAmount` (_uint256_) - (see sellExactIn) +- `referrer` (_address_) - (see sellExactIn) + +**Returns** + +- `usdAmountReceived` (_uint256_) - (see sellExactIn) +- `fees` (_struct OrderFees.Data_) - (see sellExactIn) + +#### quoteSellExactIn + +```solidity +function quoteSellExactIn(uint128 marketId, uint256 synthAmount) external view returns (uint256 returnAmount, struct OrderFees.Data fees) +``` + +quote for sellExactIn + +returns expected USD amount trader would receive for the specified synth amount + +**Parameters** + +- `marketId` (_uint128_) - synth market id +- `synthAmount` (_uint256_) - synth amount trader is providing for the trade + +**Returns** + +- `returnAmount` (_uint256_) - amount of USD expected back +- `fees` (_struct OrderFees.Data_) - breakdown of all the quoted fees for the txn + +#### quoteSellExactOut + +```solidity +function quoteSellExactOut(uint128 marketId, uint256 usdAmount) external view returns (uint256 synthToBurn, struct OrderFees.Data fees) +``` + +quote for sellExactOut + +returns expected synth amount expected from trader for the requested USD amount + +**Parameters** + +- `marketId` (_uint128_) - synth market id +- `usdAmount` (_uint256_) - USD amount trader wants to receive + +**Returns** + +- `synthToBurn` (_uint256_) - amount of synth expected from trader +- `fees` (_struct OrderFees.Data_) - breakdown of all the quoted fees for the txn + +#### SynthBought + +```solidity +event SynthBought(uint256 synthMarketId, uint256 synthReturned, struct OrderFees.Data fees, uint256 collectedFees, address referrer, uint256 price) +``` + +Gets fired when buy trade is complete + +**Parameters** + +- `synthMarketId` (_uint256_) - Id of the market used for the trade. +- `synthReturned` (_uint256_) - Synth received on the trade based on amount provided by trader. +- `fees` (_struct OrderFees.Data_) - breakdown of all fees incurred for transaction. +- `collectedFees` (_uint256_) - Fees collected by the configured FeeCollector for the market (rest of the fees are deposited to market manager). +- `referrer` (_address_) - Optional address of the referrer, for fee share +- `price` (_uint256_) - + +#### SynthSold + +```solidity +event SynthSold(uint256 synthMarketId, uint256 amountReturned, struct OrderFees.Data fees, uint256 collectedFees, address referrer, uint256 price) +``` + +Gets fired when sell trade is complete + +**Parameters** + +- `synthMarketId` (_uint256_) - Id of the market used for the trade. +- `amountReturned` (_uint256_) - Amount of snxUSD returned to user based on synth provided by trader. +- `fees` (_struct OrderFees.Data_) - breakdown of all fees incurred for transaction. +- `collectedFees` (_uint256_) - Fees collected by the configured FeeCollector for the market (rest of the fees are deposited to market manager). +- `referrer` (_address_) - Optional address of the referrer, for fee share +- `price` (_uint256_) - + +### Market Configuration Module + +#### getMarketFees + +```solidity +function getMarketFees(uint128 synthMarketId) external returns (uint256 atomicFixedFee, uint256 asyncFixedFee, int256 wrapFee, int256 unwrapFee) +``` + +gets the atomic fixed fee for a given market + +**Parameters** + +- `synthMarketId` (_uint128_) - Id of the market the fee applies to. + +**Returns** + +- `atomicFixedFee` (_uint256_) - fixed fee amount represented in bips with 18 decimals. +- `asyncFixedFee` (_uint256_) - fixed fee amount represented in bips with 18 decimals. +- `wrapFee` (_int256_) - wrapping fee in %, 18 decimals. Can be negative. +- `unwrapFee` (_int256_) - unwrapping fee in %, 18 decimals. Can be negative. + +#### setAtomicFixedFee + +```solidity +function setAtomicFixedFee(uint128 synthMarketId, uint256 atomicFixedFee) external +``` + +sets the atomic fixed fee for a given market + +only marketOwner can set the fee + +**Parameters** + +- `synthMarketId` (_uint128_) - Id of the market the fee applies to. +- `atomicFixedFee` (_uint256_) - fixed fee amount represented in bips with 18 decimals. + +#### setAsyncFixedFee + +```solidity +function setAsyncFixedFee(uint128 synthMarketId, uint256 asyncFixedFee) external +``` + +sets the async fixed fee for a given market + +only marketOwner can set the fee + +**Parameters** + +- `synthMarketId` (_uint128_) - Id of the market the fee applies to. +- `asyncFixedFee` (_uint256_) - fixed fee amount represented in bips with 18 decimals. + +#### setMarketSkewScale + +```solidity +function setMarketSkewScale(uint128 synthMarketId, uint256 skewScale) external +``` + +sets the skew scale for a given market + +only marketOwner can set the skew scale + +**Parameters** + +- `synthMarketId` (_uint128_) - Id of the market the skew scale applies to. +- `skewScale` (_uint256_) - max amount of synth which makes the skew 100%. the fee is derived as a % of the max value. 100% premium means outstanding synth == skewScale. + +#### getMarketSkewScale + +```solidity +function getMarketSkewScale(uint128 synthMarketId) external returns (uint256 skewScale) +``` + +gets the skew scale for a given market + +**Parameters** + +- `synthMarketId` (_uint128_) - Id of the market the skew scale applies to. + +**Returns** + +- `skewScale` (_uint256_) - max amount of synth which makes the skew 100%. the fee is derived as a % of the max value. 100% premium means outstanding synth == skewScale. + +#### setMarketUtilizationFees + +```solidity +function setMarketUtilizationFees(uint128 synthMarketId, uint256 utilizationFeeRate) external +``` + +sets the market utilization fee for a given market + +only marketOwner can set the fee +100% utilization means the fee is 0. 120% utilization means the fee is 20% \* this fee rate (in bips). + +**Parameters** + +- `synthMarketId` (_uint128_) - Id of the market the utilization fee applies to. +- `utilizationFeeRate` (_uint256_) - the rate is represented in bips with 18 decimals and is the rate at which fee increases based on the % above 100% utilization of the delegated collateral for the market. + +#### getMarketUtilizationFees + +```solidity +function getMarketUtilizationFees(uint128 synthMarketId) external returns (uint256 utilizationFeeRate) +``` + +gets the market utilization fee for a given market + +100% utilization means the fee is 0. 120% utilization means the fee is 20% \* this fee rate (in bips). + +**Parameters** + +- `synthMarketId` (_uint128_) - Id of the market the utilization fee applies to. + +**Returns** + +- `utilizationFeeRate` (_uint256_) - the rate is represented in bips with 18 decimals and is the rate at which fee increases based on the % above 100% utilization of the delegated collateral for the market. + +#### setCollateralLeverage + +```solidity +function setCollateralLeverage(uint128 synthMarketId, uint256 collateralLeverage) external +``` + +sets the collateral leverage for a given market + +only marketOwner can set the leverage +this leverage value is a value applied to delegated collateral which is compared to outstanding synth to determine utilization of market, and locked amounts + +**Parameters** + +- `synthMarketId` (_uint128_) - Id of the market the collateral leverage applies to. +- `collateralLeverage` (_uint256_) - the leverage is represented as % with 18 decimals. 1 = 1x leverage + +#### getCollateralLeverage + +```solidity +function getCollateralLeverage(uint128 synthMarketId) external returns (uint256 collateralLeverage) +``` + +gets the collateral leverage for a given market + +this leverage value is a value applied to delegated collateral which is compared to outstanding synth to determine utilization of market, and locked amounts + +**Parameters** + +- `synthMarketId` (_uint128_) - Id of the market the collateral leverage applies to. + +**Returns** + +- `collateralLeverage` (_uint256_) - the leverage is represented as % with 18 decimals. 1 = 1x leverage + +#### setCustomTransactorFees + +```solidity +function setCustomTransactorFees(uint128 synthMarketId, address transactor, uint256 fixedFeeAmount) external +``` + +sets the fixed fee for a given market and transactor + +overrides both the atomic and async fixed fees +only marketOwner can set the fee +especially useful for direct integrations where configured traders get a discount + +**Parameters** + +- `synthMarketId` (_uint128_) - Id of the market the custom transactor fee applies to. +- `transactor` (_address_) - address of the trader getting discounted fees. +- `fixedFeeAmount` (_uint256_) - the fixed fee applying to the provided transactor. + +#### getCustomTransactorFees + +```solidity +function getCustomTransactorFees(uint128 synthMarketId, address transactor) external returns (uint256 fixedFeeAmount) +``` + +gets the fixed fee for a given market and transactor + +overrides both the atomic and async fixed fees +especially useful for direct integrations where configured traders get a discount + +**Parameters** + +- `synthMarketId` (_uint128_) - Id of the market the custom transactor fee applies to. +- `transactor` (_address_) - address of the trader getting discounted fees. + +**Returns** + +- `fixedFeeAmount` (_uint256_) - the fixed fee applying to the provided transactor. + +#### setFeeCollector + +```solidity +function setFeeCollector(uint128 synthMarketId, address feeCollector) external +``` + +sets a custom fee collector for a given market + +only marketOwner can set the fee collector +a use case here would be if the market owner wants to collect the fees via this contract and distribute via rewards distributor to SNX holders for example. +if fee collector is not set, the fees are deposited into the market manager. + +**Parameters** + +- `synthMarketId` (_uint128_) - Id of the market the fee collector applies to. +- `feeCollector` (_address_) - address of the fee collector inheriting the IFeeCollector interface. + +#### getFeeCollector + +```solidity +function getFeeCollector(uint128 synthMarketId) external returns (address feeCollector) +``` + +gets a custom fee collector for a given market + +**Parameters** + +- `synthMarketId` (_uint128_) - Id of the market the fee collector applies to. + +**Returns** + +- `feeCollector` (_address_) - address of the fee collector inheriting the IFeeCollector interface. + +#### setWrapperFees + +```solidity +function setWrapperFees(uint128 synthMarketId, int256 wrapFee, int256 unwrapFee) external +``` + +sets wrapper related fees. + +only marketOwner can set the wrapper fees +fees can be negative. this is a way to unwind the wrapper if needed by providing incentives. + +**Parameters** + +- `synthMarketId` (_uint128_) - Id of the market the wrapper fees apply to. +- `wrapFee` (_int256_) - wrapping fee in %, 18 decimals. Can be negative. +- `unwrapFee` (_int256_) - unwrapping fee in %, 18 decimals. Can be negative. + +#### updateReferrerShare + +```solidity +function updateReferrerShare(uint128 marketId, address referrer, uint256 sharePercentage) external +``` + +Update the referral share percentage for a given market + +**Parameters** + +- `marketId` (_uint128_) - id of the market +- `referrer` (_address_) - The address of the referrer +- `sharePercentage` (_uint256_) - The new share percentage for the referrer + +#### getReferrerShare + +```solidity +function getReferrerShare(uint128 marketId, address referrer) external returns (uint256 sharePercentage) +``` + +get the referral share percentage for a given market + +**Parameters** + +- `marketId` (_uint128_) - id of the market +- `referrer` (_address_) - The address of the referrer + +**Returns** + +- `sharePercentage` (_uint256_) - The new share percentage for the referrer + +#### MarketUtilizationFeesSet + +```solidity +event MarketUtilizationFeesSet(uint256 synthMarketId, uint256 utilizationFeeRate) +``` + +emitted when market utilization fees are set for specified market + +**Parameters** + +- `synthMarketId` (_uint256_) - market id +- `utilizationFeeRate` (_uint256_) - utilization fee rate value + +#### MarketSkewScaleSet + +```solidity +event MarketSkewScaleSet(uint256 synthMarketId, uint256 skewScale) +``` + +emitted when the skew scale is set for a market + +**Parameters** + +- `synthMarketId` (_uint256_) - market id +- `skewScale` (_uint256_) - skew scale value + +#### CollateralLeverageSet + +```solidity +event CollateralLeverageSet(uint256 synthMarketId, uint256 collateralLeverage) +``` + +emitted when the collateral leverage is set for a market + +**Parameters** + +- `synthMarketId` (_uint256_) - market id +- `collateralLeverage` (_uint256_) - leverage value + +#### AtomicFixedFeeSet + +```solidity +event AtomicFixedFeeSet(uint256 synthMarketId, uint256 atomicFixedFee) +``` + +emitted when the fixed fee for atomic orders is set. + +**Parameters** + +- `synthMarketId` (_uint256_) - market id +- `atomicFixedFee` (_uint256_) - fee value + +#### AsyncFixedFeeSet + +```solidity +event AsyncFixedFeeSet(uint256 synthMarketId, uint256 asyncFixedFee) +``` + +emitted when the fixed fee for async orders is set. + +**Parameters** + +- `synthMarketId` (_uint256_) - market id +- `asyncFixedFee` (_uint256_) - fee value + +#### TransactorFixedFeeSet + +```solidity +event TransactorFixedFeeSet(uint256 synthMarketId, address transactor, uint256 fixedFeeAmount) +``` + +emitted when the fixed fee is set for a given transactor + +this overrides the async/atomic fixed fees for a given transactor + +**Parameters** + +- `synthMarketId` (_uint256_) - Id of the market to set the fees for. +- `transactor` (_address_) - fixed fee for the transactor (overrides the global fixed fee) +- `fixedFeeAmount` (_uint256_) - the fixed fee for the corresponding market, and transactor + +#### FeeCollectorSet + +```solidity +event FeeCollectorSet(uint256 synthMarketId, address feeCollector) +``` + +emitted when custom fee collector is set for a given market + +**Parameters** + +- `synthMarketId` (_uint256_) - Id of the market to set the collector for. +- `feeCollector` (_address_) - the address of the fee collector to set. + +#### WrapperFeesSet + +```solidity +event WrapperFeesSet(uint256 synthMarketId, int256 wrapFee, int256 unwrapFee) +``` + +emitted when wrapper fees are set for a given market + +**Parameters** + +- `synthMarketId` (_uint256_) - Id of the market to set the wrapper fees. +- `wrapFee` (_int256_) - wrapping fee in %, 18 decimals. Can be negative. +- `unwrapFee` (_int256_) - unwrapping fee in %, 18 decimals. Can be negative. + +#### ReferrerShareUpdated + +```solidity +event ReferrerShareUpdated(uint128 marketId, address referrer, uint256 sharePercentage) +``` + +Emitted when the share percentage for a referrer address has been updated. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market +- `referrer` (_address_) - The address of the referrer +- `sharePercentage` (_uint256_) - The new share percentage for the referrer + +### Spot Market Factory Module + +#### setSynthetix + +```solidity +function setSynthetix(contract ISynthetixSystem synthetix) external +``` + +Sets the v3 synthetix core system. + +Pulls in the USDToken and oracle manager from the synthetix core system and sets those appropriately. + +**Parameters** + +- `synthetix` (_contract ISynthetixSystem_) - synthetix v3 core system address + +#### setSynthImplementation + +```solidity +function setSynthImplementation(address synthImplementation) external +``` + +When a new synth is created, this is the erc20 implementation that is used. + +**Parameters** + +- `synthImplementation` (_address_) - erc20 implementation address + +#### createSynth + +```solidity +function createSynth(string tokenName, string tokenSymbol, address synthOwner) external returns (uint128 synthMarketId) +``` + +Creates a new synth market with synthetix v3 core system via market manager + +The synth is created using the initial synth implementation and creates a proxy for future upgrades of the synth implementation. +Sets up the market owner who can update configuration for the synth. + +**Parameters** + +- `tokenName` (_string_) - name of synth (i.e Synthetix ETH) +- `tokenSymbol` (_string_) - symbol of synth (i.e snxETH) +- `synthOwner` (_address_) - owner of the market that's created. + +**Returns** + +- `synthMarketId` (_uint128_) - id of the synth market that was created + +#### getSynth + +```solidity +function getSynth(uint128 marketId) external view returns (address synthAddress) +``` + +Get the proxy address of the synth for the provided marketId + +Uses associated systems module to retrieve the token address. + +**Parameters** + +- `marketId` (_uint128_) - id of the market + +**Returns** + +- `synthAddress` (_address_) - address of the proxy for the synth + +#### getSynthImpl + +```solidity +function getSynthImpl(uint128 marketId) external view returns (address implAddress) +``` + +Get the implementation address of the synth for the provided marketId. +This address should not be used directly--use `getSynth` instead + +Uses associated systems module to retrieve the token address. + +**Parameters** + +- `marketId` (_uint128_) - id of the market + +**Returns** + +- `implAddress` (_address_) - address of the proxy for the synth + +#### updatePriceData + +```solidity +function updatePriceData(uint128 marketId, bytes32 buyFeedId, bytes32 sellFeedId) external +``` + +Update the price data for a given market. + +Only the market owner can call this function. + +**Parameters** + +- `marketId` (_uint128_) - id of the market +- `buyFeedId` (_bytes32_) - the oracle manager buy feed node id +- `sellFeedId` (_bytes32_) - the oracle manager sell feed node id + +#### upgradeSynthImpl + +```solidity +function upgradeSynthImpl(uint128 marketId) external +``` + +upgrades the synth implementation to the current implementation for the specified market. +Anyone who is willing and able to spend the gas can call this method. + +The synth implementation is upgraded via the proxy. + +**Parameters** + +- `marketId` (_uint128_) - id of the market + +#### setDecayRate + +```solidity +function setDecayRate(uint128 marketId, uint256 rate) external +``` + +Allows market to adjust decay rate of the synth + +**Parameters** + +- `marketId` (_uint128_) - the market to update the synth decay rate for +- `rate` (_uint256_) - APY to decay of the synth to decay by, as a 18 decimal ratio + +#### nominateMarketOwner + +```solidity +function nominateMarketOwner(uint128 synthMarketId, address newNominatedOwner) external +``` + +Allows the current market owner to nominate a new owner. + +The nominated owner will have to call `acceptOwnership` in a separate transaction in order to finalize the action and become the new contract owner. + +**Parameters** + +- `synthMarketId` (_uint128_) - synth market id value +- `newNominatedOwner` (_address_) - The address that is to become nominated. + +#### acceptMarketOwnership + +```solidity +function acceptMarketOwnership(uint128 synthMarketId) external +``` + +Allows a nominated address to accept ownership of the market. + +Reverts if the caller is not nominated. + +**Parameters** + +- `synthMarketId` (_uint128_) - synth market id value + +#### renounceMarketNomination + +```solidity +function renounceMarketNomination(uint128 synthMarketId) external +``` + +Allows a nominated address to renounce ownership of the market. + +Reverts if the caller is not nominated. + +**Parameters** + +- `synthMarketId` (_uint128_) - synth market id value + +#### getMarketOwner + +```solidity +function getMarketOwner(uint128 synthMarketId) external view returns (address) +``` + +Returns market owner. + +**Parameters** + +- `synthMarketId` (_uint128_) - synth market id value + +#### name + +```solidity +function name(uint128 marketId) external view returns (string) +``` + +returns a human-readable name for a given market + +#### reportedDebt + +```solidity +function reportedDebt(uint128 marketId) external view returns (uint256) +``` + +returns amount of USD that the market would try to mint if everything was withdrawn + +#### minimumCredit + +```solidity +function minimumCredit(uint128 marketId) external view returns (uint256) +``` + +prevents reduction of available credit capacity by specifying this amount, for which withdrawals will be disallowed + +#### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceID) external view returns (bool) +``` + +Determines if the contract in question supports the specified interface. + +**Parameters** + +- `interfaceID` (_bytes4_) - XOR of all selectors in the contract. + +**Returns** + +- `[0]` (_bool_) - True if the contract supports the specified interface. + +#### SynthetixSystemSet + +```solidity +event SynthetixSystemSet(address synthetix, address usdTokenAddress, address oracleManager) +``` + +Gets fired when the synthetix is set + +**Parameters** + +- `synthetix` (_address_) - address of the synthetix core contract +- `usdTokenAddress` (_address_) - address of the USDToken contract +- `oracleManager` (_address_) - address of the Oracle Manager contract + +#### SynthImplementationSet + +```solidity +event SynthImplementationSet(address synthImplementation) +``` + +Gets fired when the synth implementation is set + +**Parameters** + +- `synthImplementation` (_address_) - address of the synth implementation + +#### SynthRegistered + +```solidity +event SynthRegistered(uint256 synthMarketId) +``` + +Gets fired when the synth is registered as a market. + +**Parameters** + +- `synthMarketId` (_uint256_) - Id of the synth market that was created + +#### SynthImplementationUpgraded + +```solidity +event SynthImplementationUpgraded(uint256 synthMarketId, address proxy, address implementation) +``` + +Gets fired when the synth's implementation is updated on the corresponding proxy. + +**Parameters** + +- `synthMarketId` (_uint256_) - +- `proxy` (_address_) - the synth proxy servicing the latest implementation +- `implementation` (_address_) - the latest implementation of the synth + +#### SynthPriceDataUpdated + +```solidity +event SynthPriceDataUpdated(uint256 synthMarketId, bytes32 buyFeedId, bytes32 sellFeedId) +``` + +Gets fired when the market's price feeds are updated, compatible with oracle manager + +**Parameters** + +- `synthMarketId` (_uint256_) - +- `buyFeedId` (_bytes32_) - the oracle manager feed id for the buy price +- `sellFeedId` (_bytes32_) - the oracle manager feed id for the sell price + +#### DecayRateUpdated + +```solidity +event DecayRateUpdated(uint128 marketId, uint256 rate) +``` + +Gets fired when the market's price feeds are updated, compatible with oracle manager + +**Parameters** + +- `marketId` (_uint128_) - Id of the synth market +- `rate` (_uint256_) - the new decay rate (1e16 means 1% decay per year) + +#### MarketOwnerNominated + +```solidity +event MarketOwnerNominated(uint128 marketId, address newOwner) +``` + +Emitted when an address has been nominated. + +**Parameters** + +- `marketId` (_uint128_) - id of the market +- `newOwner` (_address_) - The address that has been nominated. + +#### MarketNominationRenounced + +```solidity +event MarketNominationRenounced(uint128 marketId, address nominee) +``` + +Emitted when market nominee renounces nomination. + +**Parameters** + +- `marketId` (_uint128_) - id of the market +- `nominee` (_address_) - The address that has been nominated. + +#### MarketOwnerChanged + +```solidity +event MarketOwnerChanged(uint128 marketId, address oldOwner, address newOwner) +``` + +Emitted when the owner of the market has changed. + +**Parameters** + +- `marketId` (_uint128_) - id of the market +- `oldOwner` (_address_) - The previous owner of the market. +- `newOwner` (_address_) - The new owner of the market. + +### Synth Token Module + +#### setDecayRate + +```solidity +function setDecayRate(uint256 _rate) external +``` + +Updates the decay rate for a year + +**Parameters** + +- `_rate` (_uint256_) - The decay rate with 18 decimals (1e16 means 1% decay per year). + +#### decayRate + +```solidity +function decayRate() external returns (uint256) +``` + +get decay rate for a year + +#### advanceEpoch + +```solidity +function advanceEpoch() external returns (uint256) +``` + +advance epoch manually in order to avoid precision loss + +#### isInitialized + +```solidity +function isInitialized() external returns (bool) +``` + +Returns wether the token has been initialized. + +**Returns** + +- `[0]` (_bool_) - A boolean with the result of the query. + +#### initialize + +```solidity +function initialize(string tokenName, string tokenSymbol, uint8 tokenDecimals) external +``` + +Initializes the token with name, symbol, and decimals. + +#### mint + +```solidity +function mint(address to, uint256 amount) external +``` + +Allows the owner to mint tokens. + +**Parameters** + +- `to` (_address_) - The address to receive the newly minted tokens. +- `amount` (_uint256_) - The amount of tokens to mint. + +#### burn + +```solidity +function burn(address from, uint256 amount) external +``` + +Allows the owner to burn tokens. + +**Parameters** + +- `from` (_address_) - The address whose tokens will be burnt. +- `amount` (_uint256_) - The amount of tokens to burn. + +#### setAllowance + +```solidity +function setAllowance(address from, address spender, uint256 amount) external +``` + +Allows an address that holds tokens to provide allowance to another. + +**Parameters** + +- `from` (_address_) - The address that is providing allowance. +- `spender` (_address_) - The address that is given allowance. +- `amount` (_uint256_) - The amount of allowance being given. + +#### name + +```solidity +function name() external view returns (string) +``` + +Retrieves the name of the token, e.g. "Synthetix Network Token". + +**Returns** + +- `[0]` (_string_) - A string with the name of the token. + +#### symbol + +```solidity +function symbol() external view returns (string) +``` + +Retrieves the symbol of the token, e.g. "SNX". + +**Returns** + +- `[0]` (_string_) - A string with the symbol of the token. + +#### decimals + +```solidity +function decimals() external view returns (uint8) +``` + +Retrieves the number of decimals used by the token. The default is 18. + +**Returns** + +- `[0]` (_uint8_) - The number of decimals. + +#### totalSupply + +```solidity +function totalSupply() external view returns (uint256) +``` + +Returns the total number of tokens in circulation (minted - burnt). + +**Returns** + +- `[0]` (_uint256_) - The total number of tokens. + +#### balanceOf + +```solidity +function balanceOf(address owner) external view returns (uint256) +``` + +Returns the balance of a user. + +**Parameters** + +- `owner` (_address_) - The address whose balance is being retrieved. + +**Returns** + +- `[0]` (_uint256_) - The number of tokens owned by the user. + +#### allowance + +```solidity +function allowance(address owner, address spender) external view returns (uint256) +``` + +Returns how many tokens a user has allowed another user to transfer on its behalf. + +**Parameters** + +- `owner` (_address_) - The user who has given the allowance. +- `spender` (_address_) - The user who was given the allowance. + +**Returns** + +- `[0]` (_uint256_) - The amount of tokens `spender` can transfer on `owner`'s behalf. + +#### transfer + +```solidity +function transfer(address to, uint256 amount) external returns (bool) +``` + +Transfer tokens from one address to another. + +**Parameters** + +- `to` (_address_) - The address that will receive the tokens. +- `amount` (_uint256_) - The amount of tokens to be transferred. + +**Returns** + +- `[0]` (_bool_) - A boolean which is true if the operation succeeded. + +#### approve + +```solidity +function approve(address spender, uint256 amount) external returns (bool) +``` + +Allows users to provide allowance to other users so that they can transfer tokens on their behalf. + +**Parameters** + +- `spender` (_address_) - The address that is receiving the allowance. +- `amount` (_uint256_) - The amount of tokens that are being added to the allowance. + +**Returns** + +- `[0]` (_bool_) - A boolean which is true if the operation succeeded. + +#### increaseAllowance + +```solidity +function increaseAllowance(address spender, uint256 addedValue) external returns (bool) +``` + +Atomically increases the allowance granted to `spender` by the caller. + +This is an alternative to {approve} that can be used as a mitigation for +problems described in {IERC20-approve}. + +Emits an {Approval} event indicating the updated allowance. + +Requirements: + +- `spender` cannot be the zero address. + +#### decreaseAllowance + +```solidity +function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) +``` + +Atomically decreases the allowance granted to `spender` by the caller. + +This is an alternative to {approve} that can be used as a mitigation for +problems described in {IERC20-approve}. + +Emits an {Approval} event indicating the updated allowance. + +Requirements: + +- `spender` cannot be the zero address. +- `spender` must have allowance for the caller of at least + `subtractedValue`. + +#### transferFrom + +```solidity +function transferFrom(address from, address to, uint256 amount) external returns (bool) +``` + +Allows a user who has been given allowance to transfer tokens on another user's behalf. + +**Parameters** + +- `from` (_address_) - The address that owns the tokens that are being transferred. +- `to` (_address_) - The address that will receive the tokens. +- `amount` (_uint256_) - The number of tokens to transfer. + +**Returns** + +- `[0]` (_bool_) - A boolean which is true if the operation succeeded. + +#### Transfer + +```solidity +event Transfer(address from, address to, uint256 amount) +``` + +Emitted when tokens have been transferred. + +**Parameters** + +- `from` (_address_) - The address that originally owned the tokens. +- `to` (_address_) - The address that received the tokens. +- `amount` (_uint256_) - The number of tokens that were transferred. + +#### Approval + +```solidity +event Approval(address owner, address spender, uint256 amount) +``` + +Emitted when a user has provided allowance to another user for transferring tokens on its behalf. + +**Parameters** + +- `owner` (_address_) - The address that is providing the allowance. +- `spender` (_address_) - The address that received the allowance. +- `amount` (_uint256_) - The number of tokens that were added to `spender`'s allowance. + +### Wrapper Module + +#### setWrapper + +```solidity +function setWrapper(uint128 marketId, address wrapCollateralType, uint256 maxWrappableAmount) external +``` + +Used to set the wrapper supply cap for a given market and collateral type. + +If the supply cap is set to 0 or lower than the current outstanding supply, then the wrapper is disabled. +There is a synthetix v3 core system supply cap also set. If the current supply becomes higher than either the core system supply cap or the local market supply cap, wrapping will be disabled. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market to enable wrapping for. +- `wrapCollateralType` (_address_) - The collateral being used to wrap the synth. +- `maxWrappableAmount` (_uint256_) - The maximum amount of collateral that can be wrapped. + +#### wrap + +```solidity +function wrap(uint128 marketId, uint256 wrapAmount, uint256 minAmountReceived) external returns (uint256 amountToMint, struct OrderFees.Data fees) +``` + +Wraps the specified amount and returns similar value of synth minus the fees. + +Fees are collected from the user by way of the contract returning less synth than specified amount of collateral. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market used for the trade. +- `wrapAmount` (_uint256_) - Amount of collateral to wrap. This amount gets deposited into the market collateral manager. +- `minAmountReceived` (_uint256_) - The minimum amount of synths the trader is expected to receive, otherwise the transaction will revert. + +**Returns** + +- `amountToMint` (_uint256_) - Amount of synth returned to user. +- `fees` (_struct OrderFees.Data_) - breakdown of all fees. in this case, only wrapper fees are returned. + +#### unwrap + +```solidity +function unwrap(uint128 marketId, uint256 unwrapAmount, uint256 minAmountReceived) external returns (uint256 returnCollateralAmount, struct OrderFees.Data fees) +``` + +Unwraps the synth and returns similar value of collateral minus the fees. + +Transfers the specified synth, collects fees through configured fee collector, returns collateral minus fees to trader. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market used for the trade. +- `unwrapAmount` (_uint256_) - Amount of synth trader is unwrapping. +- `minAmountReceived` (_uint256_) - The minimum amount of collateral the trader is expected to receive, otherwise the transaction will revert. + +**Returns** + +- `returnCollateralAmount` (_uint256_) - Amount of collateral returned. +- `fees` (_struct OrderFees.Data_) - breakdown of all fees. in this case, only wrapper fees are returned. + +#### WrapperSet + +```solidity +event WrapperSet(uint256 synthMarketId, address wrapCollateralType, uint256 maxWrappableAmount) +``` + +Gets fired when wrapper supply is set for a given market, collateral type. + +**Parameters** + +- `synthMarketId` (_uint256_) - Id of the market the wrapper is initialized for. +- `wrapCollateralType` (_address_) - the collateral used to wrap the synth. +- `maxWrappableAmount` (_uint256_) - the local supply cap for the wrapper. + +#### SynthWrapped + +```solidity +event SynthWrapped(uint256 synthMarketId, uint256 amountWrapped, struct OrderFees.Data fees, uint256 feesCollected) +``` + +Gets fired after user wraps synth + +**Parameters** + +- `synthMarketId` (_uint256_) - Id of the market. +- `amountWrapped` (_uint256_) - amount of synth wrapped. +- `fees` (_struct OrderFees.Data_) - breakdown of all the fees incurred for the transaction. +- `feesCollected` (_uint256_) - fees collected by the configured FeeCollector for the market (rest of the fees are deposited to market manager). + +#### SynthUnwrapped + +```solidity +event SynthUnwrapped(uint256 synthMarketId, uint256 amountUnwrapped, struct OrderFees.Data fees, uint256 feesCollected) +``` + +Gets fired after user unwraps synth + +**Parameters** + +- `synthMarketId` (_uint256_) - Id of the market. +- `amountUnwrapped` (_uint256_) - amount of synth unwrapped. +- `fees` (_struct OrderFees.Data_) - breakdown of all the fees incurred for the transaction. +- `feesCollected` (_uint256_) - fees collected by the configured FeeCollector for the market (rest of the fees are deposited to market manager). + +## Perps Market + +- [Back to TOC](#smart-contracts) + +### Async Order Module + +#### commitOrder + +```solidity +function commitOrder(struct AsyncOrder.OrderCommitmentRequest commitment) external returns (struct AsyncOrder.Data retOrder, uint256 fees) +``` + +Modify the collateral delegated to the account. + +**Parameters** + +- `accountId` (_uint128_) - Id of the account. +- `synthMarketId` (_uint128_) - Id of the synth market used as collateral. Synth market id, 0 for snxUSD. +- `amountDelta` (_int256_) - requested change in amount of collateral delegated to the account. + + Simulates what the order fee would be for the given market with the specified size. + + Note that this does not include the settlement reward fee, which is based on the strategy type used + +**Parameters** + +- `marketId` (_uint128_) - id of the market. +- `sizeDelta` (_int128_) - size of position. + +**Returns** + +- `orderFees` (_uint256_) - incurred fees. +- `fillPrice` (_uint256_) - price at which the order would be filled. + +#### requiredMarginForOrder + +```solidity +function requiredMarginForOrder(uint128 marketId, uint128 accountId, int128 sizeDelta) external view returns (uint256 requiredMargin) +``` + +Gets the account's collateral value for a specific collateral. + +**Parameters** + +- `accountId` (_uint128_) - Id of the account. +- `synthMarketId` (_uint128_) - Id of the synth market used as collateral. Synth market id, 0 for snxUSD. + +**Returns** + +- `[0]` (_uint256_) - collateralValue collateral value of the account. + +### totalCollateralValue + +```solidity +function totalCollateralValue(uint128 accountId) external view returns (uint256) +``` + +Gets the account's total collateral value. + +**Parameters** + +- `accountId` (_uint128_) - Id of the account. + +**Returns** + +- `[0]` (_uint256_) - collateralValue total collateral value of the account. USD denominated. + +### totalAccountOpenInterest + +```solidity +function totalAccountOpenInterest(uint128 accountId) external view returns (uint256) +``` + +Gets the account's total open interest value. + +**Parameters** + +- `accountId` (_uint128_) - Id of the account. + +**Returns** + +- `[0]` (_uint256_) - openInterestValue total open interest value of the account. + +### getOpenPosition + +```solidity +function getOpenPosition(uint128 accountId, uint128 marketId) external view returns (int256 pnl, int256 accruedFunding, int256 size) +``` + +Gets the details of an open position. + +**Parameters** + +- `accountId` (_uint128_) - Id of the account. +- `marketId` (_uint128_) - Id of the position market. + +**Returns** + +- `pnl` (_int256_) - pnl of the position. +- `accruedFunding` (_int256_) - accrued funding of the position. +- `size` (_int256_) - size of the position. + +### getAvailableMargin + +```solidity +function getAvailableMargin(uint128 accountId) external view returns (int256) +``` + +Gets the available margin of an account. It can be negative due to pnl. + +**Parameters** + +- `accountId` (_uint128_) - Id of the account. + +**Returns** + +- `[0]` (_int256_) - availableMargin available margin of the position. + +### CollateralModified + +Useful for integrators to determine if an order will succeed or fail + +Gets fired when an account colateral is modified. + +**Parameters** + +- `accountId` (_uint128_) - Id of the account. +- `synthMarketId` (_uint128_) - Id of the synth market used as collateral. Synth market id, 0 for snxUSD. +- `amountDelta` (_int256_) - requested change in amount of collateral delegated to the account. +- `sender` (_address_) - address of the sender of the size modification. Authorized by account owner. + +## Async Order Module + +**Returns** + +- `requiredMargin` (_uint256_) - margin required for the order to succeed. + + ```solidity + function commitOrder(struct AsyncOrder.OrderCommitmentRequest commitment) external returns (struct AsyncOrder.Data retOrder, uint256 fees) + ``` + + Commit an async order via this function + +**Parameters** + +- `commitment` (_struct AsyncOrder.OrderCommitmentRequest_) - Order commitment data (see AsyncOrder.OrderCommitmentRequest struct). + +**Returns** + +- `retOrder` (_struct AsyncOrder.Data_) - order details (see AsyncOrder.Data struct). +- `fees` (_uint256_) - order fees (protocol + settler) + +### cancelOrder + +```solidity +function cancelOrder(uint128 marketId, uint128 accountId) external +``` + +Cancel an expired order via this function + +**Parameters** + +- `marketId` (_uint128_) - Id of the market used for the trade. +- `accountId` (_uint128_) - Id of the account used for the trade. + +### getOrder + +```solidity +function getOrder(uint128 marketId, uint128 accountId) external returns (struct AsyncOrder.Data order) +``` + +Get async order claim details + +**Parameters** + +- `marketId` (_uint128_) - Id of the market used for the trade. +- `accountId` (_uint128_) - id of the account. + +**Returns** + +- `order` (_struct AsyncOrder.Data_) - async order claim details (see AsyncOrder.Data struct). + +### OrderCommitted + +```solidity +event OrderCommitted(uint128 marketId, uint128 accountId, enum SettlementStrategy.Type orderType, int128 sizeDelta, uint256 acceptablePrice, uint256 settlementTime, uint256 expirationTime, bytes32 trackingCode, address sender) +``` + +Gets fired when a new order is committed. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market used for the trade. +- `accountId` (_uint128_) - Id of the account used for the trade. +- `orderType` (_enum SettlementStrategy.Type_) - Should send 0 (at time of writing) that correlates to the transaction type enum defined in SettlementStrategy.Type. +- `sizeDelta` (_int128_) - requested change in size of the order sent by the user. +- `acceptablePrice` (_uint256_) - maximum or minimum, depending on the sizeDelta direction, accepted price to settle the order, set by the user. +- `settlementTime` (_uint256_) - Time at which the order can be settled. +- `expirationTime` (_uint256_) - Time at which the order expired. +- `trackingCode` (_bytes32_) - Optional code for integrator tracking purposes. +- `sender` (_address_) - address of the sender of the order. Authorized to commit by account owner. + +### OrderCanceled + +```solidity +event PreviousOrderExpired(uint128 marketId, uint128 accountId, int128 sizeDelta, uint256 acceptablePrice, uint256 settlementTime, bytes32 trackingCode) +``` + +Gets fired when a new order is canceled. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market used for the trade. +- `accountId` (_uint128_) - Id of the account used for the trade. +- `settlementTime` (_uint256_) - Time at which the order can be settled. +- `acceptablePrice` (_uint256_) - maximum or minimum, depending on the sizeDelta direction, accepted price to settle the order, set by the user. + +## Async Order Settlement Module + +**Parameters** + +- `marketId` (_uint128_) - Id of the market used for the trade. +- `accountId` (_uint128_) - Id of the account used for the trade. +- `sizeDelta` (_int128_) - requested change in size of the order sent by the user. +- `acceptablePrice` (_uint256_) - maximum or minimum, depending on the sizeDelta direction, accepted price to settle the order, set by the user. +- `settlementTime` (_uint256_) - Time at which the order can be settled. +- `trackingCode` (_bytes32_) - Optional code for integrator tracking purposes. + +### Async Order Settlement Module + +#### settle + +```solidity +function settle(uint128 accountId) external view +``` + +Settles an offchain order. It's expected to revert with the OffchainLookup error with the data needed to perform the offchain lookup. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market used for the trade. +- `accountId` (_uint128_) - Id of the account used for the trade. + +### settlePythOrder + +```solidity +function settlePythOrder(bytes result, bytes extraData) external payable +``` + +Settles an offchain order using the offchain retrieved data from pyth. + +**Parameters** + +- `result` (_bytes_) - the blob of data retrieved offchain. +- `extraData` (_bytes_) - Extra data from OffchainLookupData. + +### OrderSettled + +```solidity +event OrderSettled(uint128 marketId, uint128 accountId, uint256 fillPrice, int128 sizeDelta, int128 newSize, uint256 collectedFees, uint256 settlementReward, bytes32 trackingCode, address settler) +``` + +Gets fired when a new order is settled. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market used for the trade. +- `accountId` (_uint128_) - Id of the account used for the trade. +- `fillPrice` (_uint256_) - Price at which the order was settled. +- `sizeDelta` (_int128_) - Size delta from order. +- `newSize` (_int128_) - New size of the position after settlement. +- `collectedFees` (_uint256_) - Amount of fees collected by the protocol. +- `settlementReward` (_uint256_) - Amount of fees collected by the settler. +- `trackingCode` (_bytes32_) - Optional code for integrator tracking purposes. +- `settler` (_address_) - address of the settler of the order. + +## Collateral Module + +Gets fired when a new order is settled. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market used for the trade. +- `accountId` (_uint128_) - Id of the account used for the trade. +- `fillPrice` (_uint256_) - Price at which the order was settled. +- `pnl` (_int256_) - Pnl of the previous closed position. +- `accruedFunding` (_int256_) - Accrued funding of the previous closed position. +- `sizeDelta` (_int128_) - Size delta from order. +- `newSize` (_int128_) - New size of the position after settlement. +- `totalFees` (_uint256_) - Amount of fees collected by the protocol. +- `referralFees` (_uint256_) - Amount of fees collected by the referrer. +- `collectedFees` (_uint256_) - Amount of fees collected by fee collector. +- `settlementReward` (_uint256_) - Amount of fees collected by the settler. +- `trackingCode` (_bytes32_) - Optional code for integrator tracking purposes. +- `settler` (_address_) - address of the settler of the order. + +### Collateral Module + +#### setMaxCollateralAmount + +```solidity +function setMaxCollateralAmount(uint128 synthMarketId, uint256 collateralAmount) external +``` + +Set the max collateral amoutn via this function + +**Parameters** + +- `synthMarketId` (_uint128_) - Synth market id, 0 for snxUSD. +- `collateralAmount` (_uint256_) - max amount that for the synth + +### MaxCollateralSet + +```solidity +event MaxCollateralSet(uint128 synthMarketId, uint256 collateralAmount) +``` + +Gets fired when max collateral amount for synth collateral for the system is set by owner. + +**Parameters** + +- `synthMarketId` (_uint128_) - Synth market id, 0 for snxUSD. +- `collateralAmount` (_uint256_) - max amount that was set for the synth + +## Global Perps Market Module + +### setMaxCollateralAmount + +```solidity +function setMaxCollateralAmount(uint128 synthMarketId, uint256 collateralAmount) external +``` + +Sets the max collateral amount for a specific synth market. + +**Parameters** + +- `synthMarketId` (_uint128_) - Synth market id, 0 for snxUSD. +- `collateralAmount` (_uint256_) - Max collateral amount to set for the synth market id. + +### getMaxCollateralAmount + +```solidity +function getMaxCollateralAmount(uint128 synthMarketId) external view returns (uint256) +``` + +Gets the max collateral amount for a specific synth market. + +**Parameters** + +- `synthMarketId` (_uint128_) - Synth market id, 0 for snxUSD. + +**Returns** + +- `[0]` (_uint256_) - maxCollateralAmount max collateral amount of the specified synth market id + +### setSynthDeductionPriority + +```solidity +function setSynthDeductionPriority(uint128[] newSynthDeductionPriority) external +``` + +Sets the synth deduction priority ordered list. + +The synth deduction priority is used to determine the order in which synths are deducted from an account. Id 0 is snxUSD and should be first in the list. + +**Parameters** + +- `newSynthDeductionPriority` (_uint128[]_) - Ordered array of synth market ids for deduction priority. + +### getSynthDeductionPriority + +```solidity +function getSynthDeductionPriority() external view returns (uint128[]) +``` + +Gets the synth deduction priority ordered list. + +The synth deduction priority is used to determine the order in which synths are deducted from an account. Id 0 is snxUSD and should be first in the list. + +**Returns** + +- `[0]` (_uint128[]_) - synthDeductionPriority Ordered array of synth market ids for deduction priority. + +### setLiquidationRewardGuards + +```solidity +function setLiquidationRewardGuards(uint256 minLiquidationRewardUsd, uint256 maxLiquidationRewardUsd) external +``` + +Sets the liquidation reward guard (min and max). + +**Parameters** + +- `minLiquidationRewardUsd` (_uint256_) - Minimum liquidation reward expressed as USD value. +- `maxLiquidationRewardUsd` (_uint256_) - Maximum liquidation reward expressed as USD value. + +### getLiquidationRewardGuards + +```solidity +function getLiquidationRewardGuards() external view returns (uint256 minLiquidationRewardUsd, uint256 maxLiquidationRewardUsd) +``` + +Gets the liquidation reward guard (min and max). + +**Returns** + +- `minLiquidationRewardUsd` (_uint256_) - Minimum liquidation reward expressed as USD value. +- `maxLiquidationRewardUsd` (_uint256_) - Maximum liquidation reward expressed as USD value. + +### MaxCollateralAmountSet + +```solidity +event MaxCollateralAmountSet(uint128 synthMarketId, uint256 collateralAmount) +``` + +Gets fired when max collateral amount for synth for all the markets is set by owner. + +**Parameters** + +- `synthMarketId` (_uint128_) - Synth market id, 0 for snxUSD. +- `collateralAmount` (_uint256_) - max amount that was set for the synth + +### SynthDeductionPrioritySet + +```solidity +event SynthDeductionPrioritySet(uint128[] newSynthDeductionPriority) +``` + +Gets fired when the synth deduction priority is updated by owner. + +**Parameters** + +- `newSynthDeductionPriority` (_uint128[]_) - new synth id priority order for deductions. + +### LiquidationRewardGuardsSet + +```solidity +event LiquidationRewardGuardsSet(uint256 minLiquidationRewardUsd, uint256 maxLiquidationRewardUsd) +``` + +Gets fired when liquidation reward guard is set or updated. + +**Parameters** + +- `minLiquidationRewardUsd` (_uint256_) - Minimum liquidation reward expressed as USD value. +- `maxLiquidationRewardUsd` (_uint256_) - Maximum liquidation reward expressed as USD value. + +**Parameters** + +- `minLiquidationRewardUsd` (_uint256_) - Minimum liquidation reward expressed as USD value. +- `maxLiquidationRewardUsd` (_uint256_) - Maximum liquidation reward expressed as USD value. + +#### FeeCollectorSet + +```solidity +event FeeCollectorSet(address feeCollector) +``` + +emitted when custom fee collector is set + +**Parameters** + +- `feeCollector` (_address_) - the address of the fee collector to set. + +#### ReferrerShareUpdated + +```solidity +event ReferrerShareUpdated(address referrer, uint256 shareRatioD18) +``` + +Emitted when the share percentage for a referrer address has been updated. + +**Parameters** + +- `referrer` (_address_) - The address of the referrer +- `shareRatioD18` (_uint256_) - The new share ratio for the referrer + +### Liquidation Module + +#### liquidate + +```solidity +function liquidate(uint128 accountId) external +``` + +Liquidates an account. + +according to the current situation and account size it can be a partial or full liquidation. + +**Parameters** + +- `accountId` (_uint128_) - Id of the account to liquidate. + +#### liquidateFlagged + +```solidity +function liquidateFlagged() external +``` + +Liquidates all flagged accounts. + +#### PositionLiquidated + +```solidity +event PositionLiquidated(uint128 accountId, uint128 marketId, uint256 amountLiquidated, int128 currentPositionSize) +``` + +Gets fired when an account position is liquidated . + +**Parameters** + +- `accountId` (_uint128_) - Id of the account liquidated. +- `marketId` (_uint128_) - Id of the position's market. +- `amountLiquidated` (_uint256_) - amount liquidated. +- `currentPositionSize` (_int128_) - position size after liquidation. + +#### AccountLiquidated + +```solidity +event AccountLiquidated(uint128 accountId, uint256 reward, bool fullLiquidation) +``` + +Gets fired when an account is liquidated. + +this event is fired once per liquidation tx after the each position that can be liquidated at the time was liquidated. + +**Parameters** + +- `accountId` (_uint128_) - Id of the account liquidated. +- `reward` (_uint256_) - total reward sent to liquidator. +- `fullLiquidation` (_bool_) - flag indicating if it was a partial or full liquidation. + +### Market Configuration Module + +#### addSettlementStrategy + +```solidity +function addSettlementStrategy(uint128 marketId, struct SettlementStrategy.Data strategy) external returns (uint256 strategyId) +``` + +Add a new settlement strategy with this function. + +**Parameters** + +- `marketId` (_uint128_) - id of the market to add the settlement strategy. +- `strategy` (_struct SettlementStrategy.Data_) - strategy details (see SettlementStrategy.Data struct). + +**Returns** + +- `strategyId` (_uint256_) - id of the new settlement strategy. + +### setOrderFees + +```solidity +function setOrderFees(uint128 marketId, uint256 makerFeeRatio, uint256 takerFeeRatio) external +``` + +Set order fees for a market with this function. + +**Parameters** + +- `marketId` (_uint128_) - id of the market to set order fees. +- `makerFeeRatio` (_uint256_) - the maker fee ratio. +- `takerFeeRatio` (_uint256_) - the taker fee ratio. + +### setFundingParameters + +```solidity +function setFundingParameters(uint128 marketId, uint256 skewScale, uint256 maxFundingVelocity) external +``` + +Set funding parameters for a market with this function. + +**Parameters** + +- `marketId` (_uint128_) - id of the market to set funding parameters. +- `skewScale` (_uint256_) - the skew scale. +- `maxFundingVelocity` (_uint256_) - the max funding velocity. + +### setLiquidationParameters + +```solidity +function setLiquidationParameters(uint128 marketId, uint256 initialMarginRatioD18, uint256 minimumInitialMarginRatioD18, uint256 maintenanceMarginScalarD18, uint256 liquidationRewardRatioD18, uint256 maxLiquidationLimitAccumulationMultiplier, uint256 maxSecondsInLiquidationWindow, uint256 minimumPositionMargin) external +``` + +Set liquidation parameters for a market with this function. + +**Parameters** + +- `marketId` (_uint128_) - id of the market to set liquidation parameters. +- `initialMarginRatioD18` (_uint256_) - the initial margin ratio (as decimal with 18 digits precision). +- `maintenanceMarginRatioD18` (_uint256_) - the maintenance margin ratio (as decimal with 18 digits precision). +- `liquidationRewardRatioD18` (_uint256_) - the liquidation reward ratio (as decimal with 18 digits precision). +- `maxLiquidationLimitAccumulationMultiplier` (_uint256_) - the max liquidation limit accumulation multiplier. +- `maxSecondsInLiquidationWindow` (_uint256_) - the max seconds in liquidation window (used together with the acc multiplier to get max liquidation per window). +- `minimumPositionMargin` (_uint256_) - the minimum position margin. + +### setMaxMarketSize + +```solidity +function setMaxMarketSize(uint128 marketId, uint256 maxMarketSize) external +``` + +Set the max size of an specific market with this function. + +This controls the maximum open interest a market can have on either side (Long | Short). So the total Open Interest (with zero skew) for a market can be up to max market size \* 2. + +**Parameters** + +- `marketId` (_uint128_) - id of the market to set the max market value. +- `maxMarketSize` (_uint256_) - the max market size in market asset units. + +### setLockedOiRatio + +```solidity +function setLockedOiRatio(uint128 marketId, uint256 lockedOiRatioD18) external +``` + +Set the locked OI Ratio for a market with this function. + +**Parameters** + +- `marketId` (_uint128_) - id of the market to set locked OI ratio. +- `lockedOiRatioD18` (_uint256_) - the locked OI ratio skew scale (as decimal with 18 digits precision). + +### setSettlementStrategyEnabled + +```solidity +function setSettlementStrategyEnabled(uint128 marketId, uint256 strategyId, bool enabled) external +``` + +Enable or disable a settlement strategy for a market with this function. + +**Parameters** + +- `marketId` (_uint128_) - id of the market. +- `strategyId` (_uint256_) - the specific strategy. +- `enabled` (_bool_) - whether the strategy is enabled or disabled. + +### getSettlementStrategy + +```solidity +function getSettlementStrategy(uint128 marketId, uint256 strategyId) external view returns (struct SettlementStrategy.Data settlementStrategy) +``` + +Gets the settlement strategy details. + +**Parameters** + +- `marketId` (_uint128_) - id of the market. +- `strategyId` (_uint256_) - id of the settlement strategy. + +**Returns** + +- `settlementStrategy` (_struct SettlementStrategy.Data_) - strategy details (see SettlementStrategy.Data struct). + +### getLiquidationParameters + +```solidity +function getLiquidationParameters(uint128 marketId) external view returns (uint256 initialMarginRatioD18, uint256 minimumInitialMarginRatioD18, uint256 maintenanceMarginScalarD18, uint256 liquidationRewardRatioD18, uint256 maxLiquidationLimitAccumulationMultiplier, uint256 maxSecondsInLiquidationWindow, uint256 minimumPositionMargin) +``` + +Gets liquidation parameters details of a market. + +**Parameters** + +- `marketId` (_uint128_) - id of the market. + +**Returns** + +- `initialMarginRatioD18` (_uint256_) - the initial margin ratio (as decimal with 18 digits precision). +- `maintenanceMarginRatioD18` (_uint256_) - the maintenance margin ratio (as decimal with 18 digits precision). +- `liquidationRewardRatioD18` (_uint256_) - the liquidation reward ratio (as decimal with 18 digits precision). +- `maxLiquidationLimitAccumulationMultiplier` (_uint256_) - the max liquidation limit accumulation multiplier. +- `maxSecondsInLiquidationWindow` (_uint256_) - the max seconds in liquidation window (used together with the acc multiplier to get max liquidation per window). + +### getFundingParameters + +```solidity +function getFundingParameters(uint128 marketId) external view returns (uint256 skewScale, uint256 maxFundingVelocity) +``` + +Gets funding parameters of a market. + +**Parameters** + +- `marketId` (_uint128_) - id of the market. + +**Returns** + +- `skewScale` (_uint256_) - the skew scale. +- `maxFundingVelocity` (_uint256_) - the max funding velocity. + +### getMaxMarketSize + +```solidity +function getMaxMarketSize(uint128 marketId) external view returns (uint256 maxMarketSize) +``` + +Gets the max size of an specific market. + +**Parameters** + +- `marketId` (_uint128_) - id of the market. + +**Returns** + +- `maxMarketSize` (_uint256_) - the max market size in market asset units. + +### getOrderFees + +```solidity +function getOrderFees(uint128 marketId) external view returns (uint256 makerFeeRatio, uint256 takerFeeRatio) +``` + +Gets the order fees of a market. + +**Parameters** + +- `marketId` (_uint128_) - id of the market. + +**Returns** + +- `makerFeeRatio` (_uint256_) - the maker fee ratio. +- `takerFeeRatio` (_uint256_) - the taker fee ratio. + +### getLockedOiRatioD18 + +```solidity +function getLockedOiRatio(uint128 marketId) external view returns (uint256 lockedOiRatioD18) +``` + +Gets the locked OI ratio of a market. + +**Parameters** + +- `marketId` (_uint128_) - id of the market. + +**Returns** + +- `lockedOiRatioD18` (_uint256_) - the locked OI ratio skew scale (as decimal with 18 digits precision). + +### SettlementStrategyAdded + +```solidity +event SettlementStrategyAdded(uint128 marketId, struct SettlementStrategy.Data strategy, uint256 strategyId) +``` + +Gets fired when new settlement strategy is added. + +**Parameters** + +- `marketId` (_uint128_) - adds settlement strategy to this specific market. +- `strategy` (_struct SettlementStrategy.Data_) - the strategy configuration. +- `strategyId` (_uint256_) - the newly created settlement strategy id. + +#### MarketPriceDataUpdated + +```solidity +event MarketPriceDataUpdated(uint128 marketId, bytes32 feedId) +``` + +Gets fired when feed id for perps market is updated. + +**Parameters** + +- `marketId` (_uint128_) - id of perps market +- `feedId` (_bytes32_) - oracle node id + +#### OrderFeesSet + +```solidity +event OrderFeesSet(uint128 marketId, uint256 makerFeeRatio, uint256 takerFeeRatio) +``` + +Gets fired when order fees are updated. + +**Parameters** + +- `marketId` (_uint128_) - udpates fees to this specific market. +- `makerFeeRatio` (_uint256_) - the maker fee ratio. +- `takerFeeRatio` (_uint256_) - the taker fee ratio. + +### FundingParametersSet + +```solidity +event FundingParametersSet(uint128 marketId, uint256 skewScale, uint256 maxFundingVelocity) +``` + +Gets fired when funding parameters are updated. + +**Parameters** + +- `marketId` (_uint128_) - udpates funding parameters to this specific market. +- `skewScale` (_uint256_) - the skew scale. +- `maxFundingVelocity` (_uint256_) - the max funding velocity. + +### LiquidationParametersSet + +```solidity +event LiquidationParametersSet(uint128 marketId, uint256 initialMarginRatioD18, uint256 maintenanceMarginRatioD18, uint256 minimumInitialMarginRatioD18, uint256 liquidationRewardRatioD18, uint256 maxLiquidationLimitAccumulationMultiplier, uint256 maxSecondsInLiquidationWindow, uint256 minimumPositionMargin) +``` + +Gets fired when liquidation parameters are updated. + +**Parameters** + +- `marketId` (_uint128_) - udpates funding parameters to this specific market. +- `initialMarginRatioD18` (_uint256_) - the initial margin ratio (as decimal with 18 digits precision). +- `maintenanceMarginRatioD18` (_uint256_) - the maintenance margin ratio (as decimal with 18 digits precision). +- `liquidationRewardRatioD18` (_uint256_) - the liquidation reward ratio (as decimal with 18 digits precision). +- `maxLiquidationLimitAccumulationMultiplier` (_uint256_) - the max liquidation limit accumulation multiplier. +- `maxSecondsInLiquidationWindow` (_uint256_) - the max seconds in liquidation window (used together with the acc multiplier to get max liquidation per window). +- `minimumPositionMargin` (_uint256_) - the minimum position margin. + +### MaxMarketSizeSet + +```solidity +event MaxMarketSizeSet(uint128 marketId, uint256 maxMarketSize) +``` + +Gets fired when max market value is updated. + +**Parameters** + +- `marketId` (_uint128_) - udpates funding parameters to this specific market. +- `maxMarketSize` (_uint256_) - the max market value. + +### LockedOiRatioD18Set + +```solidity +event LockedOiRatioSet(uint128 marketId, uint256 lockedOiRatioD18) +``` + +Gets fired when locked oi ratio is updated. + +**Parameters** + +- `marketId` (_uint128_) - udpates funding parameters to this specific market. +- `lockedOiRatioD18` (_uint256_) - the locked OI ratio skew scale (as decimal with 18 digits precision). + +### SettlementStrategyEnabled + +```solidity +event SettlementStrategyEnabled(uint128 marketId, uint256 strategyId, bool enabled) +``` + +Gets fired when a settlement strategy is enabled or disabled. + +**Parameters** + +- `marketId` (_uint128_) - udpates funding parameters to this specific market. +- `strategyId` (_uint256_) - the specific strategy. +- `enabled` (_bool_) - whether the strategy is enabled or disabled. + +## IMarketEvents + +**Parameters** + +- `marketId` (_uint128_) - udpates funding parameters to this specific market. +- `strategyId` (_uint256_) - the specific strategy. +- `enabled` (_bool_) - whether the strategy is enabled or disabled. + +### IMarketEvents + +#### MarketUpdated + +```solidity +event MarketUpdated(uint128 marketId, uint256 price, int256 skew, uint256 size, int256 sizeDelta, int256 currentFundingRate, int256 currentFundingVelocity) +``` + +Gets fired when the size of a market is updated by new orders or liquidations. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market used for the trade. +- `price` (_uint256_) - Price at the time of this event. +- `skew` (_int256_) - Market skew at the time of the trade. Positive values mean more longs. +- `size` (_uint256_) - Size of the entire market after settlement. +- `sizeDelta` (_int256_) - Change in market size during this update. +- `currentFundingRate` (_int256_) - The current funding rate of this market (0.001 = 0.1% per day) +- `currentFundingVelocity` (_int256_) - The current rate of change of the funding rate (0.001 = +0.1% per day) + +### Perps Account Module + +#### modifyCollateral + +```solidity +function modifyCollateral(uint128 accountId, uint128 synthMarketId, int256 amountDelta) external +``` + +Modify the collateral delegated to the account. + +**Parameters** + +- `accountId` (_uint128_) - Id of the account. +- `synthMarketId` (_uint128_) - Id of the synth market used as collateral. Synth market id, 0 for snxUSD. +- `amountDelta` (_int256_) - requested change in amount of collateral delegated to the account. + +#### getCollateralAmount + +```solidity +function getCollateralAmount(uint128 accountId, uint128 synthMarketId) external view returns (uint256) +``` + +Gets the account's collateral value for a specific collateral. + +**Parameters** + +- `accountId` (_uint128_) - Id of the account. +- `synthMarketId` (_uint128_) - Id of the synth market used as collateral. Synth market id, 0 for snxUSD. + +**Returns** + +- `[0]` (_uint256_) - collateralValue collateral value of the account. + +#### totalCollateralValue + +```solidity +function totalCollateralValue(uint128 accountId) external view returns (uint256) +``` + +Gets the account's total collateral value. + +**Parameters** + +- `accountId` (_uint128_) - Id of the account. + +**Returns** + +- `[0]` (_uint256_) - collateralValue total collateral value of the account. USD denominated. + +#### totalAccountOpenInterest + +```solidity +function totalAccountOpenInterest(uint128 accountId) external view returns (uint256) +``` + +Gets the account's total open interest value. + +**Parameters** + +- `accountId` (_uint128_) - Id of the account. + +**Returns** + +- `[0]` (_uint256_) - openInterestValue total open interest value of the account. + +#### getOpenPosition + +```solidity +function getOpenPosition(uint128 accountId, uint128 marketId) external view returns (int256 totalPnl, int256 accruedFunding, int128 positionSize) +``` + +Gets the details of an open position. + +**Parameters** + +- `accountId` (_uint128_) - Id of the account. +- `marketId` (_uint128_) - Id of the position market. + +**Returns** + +- `totalPnl` (_int256_) - pnl of the entire position including funding. +- `accruedFunding` (_int256_) - accrued funding of the position. +- `positionSize` (_int128_) - size of the position. + +#### getAvailableMargin + +```solidity +function getAvailableMargin(uint128 accountId) external view returns (int256 availableMargin) +``` + +Gets the available margin of an account. It can be negative due to pnl. + +**Parameters** + +- `accountId` (_uint128_) - Id of the account. + +**Returns** + +- `availableMargin` (_int256_) - available margin of the position. + +#### getWithdrawableMargin + +```solidity +function getWithdrawableMargin(uint128 accountId) external view returns (int256 withdrawableMargin) +``` + +Gets the exact withdrawable amount a trader has available from this account while holding the account's current positions. + +**Parameters** + +- `accountId` (_uint128_) - Id of the account. + +**Returns** + +- `withdrawableMargin` (_int256_) - available margin to withdraw. + +#### getRequiredMargins + +```solidity +function getRequiredMargins(uint128 accountId) external view returns (uint256 requiredInitialMargin, uint256 requiredMaintenanceMargin, uint256 totalAccumulatedLiquidationRewards, uint256 maxLiquidationReward) +``` + +Gets the initial/maintenance margins across all positions that an account has open. + +**Parameters** + +- `accountId` (_uint128_) - Id of the account. + +**Returns** + +- `requiredInitialMargin` (_uint256_) - initial margin req (used when withdrawing collateral). +- `requiredMaintenanceMargin` (_uint256_) - maintenance margin req (used to determine liquidation threshold). +- `totalAccumulatedLiquidationRewards` (_uint256_) - sum of all liquidation rewards of if all account open positions were to be liquidated fully. +- `maxLiquidationReward` (_uint256_) - max liquidation reward the keeper would receive if account was fully liquidated. Note here that the accumulated rewards are checked against the global max/min configured liquidation rewards. + +#### CollateralModified + +```solidity +event CollateralModified(uint128 accountId, uint128 synthMarketId, int256 amountDelta, address sender) +``` + +Gets fired when an account colateral is modified. + +**Parameters** + +- `accountId` (_uint128_) - Id of the account. +- `synthMarketId` (_uint128_) - Id of the synth market used as collateral. Synth market id, 0 for snxUSD. +- `amountDelta` (_int256_) - requested change in amount of collateral delegated to the account. +- `sender` (_address_) - address of the sender of the size modification. Authorized by account owner. + +### Perps Market Factory Module + +#### initializeFactory + +```solidity +function initializeFactory() external returns (uint128) +``` + +Initializes the factory. + +this function should be called only once. + +**Returns** + +- `[0]` (_uint128_) - globalPerpsMarketId Id of the global perps market id. + +#### setSynthetix + +```solidity +function setSynthetix(contract ISynthetixSystem synthetix) external +``` + +Sets the synthetix system. + +**Parameters** + +- `synthetix` (_contract ISynthetixSystem_) - address of the main synthetix proxy. + +#### setSpotMarket + +```solidity +function setSpotMarket(contract ISpotMarketSystem spotMarket) external +``` + +Sets the spot market system. + +**Parameters** + +- `spotMarket` (_contract ISpotMarketSystem_) - address of the spot market proxy. + +#### createMarket + +```solidity +function createMarket(uint128 requestedMarketId, string marketName, string marketSymbol) external returns (uint128) +``` + +Creates a new market. + +**Parameters** + +- `requestedMarketId` (_uint128_) - id of the market to create. +- `marketName` (_string_) - name of the market to create. +- `marketSymbol` (_string_) - symbol of the market to create. + +**Returns** + +- `[0]` (_uint128_) - perpsMarketId Id of the created perps market. + +#### name + +```solidity +function name(uint128 marketId) external view returns (string) +``` + +returns a human-readable name for a given market + +#### reportedDebt + +```solidity +function reportedDebt(uint128 marketId) external view returns (uint256) +``` + +returns amount of USD that the market would try to mint if everything was withdrawn + +#### minimumCredit + +```solidity +function minimumCredit(uint128 marketId) external view returns (uint256) +``` + +prevents reduction of available credit capacity by specifying this amount, for which withdrawals will be disallowed + +#### supportsInterface + +```solidity +function supportsInterface(bytes4 interfaceID) external view returns (bool) +``` + +Determines if the contract in question supports the specified interface. + +**Parameters** + +- `interfaceID` (_bytes4_) - XOR of all selectors in the contract. + +**Returns** + +- `[0]` (_bool_) - True if the contract supports the specified interface. + +#### FactoryInitialized + +```solidity +event FactoryInitialized(uint128 globalPerpsMarketId) +``` + +Gets fired when the factory is initialized. + +**Parameters** + +- `globalPerpsMarketId` (_uint128_) - the new global perps market id. + +#### MarketCreated + +```solidity +event MarketCreated(uint128 perpsMarketId, string marketName, string marketSymbol) +``` + +Gets fired when a market is created. + +**Parameters** + +- `perpsMarketId` (_uint128_) - the newly created perps market id. +- `marketName` (_string_) - the newly created perps market name. +- `marketSymbol` (_string_) - the newly created perps market symbol. + +### Perps Market Module + +#### metadata + +```solidity +function metadata(uint128 marketId) external view returns (string name, string symbol) +``` + +Gets a market metadata. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market. + +**Returns** + +- `name` (_string_) - Name of the market. +- `symbol` (_string_) - Symbol of the market. + +#### skew + +```solidity +function skew(uint128 marketId) external view returns (int256) +``` + +Gets a market's skew. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market. + +**Returns** + +- `[0]` (_int256_) - skew Skew of the market. + +#### size + +```solidity +function size(uint128 marketId) external view returns (uint256) +``` + +Gets a market's size. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market. + +**Returns** + +- `[0]` (_uint256_) - size Size of the market. + +#### maxOpenInterest + +```solidity +function maxOpenInterest(uint128 marketId) external view returns (uint256) +``` + +Gets a market's max open interest. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market. + +**Returns** + +- `[0]` (_uint256_) - maxOpenInterest Max open interest of the market. + +#### currentFundingRate + +```solidity +function currentFundingRate(uint128 marketId) external view returns (int256) +``` + +Gets a market's current funding rate. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market. + +**Returns** + +- `[0]` (_int256_) - currentFundingRate Current funding rate of the market. + +#### currentFundingVelocity + +```solidity +function currentFundingVelocity(uint128 marketId) external view returns (int256) +``` + +Gets a market's current funding velocity. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market. + +**Returns** + +- `[0]` (_int256_) - currentFundingVelocity Current funding velocity of the market. + +#### indexPrice + +```solidity +function indexPrice(uint128 marketId) external view returns (uint256) +``` + +Gets a market's index price. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market. + +**Returns** + +- `[0]` (_uint256_) - indexPrice Index price of the market. + +#### fillPrice + +```solidity +function fillPrice(uint128 marketId, int128 orderSize, uint256 price) external returns (uint256) +``` + +Gets a market's fill price for a specific order size and index price. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market. +- `orderSize` (_int128_) - Order size. +- `price` (_uint256_) - Index price. + +**Returns** + +- `[0]` (_uint256_) - price Fill price. + +#### getMarketSummary + +```solidity +function getMarketSummary(uint128 marketId) external view returns (struct IPerpsMarketModule.MarketSummary summary) +``` + +Given a marketId return a market's summary details in one call. + +**Parameters** + +- `marketId` (_uint128_) - Id of the market. + +**Returns** + +- `summary` (_struct IPerpsMarketModule.MarketSummary_) - Market summary (see MarketSummary). + +## Governance + +- [Back to TOC](#smart-contracts) + +### Council Token Module + +#### isInitialized + +```solidity +function isInitialized() external returns (bool) +``` + +Returns whether the token has been initialized. + +**Returns** + +- `[0]` (_bool_) - A boolean with the result of the query. + +#### initialize + +```solidity +function initialize(string tokenName, string tokenSymbol, string uri) external +``` + +Initializes the token with name, symbol, and uri. + +#### mint + +```solidity +function mint(address to, uint256 tokenId) external +``` + +Allows the owner to mint tokens. + +**Parameters** + +- `to` (_address_) - The address to receive the newly minted tokens. +- `tokenId` (_uint256_) - The ID of the newly minted token + +#### safeMint + +```solidity +function safeMint(address to, uint256 tokenId, bytes data) external +``` + +Allows the owner to mint tokens. Verifies that the receiver can receive the token + +**Parameters** + +- `to` (_address_) - The address to receive the newly minted token. +- `tokenId` (_uint256_) - The ID of the newly minted token +- `data` (_bytes_) - any data which should be sent to the receiver + +#### burn + +```solidity +function burn(uint256 tokenId) external +``` + +Allows the owner to burn tokens. + +**Parameters** + +- `tokenId` (_uint256_) - The token to burn + +#### setAllowance + +```solidity +function setAllowance(uint256 tokenId, address spender) external +``` + +Allows an address that holds tokens to provide allowance to another. + +**Parameters** + +- `tokenId` (_uint256_) - The token which should be allowed to spender +- `spender` (_address_) - The address that is given allowance. + +#### setBaseTokenURI + +```solidity +function setBaseTokenURI(string uri) external +``` + +Allows the owner to update the base token URI. + +**Parameters** + +- `uri` (_string_) - The new base token uri + +#### totalSupply + +```solidity +function totalSupply() external view returns (uint256) +``` + +Returns the total amount of tokens stored by the contract. + +#### tokenOfOwnerByIndex + +```solidity +function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256) +``` + +Returns a token ID owned by `owner` at a given `index` of its token list. +Use along with {balanceOf} to enumerate all of `owner`'s tokens. + +Requirements: + +- `owner` must be a valid address +- `index` must be less than the balance of the tokens for the owner + +#### tokenByIndex + +```solidity +function tokenByIndex(uint256 index) external view returns (uint256) +``` + +Returns a token ID at a given `index` of all the tokens stored by the contract. +Use along with {totalSupply} to enumerate all tokens. + +Requirements: + +- `index` must be less than the total supply of the tokens + +#### balanceOf + +```solidity +function balanceOf(address holder) external view returns (uint256 balance) +``` + +Returns the number of tokens in `owner`'s account. + +Requirements: + +- `holder` must be a valid address + +#### ownerOf + +```solidity +function ownerOf(uint256 tokenId) external view returns (address owner) +``` + +Returns the owner of the `tokenId` token. + +Requirements: + +- `tokenId` must exist. + +#### safeTransferFrom + +```solidity +function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) external +``` + +Safely transfers `tokenId` token from `from` to `to`. + +Requirements: + +- `from` cannot be the zero address. +- `to` cannot be the zero address. +- `tokenId` token must exist and be owned by `from`. +- If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. +- If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. + +Emits a {Transfer} event. + +#### safeTransferFrom + +```solidity +function safeTransferFrom(address from, address to, uint256 tokenId) external +``` + +Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients +are aware of the ERC721 protocol to prevent tokens from being forever locked. + +Requirements: + +- `from` cannot be the zero address. +- `to` cannot be the zero address. +- `tokenId` token must exist and be owned by `from`. +- If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. +- If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. + +Emits a {Transfer} event. + +#### transferFrom + +```solidity +function transferFrom(address from, address to, uint256 tokenId) external +``` + +Transfers `tokenId` token from `from` to `to`. + +WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. + +Requirements: + +- `from` cannot be the zero address. +- `to` cannot be the zero address. +- `tokenId` token must be owned by `from`. +- If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. + +Emits a {Transfer} event. + +#### approve + +```solidity +function approve(address to, uint256 tokenId) external +``` + +Gives permission to `to` to transfer `tokenId` token to another account. +The approval is cleared when the token is transferred. + +Only a single account can be approved at a time, so approving the zero address clears previous approvals. + +Requirements: + +- The caller must own the token or be an approved operator. +- `tokenId` must exist. + +Emits an {Approval} event. + +#### setApprovalForAll + +```solidity +function setApprovalForAll(address operator, bool approved) external +``` + +Approve or remove `operator` as an operator for the caller. +Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. + +Requirements: + +- The `operator` cannot be the caller. + +Emits an {ApprovalForAll} event. + +#### getApproved + +```solidity +function getApproved(uint256 tokenId) external view returns (address operator) +``` + +Returns the account approved for `tokenId` token. + +Requirements: + +- `tokenId` must exist. + +#### isApprovedForAll + +```solidity +function isApprovedForAll(address owner, address operator) external view returns (bool) +``` + +Returns if the `operator` is allowed to manage all of the assets of `owner`. + +See {setApprovalForAll} + +#### Transfer + +```solidity +event Transfer(address from, address to, uint256 tokenId) +``` + +Emitted when `tokenId` token is transferred from `from` to `to`. + +#### Approval + +```solidity +event Approval(address owner, address approved, uint256 tokenId) +``` + +Emitted when `owner` enables `approved` to manage the `tokenId` token. + +#### ApprovalForAll + +```solidity +event ApprovalForAll(address owner, address operator, bool approved) +``` + +Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. + +### IDebtShare + +#### balanceOfOnPeriod + +```solidity +function balanceOfOnPeriod(address account, uint256 periodId) external view returns (uint256) +``` + +### Election Inspector Module + +#### getEpochStartDateForIndex + +```solidity +function getEpochStartDateForIndex(uint256 epochIndex) external view returns (uint64) +``` + +Returns the date in which the given epoch started + +#### getEpochEndDateForIndex + +```solidity +function getEpochEndDateForIndex(uint256 epochIndex) external view returns (uint64) +``` + +Returns the date in which the given epoch ended + +#### getNominationPeriodStartDateForIndex + +```solidity +function getNominationPeriodStartDateForIndex(uint256 epochIndex) external view returns (uint64) +``` + +Returns the date in which the Nomination period in the given epoch started + +#### getVotingPeriodStartDateForIndex + +```solidity +function getVotingPeriodStartDateForIndex(uint256 epochIndex) external view returns (uint64) +``` + +Returns the date in which the Voting period in the given epoch started + +#### wasNominated + +```solidity +function wasNominated(address candidate, uint256 epochIndex) external view returns (bool) +``` + +Shows if a candidate was nominated in the given epoch + +#### getNomineesAtEpoch + +```solidity +function getNomineesAtEpoch(uint256 epochIndex) external view returns (address[]) +``` + +Returns a list of all nominated candidates in the given epoch + +#### getBallotVotedAtEpoch + +```solidity +function getBallotVotedAtEpoch(address user, uint256 epochIndex) external view returns (bytes32) +``` + +Returns the ballot id that user voted on in the given election + +#### hasVotedInEpoch + +```solidity +function hasVotedInEpoch(address user, uint256 epochIndex) external view returns (bool) +``` + +Returns if user has voted in the given election + +#### getBallotVotesInEpoch + +```solidity +function getBallotVotesInEpoch(bytes32 ballotId, uint256 epochIndex) external view returns (uint256) +``` + +Returns the number of votes given to a particular ballot in a given epoch + +#### getBallotCandidatesInEpoch + +```solidity +function getBallotCandidatesInEpoch(bytes32 ballotId, uint256 epochIndex) external view returns (address[]) +``` + +Returns the list of candidates that a particular ballot has in a given epoch + +#### getCandidateVotesInEpoch + +```solidity +function getCandidateVotesInEpoch(address candidate, uint256 epochIndex) external view returns (uint256) +``` + +Returns the number of votes a candidate received in a given epoch + +#### getElectionWinnersInEpoch + +```solidity +function getElectionWinnersInEpoch(uint256 epochIndex) external view returns (address[]) +``` + +Returns the winners of the given election + +### Election Module + +#### initOrUpgradeElectionModule + +```solidity +function initOrUpgradeElectionModule(address[] firstCouncil, uint8 minimumActiveMembers, uint64 nominationPeriodStartDate, uint64 votingPeriodStartDate, uint64 epochEndDate) external +``` + +Initializes the module and immediately starts the first epoch + +#### isElectionModuleInitialized + +```solidity +function isElectionModuleInitialized() external view returns (bool) +``` + +Shows whether the module has been initialized + +#### tweakEpochSchedule + +```solidity +function tweakEpochSchedule(uint64 newNominationPeriodStartDate, uint64 newVotingPeriodStartDate, uint64 newEpochEndDate) external +``` + +Adjusts the current epoch schedule requiring that the current period remains Administration, and that changes are small (see setMaxDateAdjustmentTolerance) + +#### modifyEpochSchedule + +```solidity +function modifyEpochSchedule(uint64 newNominationPeriodStartDate, uint64 newVotingPeriodStartDate, uint64 newEpochEndDate) external +``` + +Adjusts the current epoch schedule requiring that the current period remains Administration + +#### setMinEpochDurations + +```solidity +function setMinEpochDurations(uint64 newMinNominationPeriodDuration, uint64 newMinVotingPeriodDuration, uint64 newMinEpochDuration) external +``` + +Determines minimum values for epoch schedule adjustments + +#### setMaxDateAdjustmentTolerance + +```solidity +function setMaxDateAdjustmentTolerance(uint64 newMaxDateAdjustmentTolerance) external +``` + +Determines adjustment size for tweakEpochSchedule + +#### setDefaultBallotEvaluationBatchSize + +```solidity +function setDefaultBallotEvaluationBatchSize(uint256 newDefaultBallotEvaluationBatchSize) external +``` + +Determines batch size when evaluate() is called with numBallots = 0 + +#### setNextEpochSeatCount + +```solidity +function setNextEpochSeatCount(uint8 newSeatCount) external +``` + +Determines the number of council members in the next epoch + +#### setMinimumActiveMembers + +```solidity +function setMinimumActiveMembers(uint8 newMinimumActiveMembers) external +``` + +Determines the minimum number of council members before triggering an emergency election + +#### dismissMembers + +```solidity +function dismissMembers(address[] members) external +``` + +Allows the owner to remove one or more council members, triggering an election if a threshold is met + +#### nominate + +```solidity +function nominate() external +``` + +Allows anyone to self-nominate during the Nomination period + +#### withdrawNomination + +```solidity +function withdrawNomination() external +``` + +Self-withdrawal of nominations during the Nomination period + +#### cast + +```solidity +function cast(address[] candidates) external +``` + +Allows anyone with vote power to vote on nominated candidates during the Voting period + +#### withdrawVote + +```solidity +function withdrawVote() external +``` + +Allows votes to be withdraw + +#### evaluate + +```solidity +function evaluate(uint256 numBallots) external +``` + +Processes ballots in batches during the Evaluation period (after epochEndDate) + +#### resolve + +```solidity +function resolve() external +``` + +Shuffles NFTs and resolves an election after it has been evaluated + +#### getMinEpochDurations + +```solidity +function getMinEpochDurations() external view returns (uint64 minNominationPeriodDuration, uint64 minVotingPeriodDuration, uint64 minEpochDuration) +``` + +Exposes minimum durations required when adjusting epoch schedules + +#### getMaxDateAdjustmenTolerance + +```solidity +function getMaxDateAdjustmenTolerance() external view returns (uint64) +``` + +Exposes maximum size of adjustments when calling tweakEpochSchedule + +#### getDefaultBallotEvaluationBatchSize + +```solidity +function getDefaultBallotEvaluationBatchSize() external view returns (uint256) +``` + +Shows the default batch size when calling evaluate() with numBallots = 0 + +#### getNextEpochSeatCount + +```solidity +function getNextEpochSeatCount() external view returns (uint8) +``` + +Shows the number of council members that the next epoch will have + +#### getMinimumActiveMembers + +```solidity +function getMinimumActiveMembers() external view returns (uint8) +``` + +Returns the minimum active members that the council needs to avoid an emergency election + +#### getEpochIndex + +```solidity +function getEpochIndex() external view returns (uint256) +``` + +Returns the index of the current epoch. The first epoch's index is 1 + +#### getEpochStartDate + +```solidity +function getEpochStartDate() external view returns (uint64) +``` + +Returns the date in which the current epoch started + +#### getEpochEndDate + +```solidity +function getEpochEndDate() external view returns (uint64) +``` + +Returns the date in which the current epoch will end + +#### getNominationPeriodStartDate + +```solidity +function getNominationPeriodStartDate() external view returns (uint64) +``` + +Returns the date in which the Nomination period in the current epoch will start + +#### getVotingPeriodStartDate + +```solidity +function getVotingPeriodStartDate() external view returns (uint64) +``` + +Returns the date in which the Voting period in the current epoch will start + +#### getCurrentPeriod + +```solidity +function getCurrentPeriod() external view returns (uint256) +``` + +Returns the current period type: Administration, Nomination, Voting, Evaluation + +#### isNominated + +```solidity +function isNominated(address candidate) external view returns (bool) +``` + +Shows if a candidate has been nominated in the current epoch + +#### getNominees + +```solidity +function getNominees() external view returns (address[]) +``` + +Returns a list of all nominated candidates in the current epoch + +#### calculateBallotId + +```solidity +function calculateBallotId(address[] candidates) external pure returns (bytes32) +``` + +Hashes a list of candidates (used for identifying and storing ballots) + +#### getBallotVoted + +```solidity +function getBallotVoted(address user) external view returns (bytes32) +``` + +Returns the ballot id that user voted on in the current election + +#### hasVoted + +```solidity +function hasVoted(address user) external view returns (bool) +``` + +Returns if user has voted in the current election + +#### getVotePower + +```solidity +function getVotePower(address user) external view returns (uint256) +``` + +Returns the vote power of user in the current election + +#### getBallotVotes + +```solidity +function getBallotVotes(bytes32 ballotId) external view returns (uint256) +``` + +Returns the number of votes given to a particular ballot + +#### getBallotCandidates + +```solidity +function getBallotCandidates(bytes32 ballotId) external view returns (address[]) +``` + +Returns the list of candidates that a particular ballot has + +#### isElectionEvaluated + +```solidity +function isElectionEvaluated() external view returns (bool) +``` + +Returns whether all ballots in the current election have been counted + +#### getCandidateVotes + +```solidity +function getCandidateVotes(address candidate) external view returns (uint256) +``` + +Returns the number of votes a candidate received. Requires the election to be partially or totally evaluated + +#### getElectionWinners + +```solidity +function getElectionWinners() external view returns (address[]) +``` + +Returns the winners of the current election. Requires the election to be partially or totally evaluated + +#### getCouncilToken + +```solidity +function getCouncilToken() external view returns (address) +``` + +Returns the address of the council NFT token + +#### getCouncilMembers + +```solidity +function getCouncilMembers() external view returns (address[]) +``` + +Returns the current NFT token holders + +### Synthetix Election Module + +#### initOrUpgradeElectionModule + +```solidity +function initOrUpgradeElectionModule(address[] firstCouncil, uint8 minimumActiveMembers, uint64 nominationPeriodStartDate, uint64 votingPeriodStartDate, uint64 epochEndDate, address debtShareContract) external +``` + +Initializes the module and immediately starts the first epoch + +#### setDebtShareContract + +```solidity +function setDebtShareContract(address newDebtShareContractAddress) external +``` + +Sets the Synthetix v2 DebtShare contract that determines vote power + +#### getDebtShareContract + +```solidity +function getDebtShareContract() external view returns (address) +``` + +Returns the Synthetix v2 DebtShare contract that determines vote power + +#### setDebtShareSnapshotId + +```solidity +function setDebtShareSnapshotId(uint256 snapshotId) external +``` + +Sets the Synthetix v2 DebtShare snapshot that determines vote power for this epoch + +#### getDebtShareSnapshotId + +```solidity +function getDebtShareSnapshotId() external view returns (uint256) +``` + +Returns the Synthetix v2 DebtShare snapshot id set for this epoch + +#### getDebtShare + +```solidity +function getDebtShare(address user) external view returns (uint256) +``` + +Returns the Synthetix v2 debt share for the provided address, at this epoch's snapshot + +#### setCrossChainDebtShareMerkleRoot + +```solidity +function setCrossChainDebtShareMerkleRoot(bytes32 merkleRoot, uint256 blocknumber) external +``` + +Allows the system owner to declare a merkle root for user debt shares on other chains for this epoch + +#### getCrossChainDebtShareMerkleRoot + +```solidity +function getCrossChainDebtShareMerkleRoot() external view returns (bytes32) +``` + +Returns the current epoch's merkle root for user debt shares on other chains + +#### getCrossChainDebtShareMerkleRootBlockNumber + +```solidity +function getCrossChainDebtShareMerkleRootBlockNumber() external view returns (uint256) +``` + +Returns the current epoch's merkle root block number + +#### declareCrossChainDebtShare + +```solidity +function declareCrossChainDebtShare(address account, uint256 debtShare, bytes32[] merkleProof) external +``` + +Allows users to declare their Synthetix v2 debt shares on other chains + +#### getDeclaredCrossChainDebtShare + +```solidity +function getDeclaredCrossChainDebtShare(address account) external view returns (uint256) +``` + +Returns the Synthetix v2 debt shares for the provided address, at this epoch's snapshot, in other chains + +#### declareAndCast + +```solidity +function declareAndCast(uint256 debtShare, bytes32[] merkleProof, address[] candidates) external +``` + +Declares cross chain debt shares and casts a vote + +#### initOrUpgradeElectionModule + +```solidity +function initOrUpgradeElectionModule(address[] firstCouncil, uint8 minimumActiveMembers, uint64 nominationPeriodStartDate, uint64 votingPeriodStartDate, uint64 epochEndDate) external +``` + +Initializes the module and immediately starts the first epoch + +#### isElectionModuleInitialized + +```solidity +function isElectionModuleInitialized() external view returns (bool) +``` + +Shows whether the module has been initialized + +#### tweakEpochSchedule + +```solidity +function tweakEpochSchedule(uint64 newNominationPeriodStartDate, uint64 newVotingPeriodStartDate, uint64 newEpochEndDate) external +``` + +Adjusts the current epoch schedule requiring that the current period remains Administration, and that changes are small (see setMaxDateAdjustmentTolerance) + +#### modifyEpochSchedule + +```solidity +function modifyEpochSchedule(uint64 newNominationPeriodStartDate, uint64 newVotingPeriodStartDate, uint64 newEpochEndDate) external +``` + +Adjusts the current epoch schedule requiring that the current period remains Administration + +#### setMinEpochDurations + +```solidity +function setMinEpochDurations(uint64 newMinNominationPeriodDuration, uint64 newMinVotingPeriodDuration, uint64 newMinEpochDuration) external +``` + +Determines minimum values for epoch schedule adjustments + +#### setMaxDateAdjustmentTolerance + +```solidity +function setMaxDateAdjustmentTolerance(uint64 newMaxDateAdjustmentTolerance) external +``` + +Determines adjustment size for tweakEpochSchedule + +#### setDefaultBallotEvaluationBatchSize + +```solidity +function setDefaultBallotEvaluationBatchSize(uint256 newDefaultBallotEvaluationBatchSize) external +``` + +Determines batch size when evaluate() is called with numBallots = 0 + +#### setNextEpochSeatCount + +```solidity +function setNextEpochSeatCount(uint8 newSeatCount) external +``` + +Determines the number of council members in the next epoch + +#### setMinimumActiveMembers + +```solidity +function setMinimumActiveMembers(uint8 newMinimumActiveMembers) external +``` + +Determines the minimum number of council members before triggering an emergency election + +#### dismissMembers + +```solidity +function dismissMembers(address[] members) external +``` + +Allows the owner to remove one or more council members, triggering an election if a threshold is met + +#### nominate + +```solidity +function nominate() external +``` + +Allows anyone to self-nominate during the Nomination period + +#### withdrawNomination + +```solidity +function withdrawNomination() external +``` + +Self-withdrawal of nominations during the Nomination period + +#### cast + +```solidity +function cast(address[] candidates) external +``` + +Allows anyone with vote power to vote on nominated candidates during the Voting period + +#### withdrawVote + +```solidity +function withdrawVote() external +``` + +Allows votes to be withdraw + +#### evaluate + +```solidity +function evaluate(uint256 numBallots) external +``` + +Processes ballots in batches during the Evaluation period (after epochEndDate) + +#### resolve + +```solidity +function resolve() external +``` + +Shuffles NFTs and resolves an election after it has been evaluated + +#### getMinEpochDurations + +```solidity +function getMinEpochDurations() external view returns (uint64 minNominationPeriodDuration, uint64 minVotingPeriodDuration, uint64 minEpochDuration) +``` + +Exposes minimum durations required when adjusting epoch schedules + +#### getMaxDateAdjustmenTolerance + +```solidity +function getMaxDateAdjustmenTolerance() external view returns (uint64) +``` + +Exposes maximum size of adjustments when calling tweakEpochSchedule + +#### getDefaultBallotEvaluationBatchSize + +```solidity +function getDefaultBallotEvaluationBatchSize() external view returns (uint256) +``` + +Shows the default batch size when calling evaluate() with numBallots = 0 + +#### getNextEpochSeatCount + +```solidity +function getNextEpochSeatCount() external view returns (uint8) +``` + +Shows the number of council members that the next epoch will have + +#### getMinimumActiveMembers + +```solidity +function getMinimumActiveMembers() external view returns (uint8) +``` + +Returns the minimum active members that the council needs to avoid an emergency election + +#### getEpochIndex + +```solidity +function getEpochIndex() external view returns (uint256) +``` + +Returns the index of the current epoch. The first epoch's index is 1 + +#### getEpochStartDate + +```solidity +function getEpochStartDate() external view returns (uint64) +``` + +Returns the date in which the current epoch started + +#### getEpochEndDate + +```solidity +function getEpochEndDate() external view returns (uint64) +``` + +Returns the date in which the current epoch will end + +#### getNominationPeriodStartDate + +```solidity +function getNominationPeriodStartDate() external view returns (uint64) +``` + +Returns the date in which the Nomination period in the current epoch will start + +#### getVotingPeriodStartDate + +```solidity +function getVotingPeriodStartDate() external view returns (uint64) +``` + +Returns the date in which the Voting period in the current epoch will start + +#### getCurrentPeriod + +```solidity +function getCurrentPeriod() external view returns (uint256) +``` + +Returns the current period type: Administration, Nomination, Voting, Evaluation + +#### isNominated + +```solidity +function isNominated(address candidate) external view returns (bool) +``` + +Shows if a candidate has been nominated in the current epoch + +#### getNominees + +```solidity +function getNominees() external view returns (address[]) +``` + +Returns a list of all nominated candidates in the current epoch + +#### calculateBallotId + +```solidity +function calculateBallotId(address[] candidates) external pure returns (bytes32) +``` + +Hashes a list of candidates (used for identifying and storing ballots) + +#### getBallotVoted + +```solidity +function getBallotVoted(address user) external view returns (bytes32) +``` + +Returns the ballot id that user voted on in the current election + +#### hasVoted + +```solidity +function hasVoted(address user) external view returns (bool) +``` + +Returns if user has voted in the current election + +#### getVotePower + +```solidity +function getVotePower(address user) external view returns (uint256) +``` + +Returns the vote power of user in the current election + +#### getBallotVotes + +```solidity +function getBallotVotes(bytes32 ballotId) external view returns (uint256) +``` + +Returns the number of votes given to a particular ballot + +#### getBallotCandidates + +```solidity +function getBallotCandidates(bytes32 ballotId) external view returns (address[]) +``` + +Returns the list of candidates that a particular ballot has + +#### isElectionEvaluated + +```solidity +function isElectionEvaluated() external view returns (bool) +``` + +Returns whether all ballots in the current election have been counted + +#### getCandidateVotes + +```solidity +function getCandidateVotes(address candidate) external view returns (uint256) +``` + +Returns the number of votes a candidate received. Requires the election to be partially or totally evaluated + +#### getElectionWinners + +```solidity +function getElectionWinners() external view returns (address[]) +``` + +Returns the winners of the current election. Requires the election to be partially or totally evaluated + +#### getCouncilToken + +```solidity +function getCouncilToken() external view returns (address) +``` + +Returns the address of the council NFT token + +#### getCouncilMembers + +```solidity +function getCouncilMembers() external view returns (address[]) +``` + +Returns the current NFT token holders + +## Oracle Manager + +- [Back to TOC](#smart-contracts) + +### Node Module + +#### registerNode + +```solidity +function registerNode(enum NodeDefinition.NodeType nodeType, bytes parameters, bytes32[] parents) external returns (bytes32 nodeId) +``` + +Registers a node + +**Parameters** + +- `nodeType` (_enum NodeDefinition.NodeType_) - The nodeType assigned to this node. +- `parameters` (_bytes_) - The parameters assigned to this node. +- `parents` (_bytes32[]_) - The parents assigned to this node. + +**Returns** + +- `nodeId` (_bytes32_) - The id of the registered node. + +#### getNodeId + +```solidity +function getNodeId(enum NodeDefinition.NodeType nodeType, bytes parameters, bytes32[] parents) external returns (bytes32 nodeId) +``` + +Returns the ID of a node, whether or not it has been registered. + +**Parameters** + +- `nodeType` (_enum NodeDefinition.NodeType_) - The nodeType assigned to this node. +- `parameters` (_bytes_) - The parameters assigned to this node. +- `parents` (_bytes32[]_) - The parents assigned to this node. + +**Returns** + +- `nodeId` (_bytes32_) - The id of the node. + +#### getNode + +```solidity +function getNode(bytes32 nodeId) external pure returns (struct NodeDefinition.Data node) +``` + +Returns a node's definition (type, parameters, and parents) + +**Parameters** + +- `nodeId` (_bytes32_) - The node ID + +**Returns** + +- `node` (_struct NodeDefinition.Data_) - The node's definition data + +#### process + +```solidity +function process(bytes32 nodeId) external view returns (struct NodeOutput.Data node) +``` + +Returns a node current output data + +**Parameters** + +- `nodeId` (_bytes32_) - The node ID + +**Returns** + +- `node` (_struct NodeOutput.Data_) - The node's output data + +#### NodeRegistered + +```solidity +event NodeRegistered(bytes32 nodeId, enum NodeDefinition.NodeType nodeType, bytes parameters, bytes32[] parents) +``` + +Emitted when `registerNode` is called. + +**Parameters** + +- `nodeId` (_bytes32_) - The id of the registered node. +- `nodeType` (_enum NodeDefinition.NodeType_) - The nodeType assigned to this node. +- `parameters` (_bytes_) - The parameters assigned to this node. +- `parents` (_bytes32[]_) - The parents assigned to this node. + +### ChainlinkNode + +#### process + +```solidity +function process(bytes parameters) internal view returns (struct NodeOutput.Data nodeOutput) +``` + +#### getTwapPrice + +```solidity +function getTwapPrice(contract IAggregatorV3Interface chainlink, uint80 latestRoundId, int256 latestPrice, uint256 twapTimeInterval) internal view returns (int256 price) +``` + +#### isValid + +```solidity +function isValid(struct NodeDefinition.Data nodeDefinition) internal view returns (bool valid) +``` + +### ConstantNode + +#### process + +```solidity +function process(bytes parameters) internal view returns (struct NodeOutput.Data nodeOutput) +``` + +#### isValid + +```solidity +function isValid(struct NodeDefinition.Data nodeDefinition) internal pure returns (bool valid) +``` + +### ExternalNode + +#### process + +```solidity +function process(struct NodeOutput.Data[] prices, bytes parameters) internal view returns (struct NodeOutput.Data nodeOutput) +``` + +#### isValid + +```solidity +function isValid(struct NodeDefinition.Data nodeDefinition) internal returns (bool valid) +``` + +### PriceDeviationCircuitBreakerNode + +#### process + +```solidity +function process(struct NodeOutput.Data[] parentNodeOutputs, bytes parameters) internal pure returns (struct NodeOutput.Data nodeOutput) +``` + +#### abs + +```solidity +function abs(int256 x) private pure returns (int256 result) +``` + +#### isValid + +```solidity +function isValid(struct NodeDefinition.Data nodeDefinition) internal pure returns (bool valid) +``` + +### PythNode + +#### process + +```solidity +function process(bytes parameters) internal view returns (struct NodeOutput.Data nodeOutput) +``` + +#### isValid + +```solidity +function isValid(struct NodeDefinition.Data nodeDefinition) internal view returns (bool valid) +``` + +### ReducerNode + +#### process + +```solidity +function process(struct NodeOutput.Data[] parentNodeOutputs, bytes parameters) internal pure returns (struct NodeOutput.Data nodeOutput) +``` + +#### median + +```solidity +function median(struct NodeOutput.Data[] parentNodeOutputs) internal pure returns (struct NodeOutput.Data medianPrice) +``` + +#### mean + +```solidity +function mean(struct NodeOutput.Data[] parentNodeOutputs) internal pure returns (struct NodeOutput.Data meanPrice) +``` + +#### recent + +```solidity +function recent(struct NodeOutput.Data[] parentNodeOutputs) internal pure returns (struct NodeOutput.Data recentPrice) +``` + +#### max + +```solidity +function max(struct NodeOutput.Data[] parentNodeOutputs) internal pure returns (struct NodeOutput.Data maxPrice) +``` + +#### min + +```solidity +function min(struct NodeOutput.Data[] parentNodeOutputs) internal pure returns (struct NodeOutput.Data minPrice) +``` + +#### mul + +```solidity +function mul(struct NodeOutput.Data[] parentNodeOutputs) internal pure returns (struct NodeOutput.Data mulPrice) +``` + +#### div + +```solidity +function div(struct NodeOutput.Data[] parentNodeOutputs) internal pure returns (struct NodeOutput.Data divPrice) +``` + +#### quickSort + +```solidity +function quickSort(struct NodeOutput.Data[] arr, int256 left, int256 right) internal pure +``` + +#### isValid + +```solidity +function isValid(struct NodeDefinition.Data nodeDefinition) internal pure returns (bool valid) +``` + +### StalenessCircuitBreakerNode + +#### process + +```solidity +function process(struct NodeOutput.Data[] parentNodeOutputs, bytes parameters) internal view returns (struct NodeOutput.Data nodeOutput) +``` + +#### isValid + +```solidity +function isValid(struct NodeDefinition.Data nodeDefinition) internal pure returns (bool valid) +``` + +### UniswapNode + +#### process + +```solidity +function process(bytes parameters) internal view returns (struct NodeOutput.Data nodeOutput) +``` + +#### getQuoteAtTick + +```solidity +function getQuoteAtTick(int24 tick, uint256 baseAmount, address baseToken, address quoteToken) internal pure returns (uint256 quoteAmount) +``` + +#### isValid + +```solidity +function isValid(struct NodeDefinition.Data nodeDefinition) internal view returns (bool valid) +``` diff --git a/markets/legacy-market/cannonfile.toml b/markets/legacy-market/cannonfile.toml index 115e8736ce..dcf03d58fd 100644 --- a/markets/legacy-market/cannonfile.toml +++ b/markets/legacy-market/cannonfile.toml @@ -15,7 +15,7 @@ defaultValue = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266" defaultValue = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266" [setting.v2x_package] -defaultValue = "synthetix:2.89.1" +defaultValue = "synthetix:2.94.1" [setting.v3_package] defaultValue = "synthetix:<%= package.version %>" @@ -34,22 +34,17 @@ source = "<%= settings.oracle_package %>" [contract.InitialModuleBundle] artifact = "InitialModuleBundle" - args = [] [contract.InitialProxy] artifact = "Proxy" - args = ["<%= contracts.InitialModuleBundle.address %>", "<%= settings.owner %>"] abiOf = ["InitialModuleBundle"] -depends = ["contract.InitialModuleBundle"] - # deploy the legacy market [contract.Market] artifact = "LegacyMarket" from = "<%= settings.owner %>" -depends = ["import.v2x", "import.v3"] [invoke.upgradeProxy] target = ["InitialProxy"] @@ -57,53 +52,54 @@ abi = "UpgradeModule" from = "<%= settings.owner %>" func = "upgradeTo" args = ["<%= contracts.Market.address %>"] - factory.Proxy.abiOf = ["Market"] factory.Proxy.event = "Upgraded" factory.Proxy.arg = 0 -depends = ["contract.InitialProxy", "contract.Market"] - [invoke.setSystemAddresses] target = ["Proxy"] from = "<%= settings.owner %>" func = "setSystemAddresses" - args = [ "<%= imports.v2x.contracts.AddressResolver.address %>", "<%= imports.v3.contracts.CoreProxy.address %>" ] -depends = ["invoke.upgradeProxy"] - # add pool owner to pool feature flag allow list [invoke.setFeatureFlagPool] target = ["v3.CoreProxy"] func = "addToFeatureFlagAllowlist" -args = ["0x637265617465506f6f6c00000000000000000000000000000000000000000000", "<%= settings.pool_owner %>"] # formatBytes32String("createPool") +args = [ + "0x637265617465506f6f6c00000000000000000000000000000000000000000000", + "<%= settings.pool_owner %>" +] # formatBytes32String("createPool") fromCall.func = "owner" -depends = ["import.v3"] [invoke.setFeatureFlagMarket] target = ["v3.CoreProxy"] func = "addToFeatureFlagAllowlist" -args = ["0x72656769737465724d61726b6574000000000000000000000000000000000000", "<%= contracts.Proxy.address %>"] # formatBytes32String("registerMarket") +args = [ + "0x72656769737465724d61726b6574000000000000000000000000000000000000", + "<%= contracts.Proxy.address %>" +] # formatBytes32String("registerMarket") fromCall.func = "owner" -depends = ["invoke.upgradeProxy"] [invoke.setFeatureFlagAssociateDebt] target = ["v3.CoreProxy"] func = "addToFeatureFlagAllowlist" -args = ["0x6173736f63696174654465627400000000000000000000000000000000000000", "<%= contracts.Proxy.address %>"] # formatBytes32String("associateDebt") +args = [ + "0x6173736f63696174654465627400000000000000000000000000000000000000", + "<%= contracts.Proxy.address %>" +] # formatBytes32String("associateDebt") fromCall.func = "owner" -depends = ["invoke.upgradeProxy"] [invoke.registerMarket] target = ["Proxy"] from = "<%= settings.owner %>" func = "registerMarket" args = [] - +extra.marketId.event = "MarketRegistered" +extra.marketId.arg = 1 depends = ["invoke.setFeatureFlagMarket", "invoke.setSystemAddresses"] [invoke.registerOracleManager] @@ -114,24 +110,17 @@ args = [ "<%= defaultAbiCoder.encode(['address', 'uint256', 'uint8'], [imports.fakeOracle.contracts.MockV3Aggregator.address, 0, 18]) %>", [] ] - extra.snx_oracle_id.event = "NodeRegistered" extra.snx_oracle_id.arg = 0 -depends = ["import.v3", "import.fakeOracle"] - [invoke.configureSnxCollateral] target = ["v3.CoreProxy"] func = "configureCollateral" - args = [ { tokenAddress = "<%= imports.v2x.contracts.ProxySynthetix.address %>", oracleNodeId = "<%= extras.snx_oracle_id %>", issuanceRatioD18 = "3000000000000000000", liquidationRatioD18 = "2000000000000000000", liquidationRewardD18 = "1000000000000000000", minDelegationD18 = "1000000000000000000", depositingEnabled = true } ] - fromCall.func = "owner" -depends = ["import.v2x", "invoke.registerOracleManager"] - # set up on v2x [invoke.associate] target = ["v2x.AddressResolver"] @@ -142,27 +131,20 @@ args = [ ["<%= contracts.Proxy.address %>"] #["0x7dA35c7eE680A1e81eFCb2e9edD0c8D039D5211e"] ] - fromCall.func = "owner" -depends = ["invoke.upgradeProxy"] - [invoke.authorizedBroker] target = ["v2x.SynthetixDebtShare"] func = "addAuthorizedBroker" args = ["<%= contracts.Proxy.address %>"] - fromCall.func = "owner" -depends = ["invoke.upgradeProxy"] - # create spartan council pool [invoke.createPool] target = ["v3.CoreProxy"] from = "<%= settings.pool_owner %>" func = "createPool" args = ["<%= settings.sc_pool_id %>", "<%= settings.pool_owner %>"] - depends = ["invoke.setFeatureFlagPool"] [invoke.configurePool] @@ -172,17 +154,14 @@ from = "<%= settings.pool_owner %>" args = [ "<%= settings.sc_pool_id %>", [ - { marketId = "1", weightD18 = "1", maxDebtShareValueD18 = "1000000000000000000" }, + { marketId = "<%= extras.marketId %>", weightD18 = "1", maxDebtShareValueD18 = "1000000000000000000" }, ] ] - -depends = ["invoke.createPool", "invoke.registerMarket"] +depends = ["invoke.createPool"] [invoke.preferPool] target = ["v3.CoreProxy"] func = "setPreferredPool" args = ["<%= settings.sc_pool_id %>"] - fromCall.func = "owner" - depends = ["invoke.createPool"] diff --git a/markets/legacy-market/contracts/LegacyMarket.sol b/markets/legacy-market/contracts/LegacyMarket.sol index f52334c5f8..5e517b93b2 100644 --- a/markets/legacy-market/contracts/LegacyMarket.sol +++ b/markets/legacy-market/contracts/LegacyMarket.sol @@ -33,6 +33,13 @@ contract LegacyMarket is ILegacyMarket, Ownable, UUPSImplementation, IMarket { IAddressResolver public v2xResolver; IV3CoreProxy public v3System; + // redefine event so it can be catched by ethers + event MarketRegistered( + address indexed marketAddress, + uint128 indexed marketId, + address indexed sender + ); + error MarketAlreadyRegistered(uint256 existingMarketId); error NothingToMigrate(); error InsufficientCollateralMigrated(uint256 amountRequested, uint256 amountAvailable); diff --git a/markets/legacy-market/package.json b/markets/legacy-market/package.json index 508bfed5c1..eea8bdf840 100644 --- a/markets/legacy-market/package.json +++ b/markets/legacy-market/package.json @@ -1,6 +1,6 @@ { "name": "@synthetixio/legacy-market", - "version": "3.1.1", + "version": "3.3.4", "description": "Contract for migration from v2x to v3", "private": true, "scripts": { @@ -20,15 +20,9 @@ "@synthetixio/common-config": "workspace:*", "@synthetixio/core-utils": "workspace:*", "@synthetixio/docgen": "workspace:*", - "@synthetixio/router": "^3.1.3", "@synthetixio/wei": "2.74.4", "ethers": "^5.7.2", - "hardhat": "2.15.0", + "hardhat": "2.17.2", "solidity-docgen": "0.6.0-beta.35" - }, - "depcheck": { - "ignoreMatches": [ - "@synthetixio/router" - ] } } diff --git a/markets/perps-market/cannonfile.test.toml b/markets/perps-market/cannonfile.test.toml index 6d46f40238..3be63428f6 100644 --- a/markets/perps-market/cannonfile.test.toml +++ b/markets/perps-market/cannonfile.test.toml @@ -54,7 +54,6 @@ artifact = "contracts/Proxy.sol:Proxy" args = ["<%= contracts.CoreModule.address %>", "<%= settings.owner %>"] abiOf = ["CoreModule"] salt = "<%= settings.salt %>" -depends = ["contract.CoreModule"] [contract.GlobalPerpsMarketModule] artifact = "GlobalPerpsMarketModule" @@ -62,32 +61,19 @@ artifact = "GlobalPerpsMarketModule" # Core [router.PerpsMarketRouter] contracts = [ - "synthetix.AccountModule", - "synthetix.MulticallModule", - "synthetix.AssociatedSystemsModule", - "CoreModule", - "PerpsMarketFactoryModule", - "PerpsAccountModule", - "PerpsMarketModule", - "AsyncOrderModule", - "AsyncOrderSettlementModule", - "FeatureFlagModule", - "LiquidationModule", - "MarketConfigurationModule", - "GlobalPerpsMarketModule" -] -depends = [ - "import.synthetix", - "contract.CoreModule", - "contract.PerpsMarketFactoryModule", - "contract.AsyncOrderModule", - "contract.AsyncOrderSettlementModule", - "contract.PerpsAccountModule", - "contract.PerpsMarketModule", - "contract.FeatureFlagModule", - "contract.LiquidationModule", - "contract.MarketConfigurationModule", - "contract.GlobalPerpsMarketModule" + "synthetix.AccountModule", + "synthetix.MulticallModule", + "synthetix.AssociatedSystemsModule", + "CoreModule", + "PerpsMarketFactoryModule", + "PerpsAccountModule", + "PerpsMarketModule", + "AsyncOrderModule", + "AsyncOrderSettlementModule", + "FeatureFlagModule", + "LiquidationModule", + "MarketConfigurationModule", + "GlobalPerpsMarketModule" ] [invoke.upgrade_proxy] @@ -98,40 +84,31 @@ args = ["<%= contracts.PerpsMarketRouter.address %>"] factory.PerpsMarketProxy.abiOf = ["PerpsMarketRouter"] factory.PerpsMarketProxy.event = "Upgraded" factory.PerpsMarketProxy.arg = 0 -depends = ["contract.InitialProxy", "router.PerpsMarketRouter"] [invoke.setSynthetix] target = ["PerpsMarketProxy"] from = "<%= settings.coreProxyOwner %>" func = "setSynthetix" -args = [ - "<%= imports.synthetix.contracts.CoreProxy.address %>", -] -depends = ["invoke.upgrade_proxy"] +args = ["<%= imports.synthetix.contracts.CoreProxy.address %>"] [invoke.setSpotMarket] target = ["PerpsMarketProxy"] from = "<%= settings.coreProxyOwner %>" func = "setSpotMarket" -args = [ - "<%= imports.spotMarket.contracts.SpotMarketProxy.address %>", -] -depends = ["invoke.upgrade_proxy", "import.spotMarket"] +args = ["<%= imports.spotMarket.contracts.SpotMarketProxy.address %>"] [invoke.init_account] target = ["PerpsMarketProxy"] from = "<%= settings.owner %>" func = "initOrUpgradeNft" args = [ - "<%= formatBytes32String('accountNft') %>", - "Perpetual Futures Account", - "snxPerpsAcct", - "", - "<%= imports.synthetix.contracts.AccountRouter.address %>" -] -depends = [ - "invoke.upgrade_proxy" + "<%= formatBytes32String('accountNft') %>", + "Perpetual Futures Account", + "snxPerpsAcct", + "", + "<%= imports.synthetix.contracts.AccountRouter.address %>" ] +depends = ["invoke.upgrade_proxy"] factory.AccountProxy.abiOf = ["synthetix.AccountRouter"] factory.AccountProxy.event = "AssociatedSystemSet" factory.AccountProxy.arg = 2 @@ -141,15 +118,16 @@ factory.AccountProxy.arg = 2 target = ["synthetix.CoreProxy"] func = "addToFeatureFlagAllowlist" from = "<%= settings.coreProxyOwner %>" -args = ["<%= formatBytes32String('registerMarket') %>", "<%= contracts.PerpsMarketProxy.address %>"] -depends = ['invoke.upgrade_proxy'] +args = [ + "<%= formatBytes32String('registerMarket') %>", + "<%= contracts.PerpsMarketProxy.address %>" +] [invoke.addCreateMarketToFeatureFlag] target = ["PerpsMarketProxy"] func = "addToFeatureFlagAllowlist" from = "<%= settings.owner %>" args = ["<%= formatBytes32String('createMarket') %>", "<%= settings.owner %>"] -depends = ['invoke.setSynthetix'] # add snxUSD as the only priority to deduct from on a given account, as default [invoke.setSynthDeductionPriority] @@ -157,7 +135,6 @@ target = ["PerpsMarketProxy"] func = "setSynthDeductionPriority" from = "<%= settings.owner %>" args = [[0]] -depends = ['invoke.upgrade_proxy'] [contract.MockPyth] artifact = "contracts/mocks/MockPyth.sol:MockPyth" diff --git a/markets/perps-market/cannonfile.toml b/markets/perps-market/cannonfile.toml index 19e5a06062..a3c97ec7a8 100644 --- a/markets/perps-market/cannonfile.toml +++ b/markets/perps-market/cannonfile.toml @@ -20,7 +20,7 @@ defaultValue = "main" defaultValue = "synthetix-spot-market:<%= package.version %>" [setting.salt] -defaultValue = 'snax' +defaultValue = "snax" [import.synthetix] source = "<%= settings.synthetixPackage %>" @@ -61,7 +61,6 @@ artifact = "contracts/Proxy.sol:Proxy" args = ["<%= contracts.CoreModule.address %>", "<%= settings.owner %>"] abiOf = ["CoreModule"] salt = "<%= settings.salt %>" -depends = ["contract.CoreModule"] [contract.GlobalPerpsMarketModule] artifact = "GlobalPerpsMarketModule" @@ -69,31 +68,19 @@ artifact = "GlobalPerpsMarketModule" # Core [router.PerpsMarketRouter] contracts = [ - "synthetix.AccountModule", - "synthetix.AssociatedSystemsModule", - "CoreModule", - "PerpsMarketFactoryModule", - "PerpsAccountModule", - "PerpsMarketModule", - "AsyncOrderModule", - "AsyncOrderSettlementModule", - "FeatureFlagModule", - "LiquidationModule", - "MarketConfigurationModule", - "GlobalPerpsMarketModule" -] -depends = [ - "import.synthetix", - "contract.CoreModule", - "contract.PerpsMarketFactoryModule", - "contract.AsyncOrderModule", - "contract.AsyncOrderSettlementModule", - "contract.PerpsAccountModule", - "contract.PerpsMarketModule", - "contract.FeatureFlagModule", - "contract.LiquidationModule", - "contract.MarketConfigurationModule", - "contract.GlobalPerpsMarketModule" + "synthetix.AccountModule", + "synthetix.AssociatedSystemsModule", + "synthetix.MulticallModule", + "CoreModule", + "PerpsMarketFactoryModule", + "PerpsAccountModule", + "PerpsMarketModule", + "AsyncOrderModule", + "AsyncOrderSettlementModule", + "FeatureFlagModule", + "LiquidationModule", + "MarketConfigurationModule", + "GlobalPerpsMarketModule" ] [invoke.upgrade_proxy] @@ -104,40 +91,31 @@ args = ["<%= contracts.PerpsMarketRouter.address %>"] factory.PerpsMarketProxy.abiOf = ["PerpsMarketRouter"] factory.PerpsMarketProxy.event = "Upgraded" factory.PerpsMarketProxy.arg = 0 -depends = ["contract.InitialProxy", "router.PerpsMarketRouter"] [invoke.setSynthetix] target = ["PerpsMarketProxy"] from = "<%= settings.coreProxyOwner %>" func = "setSynthetix" -args = [ - "<%= imports.synthetix.contracts.CoreProxy.address %>", -] -depends = ["invoke.upgrade_proxy"] +args = ["<%= imports.synthetix.contracts.CoreProxy.address %>"] [invoke.setSpotMarket] target = ["PerpsMarketProxy"] from = "<%= settings.coreProxyOwner %>" func = "setSpotMarket" -args = [ - "<%= imports.spotMarket.contracts.SpotMarketProxy.address %>", -] -depends = ["invoke.upgrade_proxy", "import.spotMarket"] +args = ["<%= imports.spotMarket.contracts.SpotMarketProxy.address %>"] [invoke.init_account] target = ["PerpsMarketProxy"] from = "<%= settings.owner %>" func = "initOrUpgradeNft" args = [ - "<%= formatBytes32String('accountNft') %>", - "Perpetual Futures Account", - "snxPerpsAcct", - "", - "<%= imports.synthetix.contracts.AccountRouter.address %>" -] -depends = [ - "invoke.upgrade_proxy" + "<%= formatBytes32String('accountNft') %>", + "Perpetual Futures Account", + "snxPerpsAcct", + "", + "<%= imports.synthetix.contracts.AccountRouter.address %>" ] +depends = ["invoke.upgrade_proxy"] factory.PerpsAccountProxy.abiOf = ["synthetix.AccountRouter"] factory.PerpsAccountProxy.event = "AssociatedSystemSet" factory.PerpsAccountProxy.arg = 2 @@ -147,21 +125,21 @@ factory.PerpsAccountProxy.arg = 2 target = ["synthetix.CoreProxy"] func = "addToFeatureFlagAllowlist" from = "<%= settings.coreProxyOwner %>" -args = ["<%= formatBytes32String('registerMarket') %>", "<%= contracts.PerpsMarketProxy.address %>"] -depends = ['invoke.upgrade_proxy'] +args = [ + "<%= formatBytes32String('registerMarket') %>", + "<%= contracts.PerpsMarketProxy.address %>" +] [invoke.addCreateMarketToFeatureFlag] target = ["PerpsMarketProxy"] func = "addToFeatureFlagAllowlist" from = "<%= settings.owner %>" args = ["<%= formatBytes32String('createMarket') %>", "<%= settings.owner %>"] -depends = ['invoke.setSynthetix'] [invoke.initializeFactory] target = ["PerpsMarketProxy"] func = "initializeFactory" from = "<%= settings.owner %>" -depends = ['invoke.setSynthetix'] - extra.superMarketId.event = "FactoryInitialized" extra.superMarketId.arg = 0 +depends = ["invoke.setSynthetix"] diff --git a/markets/perps-market/contracts/interfaces/IAsyncOrderSettlementModule.sol b/markets/perps-market/contracts/interfaces/IAsyncOrderSettlementModule.sol index e39d33a7af..dfb75b13db 100644 --- a/markets/perps-market/contracts/interfaces/IAsyncOrderSettlementModule.sol +++ b/markets/perps-market/contracts/interfaces/IAsyncOrderSettlementModule.sol @@ -3,6 +3,7 @@ pragma solidity >=0.8.11 <0.9.0; import {SettlementStrategy} from "../storage/SettlementStrategy.sol"; import {Position} from "../storage/Position.sol"; import {PerpsMarket} from "../storage/PerpsMarket.sol"; +import {MarketUpdate} from "../storage/MarketUpdate.sol"; interface IAsyncOrderSettlementModule { /** @@ -68,7 +69,7 @@ interface IAsyncOrderSettlementModule { uint256 referralFees; uint256 feeCollectorFees; Position.Data newPosition; - PerpsMarket.MarketUpdateData updateData; + MarketUpdate.Data updateData; } /** diff --git a/markets/perps-market/contracts/interfaces/ICollateralModule.sol b/markets/perps-market/contracts/interfaces/ICollateralModule.sol index af7cd29034..bdabfbd5d7 100644 --- a/markets/perps-market/contracts/interfaces/ICollateralModule.sol +++ b/markets/perps-market/contracts/interfaces/ICollateralModule.sol @@ -11,11 +11,4 @@ interface ICollateralModule { * @param collateralAmount max amount that was set for the synth */ event MaxCollateralSet(uint128 indexed synthMarketId, uint256 collateralAmount); - - /** - * @notice Set the max collateral amoutn via this function - * @param synthMarketId Synth market id, 0 for snxUSD. - * @param collateralAmount max amount that for the synth - */ - function setMaxCollateralAmount(uint128 synthMarketId, uint collateralAmount) external; } diff --git a/markets/perps-market/contracts/interfaces/ILiquidationModule.sol b/markets/perps-market/contracts/interfaces/ILiquidationModule.sol index efbee7f8a8..82b78e4a0c 100644 --- a/markets/perps-market/contracts/interfaces/ILiquidationModule.sol +++ b/markets/perps-market/contracts/interfaces/ILiquidationModule.sol @@ -37,11 +37,32 @@ interface ILiquidationModule { * @notice Liquidates an account. * @dev according to the current situation and account size it can be a partial or full liquidation. * @param accountId Id of the account to liquidate. + * @return liquidationReward total reward sent to liquidator. */ - function liquidate(uint128 accountId) external; + function liquidate(uint128 accountId) external returns (uint256 liquidationReward); /** * @notice Liquidates all flagged accounts. + * @return liquidationReward total reward sent to liquidator. */ - function liquidateFlagged() external; + function liquidateFlagged() external returns (uint256 liquidationReward); + + /** + * @notice Returns if an account is eligible for liquidation. + * @return isEligible + */ + function canLiquidate(uint128 accountId) external view returns (bool isEligible); + + /** + * @notice Current liquidation capacity for the market + * @return capacity market can liquidate up to this # + * @return maxLiquidationInWindow max amount allowed to liquidate based on the current market configuration + * @return latestLiquidationTimestamp timestamp of the last liquidation of the market + */ + function liquidationCapacity( + uint128 marketId + ) + external + view + returns (uint capacity, uint256 maxLiquidationInWindow, uint256 latestLiquidationTimestamp); } diff --git a/markets/perps-market/contracts/modules/LiquidationModule.sol b/markets/perps-market/contracts/modules/LiquidationModule.sol index dba0ea3829..7719af448d 100644 --- a/markets/perps-market/contracts/modules/LiquidationModule.sol +++ b/markets/perps-market/contracts/modules/LiquidationModule.sol @@ -12,6 +12,7 @@ import {PerpsMarketFactory} from "../storage/PerpsMarketFactory.sol"; import {GlobalPerpsMarketConfiguration} from "../storage/GlobalPerpsMarketConfiguration.sol"; import {PerpsMarketConfiguration} from "../storage/PerpsMarketConfiguration.sol"; import {GlobalPerpsMarket} from "../storage/GlobalPerpsMarket.sol"; +import {MarketUpdate} from "../storage/MarketUpdate.sol"; import {IMarketEvents} from "../interfaces/IMarketEvents.sol"; /** @@ -26,12 +27,13 @@ contract LiquidationModule is ILiquidationModule, IMarketEvents { using PerpsMarketConfiguration for PerpsMarketConfiguration.Data; using GlobalPerpsMarket for GlobalPerpsMarket.Data; using PerpsMarketFactory for PerpsMarketFactory.Data; + using PerpsMarket for PerpsMarket.Data; using GlobalPerpsMarketConfiguration for GlobalPerpsMarketConfiguration.Data; /** * @inheritdoc ILiquidationModule */ - function liquidate(uint128 accountId) external override { + function liquidate(uint128 accountId) external override returns (uint256 liquidationReward) { SetUtil.UintSet storage liquidatableAccounts = GlobalPerpsMarket .load() .liquidatableAccounts; @@ -41,19 +43,19 @@ contract LiquidationModule is ILiquidationModule, IMarketEvents { if (isEligible) { account.flagForLiquidation(); - _liquidateAccount(account); + liquidationReward = _liquidateAccount(account); } else { revert NotEligibleForLiquidation(accountId); } } else { - _liquidateAccount(account); + liquidationReward = _liquidateAccount(account); } } /** * @inheritdoc ILiquidationModule */ - function liquidateFlagged() external override { + function liquidateFlagged() external override returns (uint256 liquidationReward) { uint256[] memory liquidatableAccounts = GlobalPerpsMarket .load() .liquidatableAccounts @@ -61,14 +63,40 @@ contract LiquidationModule is ILiquidationModule, IMarketEvents { for (uint i = 0; i < liquidatableAccounts.length; i++) { uint128 accountId = liquidatableAccounts[i].to128(); - _liquidateAccount(PerpsAccount.load(accountId)); + liquidationReward += _liquidateAccount(PerpsAccount.load(accountId)); } } + /** + * @inheritdoc ILiquidationModule + */ + function canLiquidate(uint128 accountId) external view override returns (bool isEligible) { + (isEligible, , , , , ) = PerpsAccount.load(accountId).isEligibleForLiquidation(); + } + + /** + * @inheritdoc ILiquidationModule + */ + function liquidationCapacity( + uint128 marketId + ) + external + view + override + returns (uint capacity, uint256 maxLiquidationInWindow, uint256 latestLiquidationTimestamp) + { + return + PerpsMarket.load(marketId).currentLiquidationCapacity( + PerpsMarketConfiguration.load(marketId) + ); + } + /** * @dev liquidates an account */ - function _liquidateAccount(PerpsAccount.Data storage account) internal { + function _liquidateAccount( + PerpsAccount.Data storage account + ) internal returns (uint256 keeperLiquidationReward) { uint128 accountId = account.id; uint256[] memory openPositionMarketIds = account.openPositionMarketIds.values(); @@ -82,7 +110,7 @@ contract LiquidationModule is ILiquidationModule, IMarketEvents { uint256 amountLiquidated, int128 newPositionSize, int128 sizeDelta, - PerpsMarket.MarketUpdateData memory marketUpdateData + MarketUpdate.Data memory marketUpdateData ) = account.liquidatePosition(positionMarketId, price); if (amountLiquidated == 0) { @@ -105,10 +133,14 @@ contract LiquidationModule is ILiquidationModule, IMarketEvents { uint256 liquidationReward = PerpsMarketConfiguration .load(positionMarketId) .calculateLiquidationReward(amountLiquidated.mulDecimal(price)); - accumulatedLiquidationRewards += liquidationReward; + + // endorsed liquidators do not get liquidation rewards + if (msg.sender != PerpsMarketConfiguration.load(positionMarketId).endorsedLiquidator) { + accumulatedLiquidationRewards += liquidationReward; + } } - uint256 keeperLiquidationReward = _processLiquidationRewards(accumulatedLiquidationRewards); + keeperLiquidationReward = _processLiquidationRewards(accumulatedLiquidationRewards); bool accountFullyLiquidated = account.openPositionMarketIds.length() == 0; if (accountFullyLiquidated) { diff --git a/markets/perps-market/contracts/modules/MarketConfigurationModule.sol b/markets/perps-market/contracts/modules/MarketConfigurationModule.sol index 78f73e5e89..2fc4412282 100644 --- a/markets/perps-market/contracts/modules/MarketConfigurationModule.sol +++ b/markets/perps-market/contracts/modules/MarketConfigurationModule.sol @@ -5,6 +5,7 @@ import {OwnableStorage} from "@synthetixio/core-contracts/contracts/ownership/Ow import {IMarketConfigurationModule} from "../interfaces/IMarketConfigurationModule.sol"; import {SettlementStrategy} from "../storage/SettlementStrategy.sol"; import {PerpsMarketConfiguration} from "../storage/PerpsMarketConfiguration.sol"; +import {PerpsMarket} from "../storage/PerpsMarket.sol"; import {PerpsPrice} from "../storage/PerpsPrice.sol"; /** @@ -115,9 +116,9 @@ contract MarketConfigurationModule is IMarketConfigurationModule { config .maxLiquidationLimitAccumulationMultiplier = maxLiquidationLimitAccumulationMultiplier; - config.maxSecondsInLiquidationWindow = maxSecondsInLiquidationWindow; config.maxLiquidationPd = maxLiquidationPd; config.endorsedLiquidator = endorsedLiquidator; + config.maxSecondsInLiquidationWindow = maxSecondsInLiquidationWindow; emit MaxLiquidationParametersSet( marketId, diff --git a/markets/perps-market/contracts/modules/PerpsAccountModule.sol b/markets/perps-market/contracts/modules/PerpsAccountModule.sol index 1165958bc4..58c09a6bf3 100644 --- a/markets/perps-market/contracts/modules/PerpsAccountModule.sol +++ b/markets/perps-market/contracts/modules/PerpsAccountModule.sol @@ -6,7 +6,7 @@ import {AccountRBAC} from "@synthetixio/main/contracts/storage/AccountRBAC.sol"; import {ITokenModule} from "@synthetixio/core-modules/contracts/interfaces/ITokenModule.sol"; import {PerpsMarketFactory} from "../storage/PerpsMarketFactory.sol"; import {IPerpsAccountModule} from "../interfaces/IPerpsAccountModule.sol"; -import {PerpsAccount} from "../storage/PerpsAccount.sol"; +import {PerpsAccount, SNX_USD_MARKET_ID} from "../storage/PerpsAccount.sol"; import {Position} from "../storage/Position.sol"; import {AsyncOrder} from "../storage/AsyncOrder.sol"; import {PerpsMarket} from "../storage/PerpsMarket.sol"; @@ -62,7 +62,11 @@ contract PerpsAccountModule is IPerpsAccountModule { } else { uint256 amountAbs = MathUtil.abs(amountDelta); // removing collateral - account.validateWithdrawableAmount(amountAbs); + account.validateWithdrawableAmount( + synthMarketId, + amountAbs, + perpsMarketFactory.spotMarket + ); _withdrawMargin(perpsMarketFactory, perpsMarketId, synthMarketId, amountAbs); } @@ -172,7 +176,7 @@ contract PerpsAccountModule is IPerpsAccountModule { uint128 synthMarketId, uint256 amount ) internal { - if (synthMarketId == 0) { + if (synthMarketId == SNX_USD_MARKET_ID) { // depositing into the USD market perpsMarketFactory.synthetix.depositMarketUsd(perpsMarketId, msg.sender, amount); } else { @@ -191,7 +195,7 @@ contract PerpsAccountModule is IPerpsAccountModule { uint128 synthMarketId, uint256 amount ) internal { - if (synthMarketId == 0) { + if (synthMarketId == SNX_USD_MARKET_ID) { // withdrawing from the USD market perpsMarketFactory.synthetix.withdrawMarketUsd(perpsMarketId, msg.sender, amount); } else { diff --git a/markets/perps-market/contracts/storage/GlobalPerpsMarket.sol b/markets/perps-market/contracts/storage/GlobalPerpsMarket.sol index eacfbc4328..e3a47ae7f0 100644 --- a/markets/perps-market/contracts/storage/GlobalPerpsMarket.sol +++ b/markets/perps-market/contracts/storage/GlobalPerpsMarket.sol @@ -8,6 +8,7 @@ import {SafeCastU256, SafeCastI256, SafeCastU128} from "@synthetixio/core-contra import {PerpsAccount} from "./PerpsAccount.sol"; import {PerpsMarketFactory} from "./PerpsMarketFactory.sol"; import {ISpotMarketSystem} from "../interfaces/external/ISpotMarketSystem.sol"; +import {SNX_USD_MARKET_ID} from "./PerpsAccount.sol"; /** * @title This library contains all global perps market data @@ -68,7 +69,7 @@ library GlobalPerpsMarket { for (uint i = 1; i <= activeCollateralLength; i++) { uint128 synthMarketId = activeCollateralTypes.valueAt(i).to128(); - if (synthMarketId == 0) { + if (synthMarketId == SNX_USD_MARKET_ID) { total += self.collateralAmounts[synthMarketId]; } else { (uint collateralValue, ) = spotMarket.quoteSellExactIn( diff --git a/markets/perps-market/contracts/storage/Liquidation.sol b/markets/perps-market/contracts/storage/Liquidation.sol new file mode 100644 index 0000000000..bf73fc6b5c --- /dev/null +++ b/markets/perps-market/contracts/storage/Liquidation.sol @@ -0,0 +1,18 @@ +//SPDX-License-Identifier: MIT +pragma solidity >=0.8.11 <0.9.0; + +/** + * @title Liquidation data used for determining max liquidation amounts + */ +library Liquidation { + struct Data { + /** + * @dev Accumulated amount for this corresponding timestamp + */ + uint128 amount; + /** + * @dev timestamp of the accumulated liqudation amount + */ + uint256 timestamp; + } +} diff --git a/markets/perps-market/contracts/storage/MarketUpdate.sol b/markets/perps-market/contracts/storage/MarketUpdate.sol new file mode 100644 index 0000000000..ea8a80ed6e --- /dev/null +++ b/markets/perps-market/contracts/storage/MarketUpdate.sol @@ -0,0 +1,16 @@ +//SPDX-License-Identifier: MIT +pragma solidity >=0.8.11 <0.9.0; + +/** + * @title MarketUpdateData + */ +library MarketUpdate { + // this data struct returns the data required to emit a MarketUpdated event + struct Data { + uint128 marketId; + int256 skew; + uint256 size; + int256 currentFundingRate; + int256 currentFundingVelocity; + } +} diff --git a/markets/perps-market/contracts/storage/PerpsAccount.sol b/markets/perps-market/contracts/storage/PerpsAccount.sol index f8236cb24b..e07358c4d7 100644 --- a/markets/perps-market/contracts/storage/PerpsAccount.sol +++ b/markets/perps-market/contracts/storage/PerpsAccount.sol @@ -9,6 +9,7 @@ import {Position} from "./Position.sol"; import {PerpsMarket} from "./PerpsMarket.sol"; import {MathUtil} from "../utils/MathUtil.sol"; import {PerpsPrice} from "./PerpsPrice.sol"; +import {MarketUpdate} from "./MarketUpdate.sol"; import {PerpsMarketFactory} from "./PerpsMarketFactory.sol"; import {GlobalPerpsMarket} from "./GlobalPerpsMarket.sol"; import {GlobalPerpsMarketConfiguration} from "./GlobalPerpsMarketConfiguration.sol"; @@ -45,7 +46,16 @@ library PerpsAccount { SetUtil.UintSet openPositionMarketIds; } - error InsufficientCollateralAvailableForWithdraw(uint available, uint required); + error InsufficientCollateralAvailableForWithdraw( + uint availableUsdDenominated, + uint requiredUsdDenominated + ); + + error InsufficientSynthCollateral( + uint128 synthMarketId, + uint collateralAmount, + uint withdrawAmount + ); error InsufficientMarginError(uint leftover); @@ -165,11 +175,19 @@ library PerpsAccount { /** * @notice This function validates you have enough margin to withdraw without being liquidated. * @dev This is done by checking your collateral value against your initial maintenance value. + * @dev It also checks the synth collateral for this account is enough to cover the withdrawal amount. */ function validateWithdrawableAmount( Data storage self, - uint256 amountToWithdraw + uint128 synthMarketId, + uint256 amountToWithdraw, + ISpotMarketSystem spotMarket ) internal view returns (uint256 availableWithdrawableCollateralUsd) { + uint collateralAmount = self.collateralAmounts[synthMarketId]; + if (collateralAmount < amountToWithdraw) { + revert InsufficientSynthCollateral(synthMarketId, collateralAmount, amountToWithdraw); + } + ( bool isEligible, int256 availableMargin, @@ -187,10 +205,17 @@ library PerpsAccount { // availableMargin can be assumed to be positive since we check for isEligible for liquidation prior availableWithdrawableCollateralUsd = availableMargin.toUint() - requiredMargin; - if (amountToWithdraw > availableWithdrawableCollateralUsd) { + uint amountToWithdrawUsd; + if (synthMarketId == SNX_USD_MARKET_ID) { + amountToWithdrawUsd = amountToWithdraw; + } else { + (amountToWithdrawUsd, ) = spotMarket.quoteSellExactIn(synthMarketId, amountToWithdraw); + } + + if (amountToWithdrawUsd > availableWithdrawableCollateralUsd) { revert InsufficientCollateralAvailableForWithdraw( availableWithdrawableCollateralUsd, - amountToWithdraw + amountToWithdrawUsd ); } } @@ -408,7 +433,7 @@ library PerpsAccount { uint128 amountToLiquidate, int128 newPositionSize, int128 sizeDelta, - PerpsMarket.MarketUpdateData memory marketUpdateData + MarketUpdate.Data memory marketUpdateData ) { PerpsMarket.Data storage perpsMarket = PerpsMarket.load(marketId); @@ -417,7 +442,7 @@ library PerpsAccount { perpsMarket.recomputeFunding(price); int128 oldPositionSize = position.size; - amountToLiquidate = perpsMarket.maxLiquidatableAmount(MathUtil.abs(oldPositionSize)); + amountToLiquidate = perpsMarket.maxLiquidatableAmount(MathUtil.abs128(oldPositionSize)); if (amountToLiquidate == 0) { return (0, oldPositionSize, 0, marketUpdateData); diff --git a/markets/perps-market/contracts/storage/PerpsMarket.sol b/markets/perps-market/contracts/storage/PerpsMarket.sol index af7b17b59c..4468757ba1 100644 --- a/markets/perps-market/contracts/storage/PerpsMarket.sol +++ b/markets/perps-market/contracts/storage/PerpsMarket.sol @@ -6,8 +6,10 @@ import {SafeCastU256, SafeCastI256, SafeCastU128} from "@synthetixio/core-contra import {Position} from "./Position.sol"; import {AsyncOrder} from "./AsyncOrder.sol"; import {PerpsMarketConfiguration} from "./PerpsMarketConfiguration.sol"; +import {MarketUpdate} from "./MarketUpdate.sol"; import {MathUtil} from "../utils/MathUtil.sol"; import {PerpsPrice} from "./PerpsPrice.sol"; +import {Liquidation} from "./Liquidation.sol"; /** * @title Data for a single perps market @@ -33,13 +35,13 @@ library PerpsMarket { uint128 id; int256 skew; uint256 size; - // TODO: move to new data structure? int256 lastFundingRate; int256 lastFundingValue; uint256 lastFundingTime; - // liquidation data - uint128 lastTimeLiquidationCapacityUpdated; - uint128 lastUtilizedLiquidationCapacity; + // solhint-disable-next-line var-name-mixedcase + uint128 __unused_1; + // solhint-disable-next-line var-name-mixedcase + uint128 __unused_2; // debt calculation // accumulates total notional size of the market including accrued funding until the last time any position changed int256 debtCorrectionAccumulator; @@ -47,6 +49,8 @@ library PerpsMarket { mapping(uint => AsyncOrder.Data) asyncOrders; // accountId => position mapping(uint => Position.Data) positions; + // liquidation amounts + Liquidation.Data[] liquidationData; } function load(uint128 marketId) internal pure returns (Data storage market) { @@ -96,77 +100,106 @@ library PerpsMarket { */ function maxLiquidatableAmount( Data storage self, - uint256 requestedLiquidationAmount + uint128 requestedLiquidationAmount ) internal returns (uint128 liquidatableAmount) { PerpsMarketConfiguration.Data storage marketConfig = PerpsMarketConfiguration.load(self.id); // if endorsedLiquidator is configured and is the sender, allow full liquidation if (msg.sender == marketConfig.endorsedLiquidator) { - return requestedLiquidationAmount.to128(); + _updateLiquidationData(self, requestedLiquidationAmount); + return requestedLiquidationAmount; } - uint maxLiquidationAmountPerSecond = marketConfig.maxLiquidationAmountPerSecond(); - // this would only be 0 if fees or skew scale are configured to be 0. - // in that case, (very unlikely), allow full liquidation - if (maxLiquidationAmountPerSecond == 0) { - return requestedLiquidationAmount.to128(); + ( + uint liquidationCapacity, + uint maxLiquidationInWindow, + uint latestLiquidationTimestamp + ) = currentLiquidationCapacity(self, marketConfig); + + // this would only occur if there was a misconfiguration (like skew scale not being set) + // or the max liquidation window not being set etc. + // in this case, return the entire requested liquidation amount + if (maxLiquidationInWindow == 0) { + return requestedLiquidationAmount; } - uint timeSinceLastUpdate = block.timestamp - self.lastTimeLiquidationCapacityUpdated; - uint maxSecondsInLiquidationWindow = marketConfig.maxSecondsInLiquidationWindow; - - uint256 maxAllowedLiquidationInWindow = maxSecondsInLiquidationWindow * - maxLiquidationAmountPerSecond; - if (timeSinceLastUpdate > maxSecondsInLiquidationWindow) { - liquidatableAmount = MathUtil - .min(maxAllowedLiquidationInWindow, requestedLiquidationAmount) - .to128(); - self.lastUtilizedLiquidationCapacity = liquidatableAmount; - } else { - liquidatableAmount = MathUtil - .min( - maxAllowedLiquidationInWindow - self.lastUtilizedLiquidationCapacity, - requestedLiquidationAmount - ) - .to128(); - self.lastUtilizedLiquidationCapacity += liquidatableAmount; - } - - // liquidatable amount is 0 only if there's no more capacity in the window - // but if maxLiquidationPd is set, and the current market p/d is less than that, - // then allow for an extra block of liquidation uint maxLiquidationPd = marketConfig.maxLiquidationPd; - if ( - liquidatableAmount == 0 && + // if liquidation capacity exists, update accordingly + if (liquidationCapacity != 0) { + liquidatableAmount = MathUtil.min128( + liquidationCapacity.to128(), + requestedLiquidationAmount + ); + } else if ( maxLiquidationPd != 0 && // only allow this if the last update was not in the current block - self.lastTimeLiquidationCapacityUpdated != block.timestamp.to128() + latestLiquidationTimestamp != block.timestamp ) { + /** + if capacity is at 0, but the market is under configured liquidation p/d, + another block of liquidation becomes allowable. + */ uint256 currentPd = MathUtil.abs(self.skew).divDecimal(marketConfig.skewScale); if (currentPd < maxLiquidationPd) { - liquidatableAmount = ( - requestedLiquidationAmount > maxAllowedLiquidationInWindow - ? maxAllowedLiquidationInWindow - : requestedLiquidationAmount - ).to128(); - // track how much was utilized in this block to ensure any subsequent - // liquidations don't combine for larger than what's allotted in the window - self.lastUtilizedLiquidationCapacity = liquidatableAmount; + liquidatableAmount = MathUtil.min128( + maxLiquidationInWindow.to128(), + requestedLiquidationAmount + ); } } - // only update timestamp if there is something being liquidated if (liquidatableAmount > 0) { - self.lastTimeLiquidationCapacityUpdated = block.timestamp.to128(); + _updateLiquidationData(self, liquidatableAmount); } } - struct MarketUpdateData { - uint128 marketId; - int256 skew; - uint256 size; - int256 currentFundingRate; - int256 currentFundingVelocity; + function _updateLiquidationData(Data storage self, uint128 liquidationAmount) private { + uint liquidationDataLength = self.liquidationData.length; + uint currentTimestamp = liquidationDataLength == 0 + ? 0 + : self.liquidationData[liquidationDataLength - 1].timestamp; + + if (currentTimestamp == block.timestamp) { + self.liquidationData[liquidationDataLength - 1].amount += liquidationAmount; + } else { + self.liquidationData.push( + Liquidation.Data({amount: liquidationAmount, timestamp: block.timestamp}) + ); + } + } + + /** + * @dev Returns the current liquidation capacity for the market + * @notice This function sums up the liquidation amounts in the current liquidation window + * and returns the capacity left. + */ + function currentLiquidationCapacity( + Data storage self, + PerpsMarketConfiguration.Data storage marketConfig + ) + internal + view + returns (uint capacity, uint256 maxLiquidationInWindow, uint256 latestLiquidationTimestamp) + { + maxLiquidationInWindow = marketConfig.maxLiquidationAmountInWindow(); + uint accumulatedLiquidationAmounts; + uint liquidationDataLength = self.liquidationData.length; + if (liquidationDataLength == 0) return (maxLiquidationInWindow, maxLiquidationInWindow, 0); + + uint currentIndex = liquidationDataLength - 1; + latestLiquidationTimestamp = self.liquidationData[currentIndex].timestamp; + uint windowStartTimestamp = block.timestamp - marketConfig.maxSecondsInLiquidationWindow; + + while (self.liquidationData[currentIndex].timestamp > windowStartTimestamp) { + accumulatedLiquidationAmounts += self.liquidationData[currentIndex].amount; + + if (currentIndex == 0) break; + currentIndex--; + } + int availableLiquidationCapacity = maxLiquidationInWindow.toInt() - + accumulatedLiquidationAmounts.toInt(); + // solhint-disable-next-line numcast/safe-cast + capacity = MathUtil.max(availableLiquidationCapacity, int(0)).toUint(); } /** @@ -178,13 +211,15 @@ library PerpsMarket { Data storage self, uint128 accountId, Position.Data memory newPosition - ) internal returns (MarketUpdateData memory) { + ) internal returns (MarketUpdate.Data memory) { Position.Data storage oldPosition = self.positions[accountId]; int128 oldPositionSize = oldPosition.size; int128 newPositionSize = newPosition.size; - self.size = (self.size + MathUtil.abs(newPositionSize)) - MathUtil.abs(oldPositionSize); + self.size = + (self.size + MathUtil.abs128(newPositionSize)) - + MathUtil.abs128(oldPositionSize); self.skew += newPositionSize - oldPositionSize; uint currentPrice = newPosition.latestInteractionPrice; @@ -201,7 +236,7 @@ library PerpsMarket { oldPosition.update(newPosition); return - MarketUpdateData( + MarketUpdate.Data( self.id, self.skew, self.size, @@ -283,7 +318,7 @@ library PerpsMarket { } function proportionalElapsed(Data storage self) internal view returns (int) { - return (block.timestamp - self.lastFundingTime).toInt().divDecimal(1 days); + return (block.timestamp - self.lastFundingTime).divDecimal(1 days).toInt(); } function validatePositionSize( diff --git a/markets/perps-market/contracts/storage/PerpsMarketConfiguration.sol b/markets/perps-market/contracts/storage/PerpsMarketConfiguration.sol index 1906459e3c..6a4b69bc66 100644 --- a/markets/perps-market/contracts/storage/PerpsMarketConfiguration.sol +++ b/markets/perps-market/contracts/storage/PerpsMarketConfiguration.sol @@ -78,12 +78,12 @@ library PerpsMarketConfiguration { } } - function maxLiquidationAmountPerSecond(Data storage self) internal view returns (uint256) { + function maxLiquidationAmountInWindow(Data storage self) internal view returns (uint256) { OrderFee.Data storage orderFeeData = self.orderFees; return (orderFeeData.makerFee + orderFeeData.takerFee).mulDecimal(self.skewScale).mulDecimal( self.maxLiquidationLimitAccumulationMultiplier - ); + ) * self.maxSecondsInLiquidationWindow; } function calculateLiquidationReward( @@ -108,6 +108,9 @@ library PerpsMarketConfiguration { uint256 liquidationMargin ) { + if (size == 0) { + return (0, 0, 0, 0, 0); + } uint256 sizeAbs = MathUtil.abs(size.to256()); uint256 impactOnSkew = self.skewScale == 0 ? 0 : sizeAbs.divDecimal(self.skewScale); @@ -117,6 +120,7 @@ library PerpsMarketConfiguration { maintenanceMarginRatio = initialMarginRatio.mulDecimal(self.maintenanceMarginScalarD18); uint256 notional = sizeAbs.mulDecimal(price); + initialMargin = notional.mulDecimal(initialMarginRatio) + self.minimumPositionMargin; maintenanceMargin = notional.mulDecimal(maintenanceMarginRatio) + diff --git a/markets/perps-market/contracts/storage/SettlementStrategy.sol b/markets/perps-market/contracts/storage/SettlementStrategy.sol index 9dddf5070b..a0097875f8 100644 --- a/markets/perps-market/contracts/storage/SettlementStrategy.sol +++ b/markets/perps-market/contracts/storage/SettlementStrategy.sol @@ -14,7 +14,7 @@ library SettlementStrategy { struct Data { /** - * @dev see Type.Data for more details + * @dev see Type for more details */ Type strategyType; /** diff --git a/markets/perps-market/contracts/utils/MathUtil.sol b/markets/perps-market/contracts/utils/MathUtil.sol index fb4890fc5b..13661b2912 100644 --- a/markets/perps-market/contracts/utils/MathUtil.sol +++ b/markets/perps-market/contracts/utils/MathUtil.sol @@ -1,13 +1,18 @@ //SPDX-License-Identifier: MIT pragma solidity >=0.8.11 <0.9.0; -import "@synthetixio/core-contracts/contracts/utils/SafeCast.sol"; +import {SafeCastI256, SafeCastI128, SafeCastU256} from "@synthetixio/core-contracts/contracts/utils/SafeCast.sol"; library MathUtil { using SafeCastI256 for int256; + using SafeCastI128 for int128; using SafeCastU256 for uint256; - function abs(int x) internal pure returns (uint) { + function abs(int256 x) internal pure returns (uint256) { + return x >= 0 ? x.toUint() : (-x).toUint(); + } + + function abs128(int128 x) internal pure returns (uint128) { return x >= 0 ? x.toUint() : (-x).toUint(); } @@ -23,10 +28,18 @@ library MathUtil { return x < y ? x : y; } + function min128(int128 x, int128 y) internal pure returns (int128) { + return x < y ? x : y; + } + function min(uint x, uint y) internal pure returns (uint) { return x < y ? x : y; } + function min128(uint128 x, uint128 y) internal pure returns (uint128) { + return x < y ? x : y; + } + function sameSide(int a, int b) internal pure returns (bool) { return (a == 0) || (b == 0) || (a > 0) == (b > 0); } diff --git a/markets/perps-market/docs/index.md b/markets/perps-market/docs/index.md new file mode 100644 index 0000000000..7a514de7b0 --- /dev/null +++ b/markets/perps-market/docs/index.md @@ -0,0 +1,1149 @@ +### Async Order Module + +#### commitOrder + + ```solidity + function commitOrder(struct AsyncOrder.OrderCommitmentRequest commitment) external returns (struct AsyncOrder.Data retOrder, uint256 fees) + ``` + + Commit an async order via this function + +**Parameters** +* `commitment` (*struct AsyncOrder.OrderCommitmentRequest*) - Order commitment data (see AsyncOrder.OrderCommitmentRequest struct). + +**Returns** +* `retOrder` (*struct AsyncOrder.Data*) - order details (see AsyncOrder.Data struct). +* `fees` (*uint256*) - order fees (protocol + settler) +#### getOrder + + ```solidity + function getOrder(uint128 accountId) external returns (struct AsyncOrder.Data order) + ``` + + Get async order claim details + +**Parameters** +* `accountId` (*uint128*) - id of the account. + +**Returns** +* `order` (*struct AsyncOrder.Data*) - async order claim details (see AsyncOrder.Data struct). +#### computeOrderFees + + ```solidity + function computeOrderFees(uint128 marketId, int128 sizeDelta) external view returns (uint256 orderFees, uint256 fillPrice) + ``` + + Simulates what the order fee would be for the given market with the specified size. + + Note that this does not include the settlement reward fee, which is based on the strategy type used + +**Parameters** +* `marketId` (*uint128*) - id of the market. +* `sizeDelta` (*int128*) - size of position. + +**Returns** +* `orderFees` (*uint256*) - incurred fees. +* `fillPrice` (*uint256*) - price at which the order would be filled. +#### requiredMarginForOrder + + ```solidity + function requiredMarginForOrder(uint128 marketId, uint128 accountId, int128 sizeDelta) external view returns (uint256 requiredMargin) + ``` + + For a given market, account id, and a position size, returns the required total account margin for this order to succeed + + Useful for integrators to determine if an order will succeed or fail + +**Parameters** +* `marketId` (*uint128*) - id of the market. +* `accountId` (*uint128*) - id of the trader account. +* `sizeDelta` (*int128*) - size of position. + +**Returns** +* `requiredMargin` (*uint256*) - margin required for the order to succeed. + +#### OrderCommitted + + ```solidity + event OrderCommitted(uint128 marketId, uint128 accountId, enum SettlementStrategy.Type orderType, int128 sizeDelta, uint256 acceptablePrice, uint256 settlementTime, uint256 expirationTime, bytes32 trackingCode, address sender) + ``` + + Gets fired when a new order is committed. + +**Parameters** +* `marketId` (*uint128*) - Id of the market used for the trade. +* `accountId` (*uint128*) - Id of the account used for the trade. +* `orderType` (*enum SettlementStrategy.Type*) - Should send 0 (at time of writing) that correlates to the transaction type enum defined in SettlementStrategy.Type. +* `sizeDelta` (*int128*) - requested change in size of the order sent by the user. +* `acceptablePrice` (*uint256*) - maximum or minimum, depending on the sizeDelta direction, accepted price to settle the order, set by the user. +* `settlementTime` (*uint256*) - Time at which the order can be settled. +* `expirationTime` (*uint256*) - Time at which the order expired. +* `trackingCode` (*bytes32*) - Optional code for integrator tracking purposes. +* `sender` (*address*) - address of the sender of the order. Authorized to commit by account owner. + +#### PreviousOrderExpired + + ```solidity + event PreviousOrderExpired(uint128 marketId, uint128 accountId, int128 sizeDelta, uint256 acceptablePrice, uint256 settlementTime, bytes32 trackingCode) + ``` + + Gets fired when a new order is committed while a previous one was expired. + +**Parameters** +* `marketId` (*uint128*) - Id of the market used for the trade. +* `accountId` (*uint128*) - Id of the account used for the trade. +* `sizeDelta` (*int128*) - requested change in size of the order sent by the user. +* `acceptablePrice` (*uint256*) - maximum or minimum, depending on the sizeDelta direction, accepted price to settle the order, set by the user. +* `settlementTime` (*uint256*) - Time at which the order can be settled. +* `trackingCode` (*bytes32*) - Optional code for integrator tracking purposes. + +### Async Order Settlement Module + +#### settle + + ```solidity + function settle(uint128 accountId) external view + ``` + + Settles an offchain order. It's expected to revert with the OffchainLookup error with the data needed to perform the offchain lookup. + +**Parameters** +* `accountId` (*uint128*) - Id of the account used for the trade. + +#### settlePythOrder + + ```solidity + function settlePythOrder(bytes result, bytes extraData) external payable + ``` + + Settles an offchain order using the offchain retrieved data from pyth. + +**Parameters** +* `result` (*bytes*) - the blob of data retrieved offchain. +* `extraData` (*bytes*) - Extra data from OffchainLookupData. + +#### OrderSettled + + ```solidity + event OrderSettled(uint128 marketId, uint128 accountId, uint256 fillPrice, int256 pnl, int256 accruedFunding, int128 sizeDelta, int128 newSize, uint256 totalFees, uint256 referralFees, uint256 collectedFees, uint256 settlementReward, bytes32 trackingCode, address settler) + ``` + + Gets fired when a new order is settled. + +**Parameters** +* `marketId` (*uint128*) - Id of the market used for the trade. +* `accountId` (*uint128*) - Id of the account used for the trade. +* `fillPrice` (*uint256*) - Price at which the order was settled. +* `pnl` (*int256*) - Pnl of the previous closed position. +* `accruedFunding` (*int256*) - Accrued funding of the previous closed position. +* `sizeDelta` (*int128*) - Size delta from order. +* `newSize` (*int128*) - New size of the position after settlement. +* `totalFees` (*uint256*) - Amount of fees collected by the protocol. +* `referralFees` (*uint256*) - Amount of fees collected by the referrer. +* `collectedFees` (*uint256*) - Amount of fees collected by fee collector. +* `settlementReward` (*uint256*) - Amount of fees collected by the settler. +* `trackingCode` (*bytes32*) - Optional code for integrator tracking purposes. +* `settler` (*address*) - address of the settler of the order. + +### Collateral Module + +#### setMaxCollateralAmount + + ```solidity + function setMaxCollateralAmount(uint128 synthMarketId, uint256 collateralAmount) external + ``` + + Set the max collateral amoutn via this function + +**Parameters** +* `synthMarketId` (*uint128*) - Synth market id, 0 for snxUSD. +* `collateralAmount` (*uint256*) - max amount that for the synth + +#### MaxCollateralSet + + ```solidity + event MaxCollateralSet(uint128 synthMarketId, uint256 collateralAmount) + ``` + + Gets fired when max collateral amount for synth collateral for the system is set by owner. + +**Parameters** +* `synthMarketId` (*uint128*) - Synth market id, 0 for snxUSD. +* `collateralAmount` (*uint256*) - max amount that was set for the synth + +### Global Perps Market Module + +#### setMaxCollateralAmount + + ```solidity + function setMaxCollateralAmount(uint128 synthMarketId, uint256 collateralAmount) external + ``` + + Sets the max collateral amount for a specific synth market. + +**Parameters** +* `synthMarketId` (*uint128*) - Synth market id, 0 for snxUSD. +* `collateralAmount` (*uint256*) - Max collateral amount to set for the synth market id. + +#### getMaxCollateralAmount + + ```solidity + function getMaxCollateralAmount(uint128 synthMarketId) external view returns (uint256) + ``` + + Gets the max collateral amount for a specific synth market. + +**Parameters** +* `synthMarketId` (*uint128*) - Synth market id, 0 for snxUSD. + +**Returns** +* `[0]` (*uint256*) - maxCollateralAmount max collateral amount of the specified synth market id +#### setSynthDeductionPriority + + ```solidity + function setSynthDeductionPriority(uint128[] newSynthDeductionPriority) external + ``` + + Sets the synth deduction priority ordered list. + + The synth deduction priority is used to determine the order in which synths are deducted from an account. Id 0 is snxUSD and should be first in the list. + +**Parameters** +* `newSynthDeductionPriority` (*uint128[]*) - Ordered array of synth market ids for deduction priority. + +#### getSynthDeductionPriority + + ```solidity + function getSynthDeductionPriority() external view returns (uint128[]) + ``` + + Gets the synth deduction priority ordered list. + + The synth deduction priority is used to determine the order in which synths are deducted from an account. Id 0 is snxUSD and should be first in the list. + +**Returns** +* `[0]` (*uint128[]*) - synthDeductionPriority Ordered array of synth market ids for deduction priority. +#### setLiquidationRewardGuards + + ```solidity + function setLiquidationRewardGuards(uint256 minLiquidationRewardUsd, uint256 maxLiquidationRewardUsd) external + ``` + + Sets the liquidation reward guard (min and max). + +**Parameters** +* `minLiquidationRewardUsd` (*uint256*) - Minimum liquidation reward expressed as USD value. +* `maxLiquidationRewardUsd` (*uint256*) - Maximum liquidation reward expressed as USD value. + +#### getLiquidationRewardGuards + + ```solidity + function getLiquidationRewardGuards() external view returns (uint256 minLiquidationRewardUsd, uint256 maxLiquidationRewardUsd) + ``` + + Gets the liquidation reward guard (min and max). + +**Returns** +* `minLiquidationRewardUsd` (*uint256*) - Minimum liquidation reward expressed as USD value. +* `maxLiquidationRewardUsd` (*uint256*) - Maximum liquidation reward expressed as USD value. +#### totalGlobalCollateralValue + + ```solidity + function totalGlobalCollateralValue() external view returns (uint256 totalCollateralValue) + ``` + + Gets the total collateral value of all deposited collateral from all traders. + +**Returns** +* `totalCollateralValue` (*uint256*) - value of all collateral +#### setFeeCollector + + ```solidity + function setFeeCollector(address feeCollector) external + ``` + + Sets the fee collector contract. + + must conform to the IFeeCollector interface + +**Parameters** +* `feeCollector` (*address*) - address of the fee collector contract + +#### getFeeCollector + + ```solidity + function getFeeCollector() external view returns (address feeCollector) + ``` + + Gets the configured feeCollector contract + +**Returns** +* `feeCollector` (*address*) - address of the fee collector contract +#### setPerAccountCaps + + ```solidity + function setPerAccountCaps(uint128 maxPositionsPerAccount, uint128 maxCollateralsPerAccount) external + ``` + + Set or update the max number of Positions and Collaterals per Account + +**Parameters** +* `maxPositionsPerAccount` (*uint128*) - The max number of concurrent Positions per Account +* `maxCollateralsPerAccount` (*uint128*) - The max number of concurrent Collaterals per Account + +#### getPerAccountCaps + + ```solidity + function getPerAccountCaps() external returns (uint128 maxPositionsPerAccount, uint128 maxCollateralsPerAccount) + ``` + + get the max number of Positions and Collaterals per Account + +**Parameters** + +#### updateReferrerShare + + ```solidity + function updateReferrerShare(address referrer, uint256 shareRatioD18) external + ``` + + Update the referral share percentage for a referrer + +**Parameters** +* `referrer` (*address*) - The address of the referrer +* `shareRatioD18` (*uint256*) - The new share percentage for the referrer + +#### getReferrerShare + + ```solidity + function getReferrerShare(address referrer) external returns (uint256 shareRatioD18) + ``` + + get the referral share percentage for the specified referrer + +**Parameters** +* `referrer` (*address*) - The address of the referrer + +**Returns** +* `shareRatioD18` (*uint256*) - The configured share percentage for the referrer +#### getMarkets + + ```solidity + function getMarkets() external returns (uint256[] marketIds) + ``` + + get all existing market ids + +**Returns** +* `marketIds` (*uint256[]*) - an array of existing market ids + +#### MaxCollateralAmountSet + + ```solidity + event MaxCollateralAmountSet(uint128 synthMarketId, uint256 collateralAmount) + ``` + + Gets fired when max collateral amount for synth for all the markets is set by owner. + +**Parameters** +* `synthMarketId` (*uint128*) - Synth market id, 0 for snxUSD. +* `collateralAmount` (*uint256*) - max amount that was set for the synth + +#### SynthDeductionPrioritySet + + ```solidity + event SynthDeductionPrioritySet(uint128[] newSynthDeductionPriority) + ``` + + Gets fired when the synth deduction priority is updated by owner. + +**Parameters** +* `newSynthDeductionPriority` (*uint128[]*) - new synth id priority order for deductions. + +#### LiquidationRewardGuardsSet + + ```solidity + event LiquidationRewardGuardsSet(uint256 minLiquidationRewardUsd, uint256 maxLiquidationRewardUsd) + ``` + + Gets fired when liquidation reward guard is set or updated. + +**Parameters** +* `minLiquidationRewardUsd` (*uint256*) - Minimum liquidation reward expressed as USD value. +* `maxLiquidationRewardUsd` (*uint256*) - Maximum liquidation reward expressed as USD value. + +#### FeeCollectorSet + + ```solidity + event FeeCollectorSet(address feeCollector) + ``` + + emitted when custom fee collector is set + +**Parameters** +* `feeCollector` (*address*) - the address of the fee collector to set. + +#### ReferrerShareUpdated + + ```solidity + event ReferrerShareUpdated(address referrer, uint256 shareRatioD18) + ``` + + Emitted when the share percentage for a referrer address has been updated. + +**Parameters** +* `referrer` (*address*) - The address of the referrer +* `shareRatioD18` (*uint256*) - The new share ratio for the referrer + +#### PerAccountCapsSet + + ```solidity + event PerAccountCapsSet(uint128 maxPositionsPerAccount, uint128 maxCollateralsPerAccount) + ``` + + Gets fired when the max number of Positions and Collaterals per Account are set by owner. + +**Parameters** +* `maxPositionsPerAccount` (*uint128*) - The max number of concurrent Positions per Account +* `maxCollateralsPerAccount` (*uint128*) - The max number of concurrent Collaterals per Account + +### Liquidation Module + +#### liquidate + + ```solidity + function liquidate(uint128 accountId) external + ``` + + Liquidates an account. + + according to the current situation and account size it can be a partial or full liquidation. + +**Parameters** +* `accountId` (*uint128*) - Id of the account to liquidate. + +#### liquidateFlagged + + ```solidity + function liquidateFlagged() external + ``` + + Liquidates all flagged accounts. + +#### PositionLiquidated + + ```solidity + event PositionLiquidated(uint128 accountId, uint128 marketId, uint256 amountLiquidated, int128 currentPositionSize) + ``` + + Gets fired when an account position is liquidated . + +**Parameters** +* `accountId` (*uint128*) - Id of the account liquidated. +* `marketId` (*uint128*) - Id of the position's market. +* `amountLiquidated` (*uint256*) - amount liquidated. +* `currentPositionSize` (*int128*) - position size after liquidation. + +#### AccountLiquidated + + ```solidity + event AccountLiquidated(uint128 accountId, uint256 reward, bool fullLiquidation) + ``` + + Gets fired when an account is liquidated. + + this event is fired once per liquidation tx after the each position that can be liquidated at the time was liquidated. + +**Parameters** +* `accountId` (*uint128*) - Id of the account liquidated. +* `reward` (*uint256*) - total reward sent to liquidator. +* `fullLiquidation` (*bool*) - flag indicating if it was a partial or full liquidation. + +### Market Configuration Module + +#### addSettlementStrategy + + ```solidity + function addSettlementStrategy(uint128 marketId, struct SettlementStrategy.Data strategy) external returns (uint256 strategyId) + ``` + + Add a new settlement strategy with this function. + +**Parameters** +* `marketId` (*uint128*) - id of the market to add the settlement strategy. +* `strategy` (*struct SettlementStrategy.Data*) - strategy details (see SettlementStrategy.Data struct). + +**Returns** +* `strategyId` (*uint256*) - id of the new settlement strategy. +#### setOrderFees + + ```solidity + function setOrderFees(uint128 marketId, uint256 makerFeeRatio, uint256 takerFeeRatio) external + ``` + + Set order fees for a market with this function. + +**Parameters** +* `marketId` (*uint128*) - id of the market to set order fees. +* `makerFeeRatio` (*uint256*) - the maker fee ratio. +* `takerFeeRatio` (*uint256*) - the taker fee ratio. + +#### updatePriceData + + ```solidity + function updatePriceData(uint128 perpsMarketId, bytes32 feedId) external + ``` + + Set node id for perps market + +**Parameters** +* `perpsMarketId` (*uint128*) - id of the market to set price feed. +* `feedId` (*bytes32*) - the node feed id + +#### setFundingParameters + + ```solidity + function setFundingParameters(uint128 marketId, uint256 skewScale, uint256 maxFundingVelocity) external + ``` + + Set funding parameters for a market with this function. + +**Parameters** +* `marketId` (*uint128*) - id of the market to set funding parameters. +* `skewScale` (*uint256*) - the skew scale. +* `maxFundingVelocity` (*uint256*) - the max funding velocity. + +#### setLiquidationParameters + + ```solidity + function setLiquidationParameters(uint128 marketId, uint256 initialMarginRatioD18, uint256 minimumInitialMarginRatioD18, uint256 maintenanceMarginScalarD18, uint256 liquidationRewardRatioD18, uint256 maxLiquidationLimitAccumulationMultiplier, uint256 maxSecondsInLiquidationWindow, uint256 minimumPositionMargin) external + ``` + + Set liquidation parameters for a market with this function. + +**Parameters** +* `marketId` (*uint128*) - id of the market to set liquidation parameters. +* `initialMarginRatioD18` (*uint256*) - the initial margin ratio (as decimal with 18 digits precision). +* `minimumInitialMarginRatioD18` (*uint256*) - the minimum initial margin ratio (as decimal with 18 digits precision). +* `maintenanceMarginScalarD18` (*uint256*) - the maintenance margin scalar relative to the initial margin ratio (as decimal with 18 digits precision). +* `liquidationRewardRatioD18` (*uint256*) - the liquidation reward ratio (as decimal with 18 digits precision). +* `maxLiquidationLimitAccumulationMultiplier` (*uint256*) - the max liquidation limit accumulation multiplier. +* `maxSecondsInLiquidationWindow` (*uint256*) - the max seconds in liquidation window (used together with the acc multiplier to get max liquidation per window). +* `minimumPositionMargin` (*uint256*) - the minimum position margin. + +#### setMaxMarketSize + + ```solidity + function setMaxMarketSize(uint128 marketId, uint256 maxMarketSize) external + ``` + + Set the max size of an specific market with this function. + + This controls the maximum open interest a market can have on either side (Long | Short). So the total Open Interest (with zero skew) for a market can be up to max market size * 2. + +**Parameters** +* `marketId` (*uint128*) - id of the market to set the max market value. +* `maxMarketSize` (*uint256*) - the max market size in market asset units. + +#### setLockedOiRatio + + ```solidity + function setLockedOiRatio(uint128 marketId, uint256 lockedOiRatioD18) external + ``` + + Set the locked OI Ratio for a market with this function. + +**Parameters** +* `marketId` (*uint128*) - id of the market to set locked OI ratio. +* `lockedOiRatioD18` (*uint256*) - the locked OI ratio skew scale (as decimal with 18 digits precision). + +#### setSettlementStrategyEnabled + + ```solidity + function setSettlementStrategyEnabled(uint128 marketId, uint256 strategyId, bool enabled) external + ``` + + Enable or disable a settlement strategy for a market with this function. + +**Parameters** +* `marketId` (*uint128*) - id of the market. +* `strategyId` (*uint256*) - the specific strategy. +* `enabled` (*bool*) - whether the strategy is enabled or disabled. + +#### getSettlementStrategy + + ```solidity + function getSettlementStrategy(uint128 marketId, uint256 strategyId) external view returns (struct SettlementStrategy.Data settlementStrategy) + ``` + + Gets the settlement strategy details. + +**Parameters** +* `marketId` (*uint128*) - id of the market. +* `strategyId` (*uint256*) - id of the settlement strategy. + +**Returns** +* `settlementStrategy` (*struct SettlementStrategy.Data*) - strategy details (see SettlementStrategy.Data struct). +#### getLiquidationParameters + + ```solidity + function getLiquidationParameters(uint128 marketId) external view returns (uint256 initialMarginRatioD18, uint256 minimumInitialMarginRatioD18, uint256 maintenanceMarginScalarD18, uint256 liquidationRewardRatioD18, uint256 maxLiquidationLimitAccumulationMultiplier, uint256 maxSecondsInLiquidationWindow, uint256 minimumPositionMargin) + ``` + + Gets liquidation parameters details of a market. + +**Parameters** +* `marketId` (*uint128*) - id of the market. + +**Returns** +* `initialMarginRatioD18` (*uint256*) - the initial margin ratio (as decimal with 18 digits precision). +* `minimumInitialMarginRatioD18` (*uint256*) - the minimum initial margin ratio (as decimal with 18 digits precision). +* `maintenanceMarginScalarD18` (*uint256*) - the maintenance margin scalar relative to the initial margin ratio (as decimal with 18 digits precision). +* `liquidationRewardRatioD18` (*uint256*) - the liquidation reward ratio (as decimal with 18 digits precision). +* `maxLiquidationLimitAccumulationMultiplier` (*uint256*) - the max liquidation limit accumulation multiplier. +* `maxSecondsInLiquidationWindow` (*uint256*) - the max seconds in liquidation window (used together with the acc multiplier to get max liquidation per window). +* `minimumPositionMargin` (*uint256*) - the minimum position margin. +#### getFundingParameters + + ```solidity + function getFundingParameters(uint128 marketId) external view returns (uint256 skewScale, uint256 maxFundingVelocity) + ``` + + Gets funding parameters of a market. + +**Parameters** +* `marketId` (*uint128*) - id of the market. + +**Returns** +* `skewScale` (*uint256*) - the skew scale. +* `maxFundingVelocity` (*uint256*) - the max funding velocity. +#### getMaxMarketSize + + ```solidity + function getMaxMarketSize(uint128 marketId) external view returns (uint256 maxMarketSize) + ``` + + Gets the max size of an specific market. + +**Parameters** +* `marketId` (*uint128*) - id of the market. + +**Returns** +* `maxMarketSize` (*uint256*) - the max market size in market asset units. +#### getOrderFees + + ```solidity + function getOrderFees(uint128 marketId) external view returns (uint256 makerFeeRatio, uint256 takerFeeRatio) + ``` + + Gets the order fees of a market. + +**Parameters** +* `marketId` (*uint128*) - id of the market. + +**Returns** +* `makerFeeRatio` (*uint256*) - the maker fee ratio. +* `takerFeeRatio` (*uint256*) - the taker fee ratio. +#### getLockedOiRatio + + ```solidity + function getLockedOiRatio(uint128 marketId) external view returns (uint256 lockedOiRatioD18) + ``` + + Gets the locked OI ratio of a market. + +**Parameters** +* `marketId` (*uint128*) - id of the market. + +**Returns** +* `lockedOiRatioD18` (*uint256*) - the locked OI ratio skew scale (as decimal with 18 digits precision). + +#### SettlementStrategyAdded + + ```solidity + event SettlementStrategyAdded(uint128 marketId, struct SettlementStrategy.Data strategy, uint256 strategyId) + ``` + + Gets fired when new settlement strategy is added. + +**Parameters** +* `marketId` (*uint128*) - adds settlement strategy to this specific market. +* `strategy` (*struct SettlementStrategy.Data*) - the strategy configuration. +* `strategyId` (*uint256*) - the newly created settlement strategy id. + +#### MarketPriceDataUpdated + + ```solidity + event MarketPriceDataUpdated(uint128 marketId, bytes32 feedId) + ``` + + Gets fired when feed id for perps market is updated. + +**Parameters** +* `marketId` (*uint128*) - id of perps market +* `feedId` (*bytes32*) - oracle node id + +#### OrderFeesSet + + ```solidity + event OrderFeesSet(uint128 marketId, uint256 makerFeeRatio, uint256 takerFeeRatio) + ``` + + Gets fired when order fees are updated. + +**Parameters** +* `marketId` (*uint128*) - udpates fees to this specific market. +* `makerFeeRatio` (*uint256*) - the maker fee ratio. +* `takerFeeRatio` (*uint256*) - the taker fee ratio. + +#### FundingParametersSet + + ```solidity + event FundingParametersSet(uint128 marketId, uint256 skewScale, uint256 maxFundingVelocity) + ``` + + Gets fired when funding parameters are updated. + +**Parameters** +* `marketId` (*uint128*) - udpates funding parameters to this specific market. +* `skewScale` (*uint256*) - the skew scale. +* `maxFundingVelocity` (*uint256*) - the max funding velocity. + +#### LiquidationParametersSet + + ```solidity + event LiquidationParametersSet(uint128 marketId, uint256 initialMarginRatioD18, uint256 maintenanceMarginRatioD18, uint256 minimumInitialMarginRatioD18, uint256 liquidationRewardRatioD18, uint256 maxLiquidationLimitAccumulationMultiplier, uint256 maxSecondsInLiquidationWindow, uint256 minimumPositionMargin) + ``` + + Gets fired when liquidation parameters are updated. + +**Parameters** +* `marketId` (*uint128*) - udpates funding parameters to this specific market. +* `initialMarginRatioD18` (*uint256*) - the initial margin ratio (as decimal with 18 digits precision). +* `maintenanceMarginRatioD18` (*uint256*) - the maintenance margin ratio (as decimal with 18 digits precision). +* `minimumInitialMarginRatioD18` (*uint256*) - +* `liquidationRewardRatioD18` (*uint256*) - the liquidation reward ratio (as decimal with 18 digits precision). +* `maxLiquidationLimitAccumulationMultiplier` (*uint256*) - the max liquidation limit accumulation multiplier. +* `maxSecondsInLiquidationWindow` (*uint256*) - the max seconds in liquidation window (used together with the acc multiplier to get max liquidation per window). +* `minimumPositionMargin` (*uint256*) - the minimum position margin. + +#### MaxMarketSizeSet + + ```solidity + event MaxMarketSizeSet(uint128 marketId, uint256 maxMarketSize) + ``` + + Gets fired when max market value is updated. + +**Parameters** +* `marketId` (*uint128*) - udpates funding parameters to this specific market. +* `maxMarketSize` (*uint256*) - the max market value. + +#### LockedOiRatioSet + + ```solidity + event LockedOiRatioSet(uint128 marketId, uint256 lockedOiRatioD18) + ``` + + Gets fired when locked oi ratio is updated. + +**Parameters** +* `marketId` (*uint128*) - udpates funding parameters to this specific market. +* `lockedOiRatioD18` (*uint256*) - the locked OI ratio skew scale (as decimal with 18 digits precision). + +#### SettlementStrategyEnabled + + ```solidity + event SettlementStrategyEnabled(uint128 marketId, uint256 strategyId, bool enabled) + ``` + + Gets fired when a settlement strategy is enabled or disabled. + +**Parameters** +* `marketId` (*uint128*) - udpates funding parameters to this specific market. +* `strategyId` (*uint256*) - the specific strategy. +* `enabled` (*bool*) - whether the strategy is enabled or disabled. + +### IMarketEvents + +#### MarketUpdated + + ```solidity + event MarketUpdated(uint128 marketId, uint256 price, int256 skew, uint256 size, int256 sizeDelta, int256 currentFundingRate, int256 currentFundingVelocity) + ``` + + Gets fired when the size of a market is updated by new orders or liquidations. + +**Parameters** +* `marketId` (*uint128*) - Id of the market used for the trade. +* `price` (*uint256*) - Price at the time of this event. +* `skew` (*int256*) - Market skew at the time of the trade. Positive values mean more longs. +* `size` (*uint256*) - Size of the entire market after settlement. +* `sizeDelta` (*int256*) - Change in market size during this update. +* `currentFundingRate` (*int256*) - The current funding rate of this market (0.001 = 0.1% per day) +* `currentFundingVelocity` (*int256*) - The current rate of change of the funding rate (0.001 = +0.1% per day) + +### Perps Account Module + +#### modifyCollateral + + ```solidity + function modifyCollateral(uint128 accountId, uint128 synthMarketId, int256 amountDelta) external + ``` + + Modify the collateral delegated to the account. + +**Parameters** +* `accountId` (*uint128*) - Id of the account. +* `synthMarketId` (*uint128*) - Id of the synth market used as collateral. Synth market id, 0 for snxUSD. +* `amountDelta` (*int256*) - requested change in amount of collateral delegated to the account. + +#### getCollateralAmount + + ```solidity + function getCollateralAmount(uint128 accountId, uint128 synthMarketId) external view returns (uint256) + ``` + + Gets the account's collateral value for a specific collateral. + +**Parameters** +* `accountId` (*uint128*) - Id of the account. +* `synthMarketId` (*uint128*) - Id of the synth market used as collateral. Synth market id, 0 for snxUSD. + +**Returns** +* `[0]` (*uint256*) - collateralValue collateral value of the account. +#### totalCollateralValue + + ```solidity + function totalCollateralValue(uint128 accountId) external view returns (uint256) + ``` + + Gets the account's total collateral value. + +**Parameters** +* `accountId` (*uint128*) - Id of the account. + +**Returns** +* `[0]` (*uint256*) - collateralValue total collateral value of the account. USD denominated. +#### totalAccountOpenInterest + + ```solidity + function totalAccountOpenInterest(uint128 accountId) external view returns (uint256) + ``` + + Gets the account's total open interest value. + +**Parameters** +* `accountId` (*uint128*) - Id of the account. + +**Returns** +* `[0]` (*uint256*) - openInterestValue total open interest value of the account. +#### getOpenPosition + + ```solidity + function getOpenPosition(uint128 accountId, uint128 marketId) external view returns (int256 totalPnl, int256 accruedFunding, int128 positionSize) + ``` + + Gets the details of an open position. + +**Parameters** +* `accountId` (*uint128*) - Id of the account. +* `marketId` (*uint128*) - Id of the position market. + +**Returns** +* `totalPnl` (*int256*) - pnl of the entire position including funding. +* `accruedFunding` (*int256*) - accrued funding of the position. +* `positionSize` (*int128*) - size of the position. +#### getAvailableMargin + + ```solidity + function getAvailableMargin(uint128 accountId) external view returns (int256 availableMargin) + ``` + + Gets the available margin of an account. It can be negative due to pnl. + +**Parameters** +* `accountId` (*uint128*) - Id of the account. + +**Returns** +* `availableMargin` (*int256*) - available margin of the position. +#### getWithdrawableMargin + + ```solidity + function getWithdrawableMargin(uint128 accountId) external view returns (int256 withdrawableMargin) + ``` + + Gets the exact withdrawable amount a trader has available from this account while holding the account's current positions. + +**Parameters** +* `accountId` (*uint128*) - Id of the account. + +**Returns** +* `withdrawableMargin` (*int256*) - available margin to withdraw. +#### getRequiredMargins + + ```solidity + function getRequiredMargins(uint128 accountId) external view returns (uint256 requiredInitialMargin, uint256 requiredMaintenanceMargin, uint256 totalAccumulatedLiquidationRewards, uint256 maxLiquidationReward) + ``` + + Gets the initial/maintenance margins across all positions that an account has open. + +**Parameters** +* `accountId` (*uint128*) - Id of the account. + +**Returns** +* `requiredInitialMargin` (*uint256*) - initial margin req (used when withdrawing collateral). +* `requiredMaintenanceMargin` (*uint256*) - maintenance margin req (used to determine liquidation threshold). +* `totalAccumulatedLiquidationRewards` (*uint256*) - sum of all liquidation rewards of if all account open positions were to be liquidated fully. +* `maxLiquidationReward` (*uint256*) - max liquidation reward the keeper would receive if account was fully liquidated. Note here that the accumulated rewards are checked against the global max/min configured liquidation rewards. + +#### CollateralModified + + ```solidity + event CollateralModified(uint128 accountId, uint128 synthMarketId, int256 amountDelta, address sender) + ``` + + Gets fired when an account colateral is modified. + +**Parameters** +* `accountId` (*uint128*) - Id of the account. +* `synthMarketId` (*uint128*) - Id of the synth market used as collateral. Synth market id, 0 for snxUSD. +* `amountDelta` (*int256*) - requested change in amount of collateral delegated to the account. +* `sender` (*address*) - address of the sender of the size modification. Authorized by account owner. + +### Perps Market Factory Module + +#### initializeFactory + + ```solidity + function initializeFactory() external returns (uint128) + ``` + + Initializes the factory. + + this function should be called only once. + +**Returns** +* `[0]` (*uint128*) - globalPerpsMarketId Id of the global perps market id. +#### setSynthetix + + ```solidity + function setSynthetix(contract ISynthetixSystem synthetix) external + ``` + + Sets the synthetix system. + +**Parameters** +* `synthetix` (*contract ISynthetixSystem*) - address of the main synthetix proxy. + +#### setSpotMarket + + ```solidity + function setSpotMarket(contract ISpotMarketSystem spotMarket) external + ``` + + Sets the spot market system. + +**Parameters** +* `spotMarket` (*contract ISpotMarketSystem*) - address of the spot market proxy. + +#### createMarket + + ```solidity + function createMarket(uint128 requestedMarketId, string marketName, string marketSymbol) external returns (uint128) + ``` + + Creates a new market. + +**Parameters** +* `requestedMarketId` (*uint128*) - id of the market to create. +* `marketName` (*string*) - name of the market to create. +* `marketSymbol` (*string*) - symbol of the market to create. + +**Returns** +* `[0]` (*uint128*) - perpsMarketId Id of the created perps market. +#### name + + ```solidity + function name(uint128 marketId) external view returns (string) + ``` + + returns a human-readable name for a given market + +#### reportedDebt + + ```solidity + function reportedDebt(uint128 marketId) external view returns (uint256) + ``` + + returns amount of USD that the market would try to mint if everything was withdrawn + +#### minimumCredit + + ```solidity + function minimumCredit(uint128 marketId) external view returns (uint256) + ``` + + prevents reduction of available credit capacity by specifying this amount, for which withdrawals will be disallowed + +#### supportsInterface + + ```solidity + function supportsInterface(bytes4 interfaceID) external view returns (bool) + ``` + + Determines if the contract in question supports the specified interface. + +**Parameters** +* `interfaceID` (*bytes4*) - XOR of all selectors in the contract. + +**Returns** +* `[0]` (*bool*) - True if the contract supports the specified interface. + +#### FactoryInitialized + + ```solidity + event FactoryInitialized(uint128 globalPerpsMarketId) + ``` + + Gets fired when the factory is initialized. + +**Parameters** +* `globalPerpsMarketId` (*uint128*) - the new global perps market id. + +#### MarketCreated + + ```solidity + event MarketCreated(uint128 perpsMarketId, string marketName, string marketSymbol) + ``` + + Gets fired when a market is created. + +**Parameters** +* `perpsMarketId` (*uint128*) - the newly created perps market id. +* `marketName` (*string*) - the newly created perps market name. +* `marketSymbol` (*string*) - the newly created perps market symbol. + +### Perps Market Module + +#### metadata + + ```solidity + function metadata(uint128 marketId) external view returns (string name, string symbol) + ``` + + Gets a market metadata. + +**Parameters** +* `marketId` (*uint128*) - Id of the market. + +**Returns** +* `name` (*string*) - Name of the market. +* `symbol` (*string*) - Symbol of the market. +#### skew + + ```solidity + function skew(uint128 marketId) external view returns (int256) + ``` + + Gets a market's skew. + +**Parameters** +* `marketId` (*uint128*) - Id of the market. + +**Returns** +* `[0]` (*int256*) - skew Skew of the market. +#### size + + ```solidity + function size(uint128 marketId) external view returns (uint256) + ``` + + Gets a market's size. + +**Parameters** +* `marketId` (*uint128*) - Id of the market. + +**Returns** +* `[0]` (*uint256*) - size Size of the market. +#### maxOpenInterest + + ```solidity + function maxOpenInterest(uint128 marketId) external view returns (uint256) + ``` + + Gets a market's max open interest. + +**Parameters** +* `marketId` (*uint128*) - Id of the market. + +**Returns** +* `[0]` (*uint256*) - maxOpenInterest Max open interest of the market. +#### currentFundingRate + + ```solidity + function currentFundingRate(uint128 marketId) external view returns (int256) + ``` + + Gets a market's current funding rate. + +**Parameters** +* `marketId` (*uint128*) - Id of the market. + +**Returns** +* `[0]` (*int256*) - currentFundingRate Current funding rate of the market. +#### currentFundingVelocity + + ```solidity + function currentFundingVelocity(uint128 marketId) external view returns (int256) + ``` + + Gets a market's current funding velocity. + +**Parameters** +* `marketId` (*uint128*) - Id of the market. + +**Returns** +* `[0]` (*int256*) - currentFundingVelocity Current funding velocity of the market. +#### indexPrice + + ```solidity + function indexPrice(uint128 marketId) external view returns (uint256) + ``` + + Gets a market's index price. + +**Parameters** +* `marketId` (*uint128*) - Id of the market. + +**Returns** +* `[0]` (*uint256*) - indexPrice Index price of the market. +#### fillPrice + + ```solidity + function fillPrice(uint128 marketId, int128 orderSize, uint256 price) external returns (uint256) + ``` + + Gets a market's fill price for a specific order size and index price. + +**Parameters** +* `marketId` (*uint128*) - Id of the market. +* `orderSize` (*int128*) - Order size. +* `price` (*uint256*) - Index price. + +**Returns** +* `[0]` (*uint256*) - price Fill price. +#### getMarketSummary + + ```solidity + function getMarketSummary(uint128 marketId) external view returns (struct IPerpsMarketModule.MarketSummary summary) + ``` + + Given a marketId return a market's summary details in one call. + +**Parameters** +* `marketId` (*uint128*) - Id of the market. + +**Returns** +* `summary` (*struct IPerpsMarketModule.MarketSummary*) - Market summary (see MarketSummary). + diff --git a/markets/perps-market/package.json b/markets/perps-market/package.json index 70fa725ad6..0e110da4f9 100644 --- a/markets/perps-market/package.json +++ b/markets/perps-market/package.json @@ -5,18 +5,18 @@ "scripts": { "build": "yarn build:contracts", "build:contracts": "hardhat compile --force && hardhat storage:verify && hardhat cannon:build", - "build-testable": "hardhat cannon:build cannonfile.test.toml", + "build-testable": "CANNON_REGISTRY_PRIORITY=local hardhat cannon:build cannonfile.test.toml", "check:storage": "git diff --exit-code storage.dump.sol", "start": "yarn build && yarn cannon-build", "clean": "hardhat clean", "cannon-build": "hardhat cannon:build", - "test": "hardhat test", + "test": "CANNON_REGISTRY_PRIORITY=local hardhat test", "coverage": "hardhat test", "coverage1": "hardhat coverage --network hardhat", "compile-contracts": "hardhat compile", - "publish-contracts": "yarn build && cannon publish synthetix-perps-market:$(node -p 'require(`./package.json`).version') --quiet", + "publish-contracts": "cannon publish synthetix-perps-market:$(node -p 'require(`./package.json`).version') --chain-id 13370 --quiet --tags $(node -p '/^\\d+\\.\\d+\\.\\d+$/.test(require(`./package.json`).version) ? `latest` : `dev`')", + "postpack": "yarn build && yarn publish-contracts", "size-contracts": "hardhat compile && hardhat size-contracts", - "postpack": "yarn publish-contracts", "docgen": "hardhat docgen" }, "keywords": [], @@ -30,15 +30,15 @@ "@synthetixio/docgen": "workspace:*", "@synthetixio/main": "workspace:*", "@synthetixio/oracle-manager": "workspace:*", - "@synthetixio/router": "^3.1.3", + "@synthetixio/router": "^3.3.0", "@synthetixio/spot-market": "workspace:*", "@synthetixio/wei": "2.74.4", - "@usecannon/cli": "^2.5.1", + "@usecannon/cli": "^2.7.1", "ethers": "^5.7.2", - "hardhat": "2.15.0", + "hardhat": "2.17.2", "solidity-docgen": "0.6.0-beta.35", "ts-node": "10.9.1", - "typescript": "4.9.3" + "typescript": "^4.9.3" }, - "gitHead": "af79d976af56150c628a885cc94a94f5bcc2c862" + "gitHead": "ba5a9730df248cd1999b5a6fd1bf67b307b95eec" } diff --git a/markets/perps-market/storage.dump.sol b/markets/perps-market/storage.dump.sol index a3c39fd5b5..799a2cd6fe 100644 --- a/markets/perps-market/storage.dump.sol +++ b/markets/perps-market/storage.dump.sol @@ -148,6 +148,7 @@ library AccountRBAC { bytes32 internal constant _REWARDS_PERMISSION = "REWARDS"; bytes32 internal constant _PERPS_MODIFY_COLLATERAL_PERMISSION = "PERPS_MODIFY_COLLATERAL"; bytes32 internal constant _PERPS_COMMIT_ASYNC_ORDER_PERMISSION = "PERPS_COMMIT_ASYNC_ORDER"; + bytes32 internal constant _BURN_PERMISSION = "BURN"; struct Data { address owner; mapping(address => SetUtil.Bytes32Set) permissions; @@ -535,7 +536,7 @@ interface IAsyncOrderSettlementModule { uint256 referralFees; uint256 feeCollectorFees; Position.Data newPosition; - PerpsMarket.MarketUpdateData updateData; + MarketUpdate.Data updateData; } } @@ -657,6 +658,25 @@ library GlobalPerpsMarketConfiguration { } } +// @custom:artifact contracts/storage/Liquidation.sol:Liquidation +library Liquidation { + struct Data { + uint128 amount; + uint256 timestamp; + } +} + +// @custom:artifact contracts/storage/MarketUpdate.sol:MarketUpdate +library MarketUpdate { + struct Data { + uint128 marketId; + int256 skew; + uint256 size; + int256 currentFundingRate; + int256 currentFundingVelocity; + } +} + // @custom:artifact contracts/storage/OrderFee.sol:OrderFee library OrderFee { struct Data { @@ -692,18 +712,12 @@ library PerpsMarket { int256 lastFundingRate; int256 lastFundingValue; uint256 lastFundingTime; - uint128 lastTimeLiquidationCapacityUpdated; - uint128 lastUtilizedLiquidationCapacity; + uint128 __unused_1; + uint128 __unused_2; int256 debtCorrectionAccumulator; mapping(uint => AsyncOrder.Data) asyncOrders; mapping(uint => Position.Data) positions; - } - struct MarketUpdateData { - uint128 marketId; - int256 skew; - uint256 size; - int256 currentFundingRate; - int256 currentFundingVelocity; + Liquidation.Data[] liquidationData; } function load(uint128 marketId) internal pure returns (Data storage market) { bytes32 s = keccak256(abi.encode("io.synthetix.perps-market.PerpsMarket", marketId)); diff --git a/markets/perps-market/subgraph/base-goerli-competition/generated/PerpsMarketProxy/PerpsMarketProxy.ts b/markets/perps-market/subgraph/base-goerli-competition/generated/PerpsMarketProxy/PerpsMarketProxy.ts new file mode 100644 index 0000000000..82a382f097 --- /dev/null +++ b/markets/perps-market/subgraph/base-goerli-competition/generated/PerpsMarketProxy/PerpsMarketProxy.ts @@ -0,0 +1,4729 @@ +// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. + +import { + ethereum, + JSONValue, + TypedMap, + Entity, + Bytes, + Address, + BigInt, +} from '@graphprotocol/graph-ts'; + +export class AccountCreated extends ethereum.Event { + get params(): AccountCreated__Params { + return new AccountCreated__Params(this); + } +} + +export class AccountCreated__Params { + _event: AccountCreated; + + constructor(event: AccountCreated) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get owner(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class PermissionGranted extends ethereum.Event { + get params(): PermissionGranted__Params { + return new PermissionGranted__Params(this); + } +} + +export class PermissionGranted__Params { + _event: PermissionGranted; + + constructor(event: PermissionGranted) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get permission(): Bytes { + return this._event.parameters[1].value.toBytes(); + } + + get user(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get sender(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class PermissionRevoked extends ethereum.Event { + get params(): PermissionRevoked__Params { + return new PermissionRevoked__Params(this); + } +} + +export class PermissionRevoked__Params { + _event: PermissionRevoked; + + constructor(event: PermissionRevoked) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get permission(): Bytes { + return this._event.parameters[1].value.toBytes(); + } + + get user(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get sender(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class AssociatedSystemSet extends ethereum.Event { + get params(): AssociatedSystemSet__Params { + return new AssociatedSystemSet__Params(this); + } +} + +export class AssociatedSystemSet__Params { + _event: AssociatedSystemSet; + + constructor(event: AssociatedSystemSet) { + this._event = event; + } + + get kind(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get id(): Bytes { + return this._event.parameters[1].value.toBytes(); + } + + get proxy(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get impl(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class OwnerChanged extends ethereum.Event { + get params(): OwnerChanged__Params { + return new OwnerChanged__Params(this); + } +} + +export class OwnerChanged__Params { + _event: OwnerChanged; + + constructor(event: OwnerChanged) { + this._event = event; + } + + get oldOwner(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get newOwner(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class OwnerNominated extends ethereum.Event { + get params(): OwnerNominated__Params { + return new OwnerNominated__Params(this); + } +} + +export class OwnerNominated__Params { + _event: OwnerNominated; + + constructor(event: OwnerNominated) { + this._event = event; + } + + get newOwner(): Address { + return this._event.parameters[0].value.toAddress(); + } +} + +export class Upgraded extends ethereum.Event { + get params(): Upgraded__Params { + return new Upgraded__Params(this); + } +} + +export class Upgraded__Params { + _event: Upgraded; + + constructor(event: Upgraded) { + this._event = event; + } + + get self(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get implementation(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class FactoryInitialized extends ethereum.Event { + get params(): FactoryInitialized__Params { + return new FactoryInitialized__Params(this); + } +} + +export class FactoryInitialized__Params { + _event: FactoryInitialized; + + constructor(event: FactoryInitialized) { + this._event = event; + } + + get globalPerpsMarketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } +} + +export class MarketCreated extends ethereum.Event { + get params(): MarketCreated__Params { + return new MarketCreated__Params(this); + } +} + +export class MarketCreated__Params { + _event: MarketCreated; + + constructor(event: MarketCreated) { + this._event = event; + } + + get perpsMarketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get marketName(): string { + return this._event.parameters[1].value.toString(); + } + + get marketSymbol(): string { + return this._event.parameters[2].value.toString(); + } +} + +export class CollateralModified extends ethereum.Event { + get params(): CollateralModified__Params { + return new CollateralModified__Params(this); + } +} + +export class CollateralModified__Params { + _event: CollateralModified; + + constructor(event: CollateralModified) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get synthMarketId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get amountDelta(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class OrderCommitted extends ethereum.Event { + get params(): OrderCommitted__Params { + return new OrderCommitted__Params(this); + } +} + +export class OrderCommitted__Params { + _event: OrderCommitted; + + constructor(event: OrderCommitted) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get accountId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get orderType(): i32 { + return this._event.parameters[2].value.toI32(); + } + + get sizeDelta(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get acceptablePrice(): BigInt { + return this._event.parameters[4].value.toBigInt(); + } + + get settlementTime(): BigInt { + return this._event.parameters[5].value.toBigInt(); + } + + get expirationTime(): BigInt { + return this._event.parameters[6].value.toBigInt(); + } + + get trackingCode(): Bytes { + return this._event.parameters[7].value.toBytes(); + } + + get sender(): Address { + return this._event.parameters[8].value.toAddress(); + } +} + +export class PreviousOrderExpired extends ethereum.Event { + get params(): PreviousOrderExpired__Params { + return new PreviousOrderExpired__Params(this); + } +} + +export class PreviousOrderExpired__Params { + _event: PreviousOrderExpired; + + constructor(event: PreviousOrderExpired) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get accountId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get sizeDelta(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get acceptablePrice(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get settlementTime(): BigInt { + return this._event.parameters[4].value.toBigInt(); + } + + get trackingCode(): Bytes { + return this._event.parameters[5].value.toBytes(); + } +} + +export class MarketUpdated extends ethereum.Event { + get params(): MarketUpdated__Params { + return new MarketUpdated__Params(this); + } +} + +export class MarketUpdated__Params { + _event: MarketUpdated; + + constructor(event: MarketUpdated) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get price(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get skew(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get size(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get sizeDelta(): BigInt { + return this._event.parameters[4].value.toBigInt(); + } + + get currentFundingRate(): BigInt { + return this._event.parameters[5].value.toBigInt(); + } + + get currentFundingVelocity(): BigInt { + return this._event.parameters[6].value.toBigInt(); + } +} + +export class OrderSettled extends ethereum.Event { + get params(): OrderSettled__Params { + return new OrderSettled__Params(this); + } +} + +export class OrderSettled__Params { + _event: OrderSettled; + + constructor(event: OrderSettled) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get accountId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get fillPrice(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get pnl(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get accruedFunding(): BigInt { + return this._event.parameters[4].value.toBigInt(); + } + + get sizeDelta(): BigInt { + return this._event.parameters[5].value.toBigInt(); + } + + get newSize(): BigInt { + return this._event.parameters[6].value.toBigInt(); + } + + get totalFees(): BigInt { + return this._event.parameters[7].value.toBigInt(); + } + + get referralFees(): BigInt { + return this._event.parameters[8].value.toBigInt(); + } + + get collectedFees(): BigInt { + return this._event.parameters[9].value.toBigInt(); + } + + get settlementReward(): BigInt { + return this._event.parameters[10].value.toBigInt(); + } + + get trackingCode(): Bytes { + return this._event.parameters[11].value.toBytes(); + } + + get settler(): Address { + return this._event.parameters[12].value.toAddress(); + } +} + +export class FeatureFlagAllowAllSet extends ethereum.Event { + get params(): FeatureFlagAllowAllSet__Params { + return new FeatureFlagAllowAllSet__Params(this); + } +} + +export class FeatureFlagAllowAllSet__Params { + _event: FeatureFlagAllowAllSet; + + constructor(event: FeatureFlagAllowAllSet) { + this._event = event; + } + + get feature(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get allowAll(): boolean { + return this._event.parameters[1].value.toBoolean(); + } +} + +export class FeatureFlagAllowlistAdded extends ethereum.Event { + get params(): FeatureFlagAllowlistAdded__Params { + return new FeatureFlagAllowlistAdded__Params(this); + } +} + +export class FeatureFlagAllowlistAdded__Params { + _event: FeatureFlagAllowlistAdded; + + constructor(event: FeatureFlagAllowlistAdded) { + this._event = event; + } + + get feature(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get account(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class FeatureFlagAllowlistRemoved extends ethereum.Event { + get params(): FeatureFlagAllowlistRemoved__Params { + return new FeatureFlagAllowlistRemoved__Params(this); + } +} + +export class FeatureFlagAllowlistRemoved__Params { + _event: FeatureFlagAllowlistRemoved; + + constructor(event: FeatureFlagAllowlistRemoved) { + this._event = event; + } + + get feature(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get account(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class FeatureFlagDeniersReset extends ethereum.Event { + get params(): FeatureFlagDeniersReset__Params { + return new FeatureFlagDeniersReset__Params(this); + } +} + +export class FeatureFlagDeniersReset__Params { + _event: FeatureFlagDeniersReset; + + constructor(event: FeatureFlagDeniersReset) { + this._event = event; + } + + get feature(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get deniers(): Array
{ + return this._event.parameters[1].value.toAddressArray(); + } +} + +export class FeatureFlagDenyAllSet extends ethereum.Event { + get params(): FeatureFlagDenyAllSet__Params { + return new FeatureFlagDenyAllSet__Params(this); + } +} + +export class FeatureFlagDenyAllSet__Params { + _event: FeatureFlagDenyAllSet; + + constructor(event: FeatureFlagDenyAllSet) { + this._event = event; + } + + get feature(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get denyAll(): boolean { + return this._event.parameters[1].value.toBoolean(); + } +} + +export class AccountLiquidated extends ethereum.Event { + get params(): AccountLiquidated__Params { + return new AccountLiquidated__Params(this); + } +} + +export class AccountLiquidated__Params { + _event: AccountLiquidated; + + constructor(event: AccountLiquidated) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get reward(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get fullLiquidation(): boolean { + return this._event.parameters[2].value.toBoolean(); + } +} + +export class PositionLiquidated extends ethereum.Event { + get params(): PositionLiquidated__Params { + return new PositionLiquidated__Params(this); + } +} + +export class PositionLiquidated__Params { + _event: PositionLiquidated; + + constructor(event: PositionLiquidated) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get marketId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get amountLiquidated(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get currentPositionSize(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } +} + +export class FundingParametersSet extends ethereum.Event { + get params(): FundingParametersSet__Params { + return new FundingParametersSet__Params(this); + } +} + +export class FundingParametersSet__Params { + _event: FundingParametersSet; + + constructor(event: FundingParametersSet) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get skewScale(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get maxFundingVelocity(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +export class LiquidationParametersSet extends ethereum.Event { + get params(): LiquidationParametersSet__Params { + return new LiquidationParametersSet__Params(this); + } +} + +export class LiquidationParametersSet__Params { + _event: LiquidationParametersSet; + + constructor(event: LiquidationParametersSet) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get initialMarginRatioD18(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get maintenanceMarginRatioD18(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get minimumInitialMarginRatioD18(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get liquidationRewardRatioD18(): BigInt { + return this._event.parameters[4].value.toBigInt(); + } + + get minimumPositionMargin(): BigInt { + return this._event.parameters[5].value.toBigInt(); + } +} + +export class LockedOiRatioSet extends ethereum.Event { + get params(): LockedOiRatioSet__Params { + return new LockedOiRatioSet__Params(this); + } +} + +export class LockedOiRatioSet__Params { + _event: LockedOiRatioSet; + + constructor(event: LockedOiRatioSet) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get lockedOiRatioD18(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class MarketPriceDataUpdated extends ethereum.Event { + get params(): MarketPriceDataUpdated__Params { + return new MarketPriceDataUpdated__Params(this); + } +} + +export class MarketPriceDataUpdated__Params { + _event: MarketPriceDataUpdated; + + constructor(event: MarketPriceDataUpdated) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get feedId(): Bytes { + return this._event.parameters[1].value.toBytes(); + } +} + +export class MaxLiquidationParametersSet extends ethereum.Event { + get params(): MaxLiquidationParametersSet__Params { + return new MaxLiquidationParametersSet__Params(this); + } +} + +export class MaxLiquidationParametersSet__Params { + _event: MaxLiquidationParametersSet; + + constructor(event: MaxLiquidationParametersSet) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get maxLiquidationLimitAccumulationMultiplier(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get maxSecondsInLiquidationWindow(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get maxLiquidationPd(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get endorsedLiquidator(): Address { + return this._event.parameters[4].value.toAddress(); + } +} + +export class MaxMarketSizeSet extends ethereum.Event { + get params(): MaxMarketSizeSet__Params { + return new MaxMarketSizeSet__Params(this); + } +} + +export class MaxMarketSizeSet__Params { + _event: MaxMarketSizeSet; + + constructor(event: MaxMarketSizeSet) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get maxMarketSize(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class OrderFeesSet extends ethereum.Event { + get params(): OrderFeesSet__Params { + return new OrderFeesSet__Params(this); + } +} + +export class OrderFeesSet__Params { + _event: OrderFeesSet; + + constructor(event: OrderFeesSet) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get makerFeeRatio(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get takerFeeRatio(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +export class SettlementStrategyAdded extends ethereum.Event { + get params(): SettlementStrategyAdded__Params { + return new SettlementStrategyAdded__Params(this); + } +} + +export class SettlementStrategyAdded__Params { + _event: SettlementStrategyAdded; + + constructor(event: SettlementStrategyAdded) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get strategy(): SettlementStrategyAddedStrategyStruct { + return changetype( + this._event.parameters[1].value.toTuple() + ); + } + + get strategyId(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +export class SettlementStrategyAddedStrategyStruct extends ethereum.Tuple { + get strategyType(): i32 { + return this[0].toI32(); + } + + get settlementDelay(): BigInt { + return this[1].toBigInt(); + } + + get settlementWindowDuration(): BigInt { + return this[2].toBigInt(); + } + + get priceWindowDuration(): BigInt { + return this[3].toBigInt(); + } + + get priceVerificationContract(): Address { + return this[4].toAddress(); + } + + get feedId(): Bytes { + return this[5].toBytes(); + } + + get url(): string { + return this[6].toString(); + } + + get settlementReward(): BigInt { + return this[7].toBigInt(); + } + + get disabled(): boolean { + return this[8].toBoolean(); + } +} + +export class SettlementStrategyEnabled extends ethereum.Event { + get params(): SettlementStrategyEnabled__Params { + return new SettlementStrategyEnabled__Params(this); + } +} + +export class SettlementStrategyEnabled__Params { + _event: SettlementStrategyEnabled; + + constructor(event: SettlementStrategyEnabled) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get strategyId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get enabled(): boolean { + return this._event.parameters[2].value.toBoolean(); + } +} + +export class FeeCollectorSet extends ethereum.Event { + get params(): FeeCollectorSet__Params { + return new FeeCollectorSet__Params(this); + } +} + +export class FeeCollectorSet__Params { + _event: FeeCollectorSet; + + constructor(event: FeeCollectorSet) { + this._event = event; + } + + get feeCollector(): Address { + return this._event.parameters[0].value.toAddress(); + } +} + +export class LiquidationRewardGuardsSet extends ethereum.Event { + get params(): LiquidationRewardGuardsSet__Params { + return new LiquidationRewardGuardsSet__Params(this); + } +} + +export class LiquidationRewardGuardsSet__Params { + _event: LiquidationRewardGuardsSet; + + constructor(event: LiquidationRewardGuardsSet) { + this._event = event; + } + + get minLiquidationRewardUsd(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get maxLiquidationRewardUsd(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class MaxCollateralAmountSet extends ethereum.Event { + get params(): MaxCollateralAmountSet__Params { + return new MaxCollateralAmountSet__Params(this); + } +} + +export class MaxCollateralAmountSet__Params { + _event: MaxCollateralAmountSet; + + constructor(event: MaxCollateralAmountSet) { + this._event = event; + } + + get synthMarketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralAmount(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class PerAccountCapsSet extends ethereum.Event { + get params(): PerAccountCapsSet__Params { + return new PerAccountCapsSet__Params(this); + } +} + +export class PerAccountCapsSet__Params { + _event: PerAccountCapsSet; + + constructor(event: PerAccountCapsSet) { + this._event = event; + } + + get maxPositionsPerAccount(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get maxCollateralsPerAccount(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class ReferrerShareUpdated extends ethereum.Event { + get params(): ReferrerShareUpdated__Params { + return new ReferrerShareUpdated__Params(this); + } +} + +export class ReferrerShareUpdated__Params { + _event: ReferrerShareUpdated; + + constructor(event: ReferrerShareUpdated) { + this._event = event; + } + + get referrer(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get shareRatioD18(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class SynthDeductionPrioritySet extends ethereum.Event { + get params(): SynthDeductionPrioritySet__Params { + return new SynthDeductionPrioritySet__Params(this); + } +} + +export class SynthDeductionPrioritySet__Params { + _event: SynthDeductionPrioritySet; + + constructor(event: SynthDeductionPrioritySet) { + this._event = event; + } + + get newSynthDeductionPriority(): Array { + return this._event.parameters[0].value.toBigIntArray(); + } +} + +export class PerpsMarketProxy__getAccountPermissionsResultAccountPermsStruct extends ethereum.Tuple { + get user(): Address { + return this[0].toAddress(); + } + + get permissions(): Array { + return this[1].toBytesArray(); + } +} + +export class PerpsMarketProxy__getAssociatedSystemResult { + value0: Address; + value1: Bytes; + + constructor(value0: Address, value1: Bytes) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromAddress(this.value0)); + map.set('value1', ethereum.Value.fromFixedBytes(this.value1)); + return map; + } + + getAddr(): Address { + return this.value0; + } + + getKind(): Bytes { + return this.value1; + } +} + +export class PerpsMarketProxy__getOpenPositionResult { + value0: BigInt; + value1: BigInt; + value2: BigInt; + + constructor(value0: BigInt, value1: BigInt, value2: BigInt) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromSignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromSignedBigInt(this.value1)); + map.set('value2', ethereum.Value.fromSignedBigInt(this.value2)); + return map; + } + + getTotalPnl(): BigInt { + return this.value0; + } + + getAccruedFunding(): BigInt { + return this.value1; + } + + getPositionSize(): BigInt { + return this.value2; + } +} + +export class PerpsMarketProxy__getRequiredMarginsResult { + value0: BigInt; + value1: BigInt; + value2: BigInt; + value3: BigInt; + + constructor(value0: BigInt, value1: BigInt, value2: BigInt, value3: BigInt) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + this.value3 = value3; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + map.set('value2', ethereum.Value.fromUnsignedBigInt(this.value2)); + map.set('value3', ethereum.Value.fromUnsignedBigInt(this.value3)); + return map; + } + + getRequiredInitialMargin(): BigInt { + return this.value0; + } + + getRequiredMaintenanceMargin(): BigInt { + return this.value1; + } + + getTotalAccumulatedLiquidationRewards(): BigInt { + return this.value2; + } + + getMaxLiquidationReward(): BigInt { + return this.value3; + } +} + +export class PerpsMarketProxy__getMarketSummaryResultSummaryStruct extends ethereum.Tuple { + get skew(): BigInt { + return this[0].toBigInt(); + } + + get size(): BigInt { + return this[1].toBigInt(); + } + + get maxOpenInterest(): BigInt { + return this[2].toBigInt(); + } + + get currentFundingRate(): BigInt { + return this[3].toBigInt(); + } + + get currentFundingVelocity(): BigInt { + return this[4].toBigInt(); + } + + get indexPrice(): BigInt { + return this[5].toBigInt(); + } +} + +export class PerpsMarketProxy__metadataResult { + value0: string; + value1: string; + + constructor(value0: string, value1: string) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromString(this.value0)); + map.set('value1', ethereum.Value.fromString(this.value1)); + return map; + } + + getName(): string { + return this.value0; + } + + getSymbol(): string { + return this.value1; + } +} + +export class PerpsMarketProxy__commitOrderResultRetOrderStruct extends ethereum.Tuple { + get settlementTime(): BigInt { + return this[0].toBigInt(); + } + + get request(): PerpsMarketProxy__commitOrderResultRetOrderRequestStruct { + return changetype(this[1].toTuple()); + } +} + +export class PerpsMarketProxy__commitOrderResultRetOrderRequestStruct extends ethereum.Tuple { + get marketId(): BigInt { + return this[0].toBigInt(); + } + + get accountId(): BigInt { + return this[1].toBigInt(); + } + + get sizeDelta(): BigInt { + return this[2].toBigInt(); + } + + get settlementStrategyId(): BigInt { + return this[3].toBigInt(); + } + + get acceptablePrice(): BigInt { + return this[4].toBigInt(); + } + + get trackingCode(): Bytes { + return this[5].toBytes(); + } + + get referrer(): Address { + return this[6].toAddress(); + } +} + +export class PerpsMarketProxy__commitOrderResult { + value0: PerpsMarketProxy__commitOrderResultRetOrderStruct; + value1: BigInt; + + constructor(value0: PerpsMarketProxy__commitOrderResultRetOrderStruct, value1: BigInt) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromTuple(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + return map; + } + + getRetOrder(): PerpsMarketProxy__commitOrderResultRetOrderStruct { + return this.value0; + } + + getFees(): BigInt { + return this.value1; + } +} + +export class PerpsMarketProxy__commitOrderInputCommitmentStruct extends ethereum.Tuple { + get marketId(): BigInt { + return this[0].toBigInt(); + } + + get accountId(): BigInt { + return this[1].toBigInt(); + } + + get sizeDelta(): BigInt { + return this[2].toBigInt(); + } + + get settlementStrategyId(): BigInt { + return this[3].toBigInt(); + } + + get acceptablePrice(): BigInt { + return this[4].toBigInt(); + } + + get trackingCode(): Bytes { + return this[5].toBytes(); + } + + get referrer(): Address { + return this[6].toAddress(); + } +} + +export class PerpsMarketProxy__computeOrderFeesResult { + value0: BigInt; + value1: BigInt; + + constructor(value0: BigInt, value1: BigInt) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + return map; + } + + getOrderFees(): BigInt { + return this.value0; + } + + getFillPrice(): BigInt { + return this.value1; + } +} + +export class PerpsMarketProxy__getOrderResultOrderStruct extends ethereum.Tuple { + get settlementTime(): BigInt { + return this[0].toBigInt(); + } + + get request(): PerpsMarketProxy__getOrderResultOrderRequestStruct { + return changetype(this[1].toTuple()); + } +} + +export class PerpsMarketProxy__getOrderResultOrderRequestStruct extends ethereum.Tuple { + get marketId(): BigInt { + return this[0].toBigInt(); + } + + get accountId(): BigInt { + return this[1].toBigInt(); + } + + get sizeDelta(): BigInt { + return this[2].toBigInt(); + } + + get settlementStrategyId(): BigInt { + return this[3].toBigInt(); + } + + get acceptablePrice(): BigInt { + return this[4].toBigInt(); + } + + get trackingCode(): Bytes { + return this[5].toBytes(); + } + + get referrer(): Address { + return this[6].toAddress(); + } +} + +export class PerpsMarketProxy__liquidationCapacityResult { + value0: BigInt; + value1: BigInt; + value2: BigInt; + + constructor(value0: BigInt, value1: BigInt, value2: BigInt) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + map.set('value2', ethereum.Value.fromUnsignedBigInt(this.value2)); + return map; + } + + getCapacity(): BigInt { + return this.value0; + } + + getMaxLiquidationInWindow(): BigInt { + return this.value1; + } + + getLatestLiquidationTimestamp(): BigInt { + return this.value2; + } +} + +export class PerpsMarketProxy__addSettlementStrategyInputStrategyStruct extends ethereum.Tuple { + get strategyType(): i32 { + return this[0].toI32(); + } + + get settlementDelay(): BigInt { + return this[1].toBigInt(); + } + + get settlementWindowDuration(): BigInt { + return this[2].toBigInt(); + } + + get priceWindowDuration(): BigInt { + return this[3].toBigInt(); + } + + get priceVerificationContract(): Address { + return this[4].toAddress(); + } + + get feedId(): Bytes { + return this[5].toBytes(); + } + + get url(): string { + return this[6].toString(); + } + + get settlementReward(): BigInt { + return this[7].toBigInt(); + } + + get disabled(): boolean { + return this[8].toBoolean(); + } +} + +export class PerpsMarketProxy__getFundingParametersResult { + value0: BigInt; + value1: BigInt; + + constructor(value0: BigInt, value1: BigInt) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + return map; + } + + getSkewScale(): BigInt { + return this.value0; + } + + getMaxFundingVelocity(): BigInt { + return this.value1; + } +} + +export class PerpsMarketProxy__getLiquidationParametersResult { + value0: BigInt; + value1: BigInt; + value2: BigInt; + value3: BigInt; + value4: BigInt; + + constructor(value0: BigInt, value1: BigInt, value2: BigInt, value3: BigInt, value4: BigInt) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + this.value3 = value3; + this.value4 = value4; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + map.set('value2', ethereum.Value.fromUnsignedBigInt(this.value2)); + map.set('value3', ethereum.Value.fromUnsignedBigInt(this.value3)); + map.set('value4', ethereum.Value.fromUnsignedBigInt(this.value4)); + return map; + } + + getInitialMarginRatioD18(): BigInt { + return this.value0; + } + + getMinimumInitialMarginRatioD18(): BigInt { + return this.value1; + } + + getMaintenanceMarginScalarD18(): BigInt { + return this.value2; + } + + getLiquidationRewardRatioD18(): BigInt { + return this.value3; + } + + getMinimumPositionMargin(): BigInt { + return this.value4; + } +} + +export class PerpsMarketProxy__getMaxLiquidationParametersResult { + value0: BigInt; + value1: BigInt; + value2: BigInt; + value3: Address; + + constructor(value0: BigInt, value1: BigInt, value2: BigInt, value3: Address) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + this.value3 = value3; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + map.set('value2', ethereum.Value.fromUnsignedBigInt(this.value2)); + map.set('value3', ethereum.Value.fromAddress(this.value3)); + return map; + } + + getMaxLiquidationLimitAccumulationMultiplier(): BigInt { + return this.value0; + } + + getMaxSecondsInLiquidationWindow(): BigInt { + return this.value1; + } + + getMaxLiquidationPd(): BigInt { + return this.value2; + } + + getEndorsedLiquidator(): Address { + return this.value3; + } +} + +export class PerpsMarketProxy__getOrderFeesResult { + value0: BigInt; + value1: BigInt; + + constructor(value0: BigInt, value1: BigInt) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + return map; + } + + getMakerFee(): BigInt { + return this.value0; + } + + getTakerFee(): BigInt { + return this.value1; + } +} + +export class PerpsMarketProxy__getSettlementStrategyResultSettlementStrategyStruct extends ethereum.Tuple { + get strategyType(): i32 { + return this[0].toI32(); + } + + get settlementDelay(): BigInt { + return this[1].toBigInt(); + } + + get settlementWindowDuration(): BigInt { + return this[2].toBigInt(); + } + + get priceWindowDuration(): BigInt { + return this[3].toBigInt(); + } + + get priceVerificationContract(): Address { + return this[4].toAddress(); + } + + get feedId(): Bytes { + return this[5].toBytes(); + } + + get url(): string { + return this[6].toString(); + } + + get settlementReward(): BigInt { + return this[7].toBigInt(); + } + + get disabled(): boolean { + return this[8].toBoolean(); + } +} + +export class PerpsMarketProxy__getLiquidationRewardGuardsResult { + value0: BigInt; + value1: BigInt; + + constructor(value0: BigInt, value1: BigInt) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + return map; + } + + getMinLiquidationRewardUsd(): BigInt { + return this.value0; + } + + getMaxLiquidationRewardUsd(): BigInt { + return this.value1; + } +} + +export class PerpsMarketProxy__getPerAccountCapsResult { + value0: BigInt; + value1: BigInt; + + constructor(value0: BigInt, value1: BigInt) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + return map; + } + + getMaxPositionsPerAccount(): BigInt { + return this.value0; + } + + getMaxCollateralsPerAccount(): BigInt { + return this.value1; + } +} + +export class PerpsMarketProxy extends ethereum.SmartContract { + static bind(address: Address): PerpsMarketProxy { + return new PerpsMarketProxy('PerpsMarketProxy', address); + } + + createAccount(): BigInt { + let result = super.call('createAccount', 'createAccount():(uint128)', []); + + return result[0].toBigInt(); + } + + try_createAccount(): ethereum.CallResult { + let result = super.tryCall('createAccount', 'createAccount():(uint128)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getAccountLastInteraction(accountId: BigInt): BigInt { + let result = super.call( + 'getAccountLastInteraction', + 'getAccountLastInteraction(uint128):(uint256)', + [ethereum.Value.fromUnsignedBigInt(accountId)] + ); + + return result[0].toBigInt(); + } + + try_getAccountLastInteraction(accountId: BigInt): ethereum.CallResult { + let result = super.tryCall( + 'getAccountLastInteraction', + 'getAccountLastInteraction(uint128):(uint256)', + [ethereum.Value.fromUnsignedBigInt(accountId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getAccountOwner(accountId: BigInt): Address { + let result = super.call('getAccountOwner', 'getAccountOwner(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ]); + + return result[0].toAddress(); + } + + try_getAccountOwner(accountId: BigInt): ethereum.CallResult
{ + let result = super.tryCall('getAccountOwner', 'getAccountOwner(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + getAccountPermissions( + accountId: BigInt + ): Array { + let result = super.call( + 'getAccountPermissions', + 'getAccountPermissions(uint128):((address,bytes32[])[])', + [ethereum.Value.fromUnsignedBigInt(accountId)] + ); + + return result[0].toTupleArray(); + } + + try_getAccountPermissions( + accountId: BigInt + ): ethereum.CallResult> { + let result = super.tryCall( + 'getAccountPermissions', + 'getAccountPermissions(uint128):((address,bytes32[])[])', + [ethereum.Value.fromUnsignedBigInt(accountId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + value[0].toTupleArray() + ); + } + + getAccountTokenAddress(): Address { + let result = super.call('getAccountTokenAddress', 'getAccountTokenAddress():(address)', []); + + return result[0].toAddress(); + } + + try_getAccountTokenAddress(): ethereum.CallResult
{ + let result = super.tryCall('getAccountTokenAddress', 'getAccountTokenAddress():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + hasPermission(accountId: BigInt, permission: Bytes, user: Address): boolean { + let result = super.call('hasPermission', 'hasPermission(uint128,bytes32,address):(bool)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromFixedBytes(permission), + ethereum.Value.fromAddress(user), + ]); + + return result[0].toBoolean(); + } + + try_hasPermission( + accountId: BigInt, + permission: Bytes, + user: Address + ): ethereum.CallResult { + let result = super.tryCall('hasPermission', 'hasPermission(uint128,bytes32,address):(bool)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromFixedBytes(permission), + ethereum.Value.fromAddress(user), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + isAuthorized(accountId: BigInt, permission: Bytes, user: Address): boolean { + let result = super.call('isAuthorized', 'isAuthorized(uint128,bytes32,address):(bool)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromFixedBytes(permission), + ethereum.Value.fromAddress(user), + ]); + + return result[0].toBoolean(); + } + + try_isAuthorized( + accountId: BigInt, + permission: Bytes, + user: Address + ): ethereum.CallResult { + let result = super.tryCall('isAuthorized', 'isAuthorized(uint128,bytes32,address):(bool)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromFixedBytes(permission), + ethereum.Value.fromAddress(user), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + getAssociatedSystem(id: Bytes): PerpsMarketProxy__getAssociatedSystemResult { + let result = super.call( + 'getAssociatedSystem', + 'getAssociatedSystem(bytes32):(address,bytes32)', + [ethereum.Value.fromFixedBytes(id)] + ); + + return new PerpsMarketProxy__getAssociatedSystemResult( + result[0].toAddress(), + result[1].toBytes() + ); + } + + try_getAssociatedSystem( + id: Bytes + ): ethereum.CallResult { + let result = super.tryCall( + 'getAssociatedSystem', + 'getAssociatedSystem(bytes32):(address,bytes32)', + [ethereum.Value.fromFixedBytes(id)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new PerpsMarketProxy__getAssociatedSystemResult(value[0].toAddress(), value[1].toBytes()) + ); + } + + getImplementation(): Address { + let result = super.call('getImplementation', 'getImplementation():(address)', []); + + return result[0].toAddress(); + } + + try_getImplementation(): ethereum.CallResult
{ + let result = super.tryCall('getImplementation', 'getImplementation():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + nominatedOwner(): Address { + let result = super.call('nominatedOwner', 'nominatedOwner():(address)', []); + + return result[0].toAddress(); + } + + try_nominatedOwner(): ethereum.CallResult
{ + let result = super.tryCall('nominatedOwner', 'nominatedOwner():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + owner(): Address { + let result = super.call('owner', 'owner():(address)', []); + + return result[0].toAddress(); + } + + try_owner(): ethereum.CallResult
{ + let result = super.tryCall('owner', 'owner():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + createMarket(requestedMarketId: BigInt, marketName: string, marketSymbol: string): BigInt { + let result = super.call('createMarket', 'createMarket(uint128,string,string):(uint128)', [ + ethereum.Value.fromUnsignedBigInt(requestedMarketId), + ethereum.Value.fromString(marketName), + ethereum.Value.fromString(marketSymbol), + ]); + + return result[0].toBigInt(); + } + + try_createMarket( + requestedMarketId: BigInt, + marketName: string, + marketSymbol: string + ): ethereum.CallResult { + let result = super.tryCall('createMarket', 'createMarket(uint128,string,string):(uint128)', [ + ethereum.Value.fromUnsignedBigInt(requestedMarketId), + ethereum.Value.fromString(marketName), + ethereum.Value.fromString(marketSymbol), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + initializeFactory(): BigInt { + let result = super.call('initializeFactory', 'initializeFactory():(uint128)', []); + + return result[0].toBigInt(); + } + + try_initializeFactory(): ethereum.CallResult { + let result = super.tryCall('initializeFactory', 'initializeFactory():(uint128)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + minimumCredit(perpsMarketId: BigInt): BigInt { + let result = super.call('minimumCredit', 'minimumCredit(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(perpsMarketId), + ]); + + return result[0].toBigInt(); + } + + try_minimumCredit(perpsMarketId: BigInt): ethereum.CallResult { + let result = super.tryCall('minimumCredit', 'minimumCredit(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(perpsMarketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + name(perpsMarketId: BigInt): string { + let result = super.call('name', 'name(uint128):(string)', [ + ethereum.Value.fromUnsignedBigInt(perpsMarketId), + ]); + + return result[0].toString(); + } + + try_name(perpsMarketId: BigInt): ethereum.CallResult { + let result = super.tryCall('name', 'name(uint128):(string)', [ + ethereum.Value.fromUnsignedBigInt(perpsMarketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toString()); + } + + reportedDebt(perpsMarketId: BigInt): BigInt { + let result = super.call('reportedDebt', 'reportedDebt(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(perpsMarketId), + ]); + + return result[0].toBigInt(); + } + + try_reportedDebt(perpsMarketId: BigInt): ethereum.CallResult { + let result = super.tryCall('reportedDebt', 'reportedDebt(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(perpsMarketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + supportsInterface(interfaceId: Bytes): boolean { + let result = super.call('supportsInterface', 'supportsInterface(bytes4):(bool)', [ + ethereum.Value.fromFixedBytes(interfaceId), + ]); + + return result[0].toBoolean(); + } + + try_supportsInterface(interfaceId: Bytes): ethereum.CallResult { + let result = super.tryCall('supportsInterface', 'supportsInterface(bytes4):(bool)', [ + ethereum.Value.fromFixedBytes(interfaceId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + getAvailableMargin(accountId: BigInt): BigInt { + let result = super.call('getAvailableMargin', 'getAvailableMargin(uint128):(int256)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ]); + + return result[0].toBigInt(); + } + + try_getAvailableMargin(accountId: BigInt): ethereum.CallResult { + let result = super.tryCall('getAvailableMargin', 'getAvailableMargin(uint128):(int256)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getCollateralAmount(accountId: BigInt, synthMarketId: BigInt): BigInt { + let result = super.call( + 'getCollateralAmount', + 'getCollateralAmount(uint128,uint128):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(synthMarketId), + ] + ); + + return result[0].toBigInt(); + } + + try_getCollateralAmount(accountId: BigInt, synthMarketId: BigInt): ethereum.CallResult { + let result = super.tryCall( + 'getCollateralAmount', + 'getCollateralAmount(uint128,uint128):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(synthMarketId), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getOpenPosition(accountId: BigInt, marketId: BigInt): PerpsMarketProxy__getOpenPositionResult { + let result = super.call( + 'getOpenPosition', + 'getOpenPosition(uint128,uint128):(int256,int256,int128)', + [ethereum.Value.fromUnsignedBigInt(accountId), ethereum.Value.fromUnsignedBigInt(marketId)] + ); + + return new PerpsMarketProxy__getOpenPositionResult( + result[0].toBigInt(), + result[1].toBigInt(), + result[2].toBigInt() + ); + } + + try_getOpenPosition( + accountId: BigInt, + marketId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'getOpenPosition', + 'getOpenPosition(uint128,uint128):(int256,int256,int128)', + [ethereum.Value.fromUnsignedBigInt(accountId), ethereum.Value.fromUnsignedBigInt(marketId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new PerpsMarketProxy__getOpenPositionResult( + value[0].toBigInt(), + value[1].toBigInt(), + value[2].toBigInt() + ) + ); + } + + getRequiredMargins(accountId: BigInt): PerpsMarketProxy__getRequiredMarginsResult { + let result = super.call( + 'getRequiredMargins', + 'getRequiredMargins(uint128):(uint256,uint256,uint256,uint256)', + [ethereum.Value.fromUnsignedBigInt(accountId)] + ); + + return new PerpsMarketProxy__getRequiredMarginsResult( + result[0].toBigInt(), + result[1].toBigInt(), + result[2].toBigInt(), + result[3].toBigInt() + ); + } + + try_getRequiredMargins( + accountId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'getRequiredMargins', + 'getRequiredMargins(uint128):(uint256,uint256,uint256,uint256)', + [ethereum.Value.fromUnsignedBigInt(accountId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new PerpsMarketProxy__getRequiredMarginsResult( + value[0].toBigInt(), + value[1].toBigInt(), + value[2].toBigInt(), + value[3].toBigInt() + ) + ); + } + + getWithdrawableMargin(accountId: BigInt): BigInt { + let result = super.call('getWithdrawableMargin', 'getWithdrawableMargin(uint128):(int256)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ]); + + return result[0].toBigInt(); + } + + try_getWithdrawableMargin(accountId: BigInt): ethereum.CallResult { + let result = super.tryCall('getWithdrawableMargin', 'getWithdrawableMargin(uint128):(int256)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + totalAccountOpenInterest(accountId: BigInt): BigInt { + let result = super.call( + 'totalAccountOpenInterest', + 'totalAccountOpenInterest(uint128):(uint256)', + [ethereum.Value.fromUnsignedBigInt(accountId)] + ); + + return result[0].toBigInt(); + } + + try_totalAccountOpenInterest(accountId: BigInt): ethereum.CallResult { + let result = super.tryCall( + 'totalAccountOpenInterest', + 'totalAccountOpenInterest(uint128):(uint256)', + [ethereum.Value.fromUnsignedBigInt(accountId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + totalCollateralValue(accountId: BigInt): BigInt { + let result = super.call('totalCollateralValue', 'totalCollateralValue(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ]); + + return result[0].toBigInt(); + } + + try_totalCollateralValue(accountId: BigInt): ethereum.CallResult { + let result = super.tryCall('totalCollateralValue', 'totalCollateralValue(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + currentFundingRate(marketId: BigInt): BigInt { + let result = super.call('currentFundingRate', 'currentFundingRate(uint128):(int256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBigInt(); + } + + try_currentFundingRate(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('currentFundingRate', 'currentFundingRate(uint128):(int256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + currentFundingVelocity(marketId: BigInt): BigInt { + let result = super.call('currentFundingVelocity', 'currentFundingVelocity(uint128):(int256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBigInt(); + } + + try_currentFundingVelocity(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall( + 'currentFundingVelocity', + 'currentFundingVelocity(uint128):(int256)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + fillPrice(marketId: BigInt, orderSize: BigInt, price: BigInt): BigInt { + let result = super.call('fillPrice', 'fillPrice(uint128,int128,uint256):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromSignedBigInt(orderSize), + ethereum.Value.fromUnsignedBigInt(price), + ]); + + return result[0].toBigInt(); + } + + try_fillPrice(marketId: BigInt, orderSize: BigInt, price: BigInt): ethereum.CallResult { + let result = super.tryCall('fillPrice', 'fillPrice(uint128,int128,uint256):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromSignedBigInt(orderSize), + ethereum.Value.fromUnsignedBigInt(price), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getMarketSummary(marketId: BigInt): PerpsMarketProxy__getMarketSummaryResultSummaryStruct { + let result = super.call( + 'getMarketSummary', + 'getMarketSummary(uint128):((int256,uint256,uint256,int256,int256,uint256))', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + + return changetype(result[0].toTuple()); + } + + try_getMarketSummary( + marketId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'getMarketSummary', + 'getMarketSummary(uint128):((int256,uint256,uint256,int256,int256,uint256))', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + changetype(value[0].toTuple()) + ); + } + + indexPrice(marketId: BigInt): BigInt { + let result = super.call('indexPrice', 'indexPrice(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBigInt(); + } + + try_indexPrice(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('indexPrice', 'indexPrice(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + maxOpenInterest(marketId: BigInt): BigInt { + let result = super.call('maxOpenInterest', 'maxOpenInterest(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBigInt(); + } + + try_maxOpenInterest(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('maxOpenInterest', 'maxOpenInterest(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + metadata(marketId: BigInt): PerpsMarketProxy__metadataResult { + let result = super.call('metadata', 'metadata(uint128):(string,string)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return new PerpsMarketProxy__metadataResult(result[0].toString(), result[1].toString()); + } + + try_metadata(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('metadata', 'metadata(uint128):(string,string)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new PerpsMarketProxy__metadataResult(value[0].toString(), value[1].toString()) + ); + } + + size(marketId: BigInt): BigInt { + let result = super.call('size', 'size(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBigInt(); + } + + try_size(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('size', 'size(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + skew(marketId: BigInt): BigInt { + let result = super.call('skew', 'skew(uint128):(int256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBigInt(); + } + + try_skew(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('skew', 'skew(uint128):(int256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + commitOrder( + commitment: PerpsMarketProxy__commitOrderInputCommitmentStruct + ): PerpsMarketProxy__commitOrderResult { + let result = super.call( + 'commitOrder', + 'commitOrder((uint128,uint128,int128,uint128,uint256,bytes32,address)):((uint256,(uint128,uint128,int128,uint128,uint256,bytes32,address)),uint256)', + [ethereum.Value.fromTuple(commitment)] + ); + + return changetype( + new PerpsMarketProxy__commitOrderResult( + changetype(result[0].toTuple()), + result[1].toBigInt() + ) + ); + } + + try_commitOrder( + commitment: PerpsMarketProxy__commitOrderInputCommitmentStruct + ): ethereum.CallResult { + let result = super.tryCall( + 'commitOrder', + 'commitOrder((uint128,uint128,int128,uint128,uint256,bytes32,address)):((uint256,(uint128,uint128,int128,uint128,uint256,bytes32,address)),uint256)', + [ethereum.Value.fromTuple(commitment)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + changetype( + new PerpsMarketProxy__commitOrderResult( + changetype(value[0].toTuple()), + value[1].toBigInt() + ) + ) + ); + } + + computeOrderFees(marketId: BigInt, sizeDelta: BigInt): PerpsMarketProxy__computeOrderFeesResult { + let result = super.call( + 'computeOrderFees', + 'computeOrderFees(uint128,int128):(uint256,uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromSignedBigInt(sizeDelta)] + ); + + return new PerpsMarketProxy__computeOrderFeesResult(result[0].toBigInt(), result[1].toBigInt()); + } + + try_computeOrderFees( + marketId: BigInt, + sizeDelta: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'computeOrderFees', + 'computeOrderFees(uint128,int128):(uint256,uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromSignedBigInt(sizeDelta)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new PerpsMarketProxy__computeOrderFeesResult(value[0].toBigInt(), value[1].toBigInt()) + ); + } + + getOrder(accountId: BigInt): PerpsMarketProxy__getOrderResultOrderStruct { + let result = super.call( + 'getOrder', + 'getOrder(uint128):((uint256,(uint128,uint128,int128,uint128,uint256,bytes32,address)))', + [ethereum.Value.fromUnsignedBigInt(accountId)] + ); + + return changetype(result[0].toTuple()); + } + + try_getOrder( + accountId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'getOrder', + 'getOrder(uint128):((uint256,(uint128,uint128,int128,uint128,uint256,bytes32,address)))', + [ethereum.Value.fromUnsignedBigInt(accountId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + changetype(value[0].toTuple()) + ); + } + + requiredMarginForOrder(accountId: BigInt, marketId: BigInt, sizeDelta: BigInt): BigInt { + let result = super.call( + 'requiredMarginForOrder', + 'requiredMarginForOrder(uint128,uint128,int128):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromSignedBigInt(sizeDelta), + ] + ); + + return result[0].toBigInt(); + } + + try_requiredMarginForOrder( + accountId: BigInt, + marketId: BigInt, + sizeDelta: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'requiredMarginForOrder', + 'requiredMarginForOrder(uint128,uint128,int128):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromSignedBigInt(sizeDelta), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + PRECISION(): BigInt { + let result = super.call('PRECISION', 'PRECISION():(int256)', []); + + return result[0].toBigInt(); + } + + try_PRECISION(): ethereum.CallResult { + let result = super.tryCall('PRECISION', 'PRECISION():(int256)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getDeniers(feature: Bytes): Array
{ + let result = super.call('getDeniers', 'getDeniers(bytes32):(address[])', [ + ethereum.Value.fromFixedBytes(feature), + ]); + + return result[0].toAddressArray(); + } + + try_getDeniers(feature: Bytes): ethereum.CallResult> { + let result = super.tryCall('getDeniers', 'getDeniers(bytes32):(address[])', [ + ethereum.Value.fromFixedBytes(feature), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddressArray()); + } + + getFeatureFlagAllowAll(feature: Bytes): boolean { + let result = super.call('getFeatureFlagAllowAll', 'getFeatureFlagAllowAll(bytes32):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ]); + + return result[0].toBoolean(); + } + + try_getFeatureFlagAllowAll(feature: Bytes): ethereum.CallResult { + let result = super.tryCall('getFeatureFlagAllowAll', 'getFeatureFlagAllowAll(bytes32):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + getFeatureFlagAllowlist(feature: Bytes): Array
{ + let result = super.call( + 'getFeatureFlagAllowlist', + 'getFeatureFlagAllowlist(bytes32):(address[])', + [ethereum.Value.fromFixedBytes(feature)] + ); + + return result[0].toAddressArray(); + } + + try_getFeatureFlagAllowlist(feature: Bytes): ethereum.CallResult> { + let result = super.tryCall( + 'getFeatureFlagAllowlist', + 'getFeatureFlagAllowlist(bytes32):(address[])', + [ethereum.Value.fromFixedBytes(feature)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddressArray()); + } + + getFeatureFlagDenyAll(feature: Bytes): boolean { + let result = super.call('getFeatureFlagDenyAll', 'getFeatureFlagDenyAll(bytes32):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ]); + + return result[0].toBoolean(); + } + + try_getFeatureFlagDenyAll(feature: Bytes): ethereum.CallResult { + let result = super.tryCall('getFeatureFlagDenyAll', 'getFeatureFlagDenyAll(bytes32):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + isFeatureAllowed(feature: Bytes, account: Address): boolean { + let result = super.call('isFeatureAllowed', 'isFeatureAllowed(bytes32,address):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ethereum.Value.fromAddress(account), + ]); + + return result[0].toBoolean(); + } + + try_isFeatureAllowed(feature: Bytes, account: Address): ethereum.CallResult { + let result = super.tryCall('isFeatureAllowed', 'isFeatureAllowed(bytes32,address):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ethereum.Value.fromAddress(account), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + canLiquidate(accountId: BigInt): boolean { + let result = super.call('canLiquidate', 'canLiquidate(uint128):(bool)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ]); + + return result[0].toBoolean(); + } + + try_canLiquidate(accountId: BigInt): ethereum.CallResult { + let result = super.tryCall('canLiquidate', 'canLiquidate(uint128):(bool)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + liquidate(accountId: BigInt): BigInt { + let result = super.call('liquidate', 'liquidate(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ]); + + return result[0].toBigInt(); + } + + try_liquidate(accountId: BigInt): ethereum.CallResult { + let result = super.tryCall('liquidate', 'liquidate(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + liquidateFlagged(): BigInt { + let result = super.call('liquidateFlagged', 'liquidateFlagged():(uint256)', []); + + return result[0].toBigInt(); + } + + try_liquidateFlagged(): ethereum.CallResult { + let result = super.tryCall('liquidateFlagged', 'liquidateFlagged():(uint256)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + liquidationCapacity(marketId: BigInt): PerpsMarketProxy__liquidationCapacityResult { + let result = super.call( + 'liquidationCapacity', + 'liquidationCapacity(uint128):(uint256,uint256,uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + + return new PerpsMarketProxy__liquidationCapacityResult( + result[0].toBigInt(), + result[1].toBigInt(), + result[2].toBigInt() + ); + } + + try_liquidationCapacity( + marketId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'liquidationCapacity', + 'liquidationCapacity(uint128):(uint256,uint256,uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new PerpsMarketProxy__liquidationCapacityResult( + value[0].toBigInt(), + value[1].toBigInt(), + value[2].toBigInt() + ) + ); + } + + addSettlementStrategy( + marketId: BigInt, + strategy: PerpsMarketProxy__addSettlementStrategyInputStrategyStruct + ): BigInt { + let result = super.call( + 'addSettlementStrategy', + 'addSettlementStrategy(uint128,(uint8,uint256,uint256,uint256,address,bytes32,string,uint256,bool)):(uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromTuple(strategy)] + ); + + return result[0].toBigInt(); + } + + try_addSettlementStrategy( + marketId: BigInt, + strategy: PerpsMarketProxy__addSettlementStrategyInputStrategyStruct + ): ethereum.CallResult { + let result = super.tryCall( + 'addSettlementStrategy', + 'addSettlementStrategy(uint128,(uint8,uint256,uint256,uint256,address,bytes32,string,uint256,bool)):(uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromTuple(strategy)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getFundingParameters(marketId: BigInt): PerpsMarketProxy__getFundingParametersResult { + let result = super.call( + 'getFundingParameters', + 'getFundingParameters(uint128):(uint256,uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + + return new PerpsMarketProxy__getFundingParametersResult( + result[0].toBigInt(), + result[1].toBigInt() + ); + } + + try_getFundingParameters( + marketId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'getFundingParameters', + 'getFundingParameters(uint128):(uint256,uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new PerpsMarketProxy__getFundingParametersResult(value[0].toBigInt(), value[1].toBigInt()) + ); + } + + getLiquidationParameters(marketId: BigInt): PerpsMarketProxy__getLiquidationParametersResult { + let result = super.call( + 'getLiquidationParameters', + 'getLiquidationParameters(uint128):(uint256,uint256,uint256,uint256,uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + + return new PerpsMarketProxy__getLiquidationParametersResult( + result[0].toBigInt(), + result[1].toBigInt(), + result[2].toBigInt(), + result[3].toBigInt(), + result[4].toBigInt() + ); + } + + try_getLiquidationParameters( + marketId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'getLiquidationParameters', + 'getLiquidationParameters(uint128):(uint256,uint256,uint256,uint256,uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new PerpsMarketProxy__getLiquidationParametersResult( + value[0].toBigInt(), + value[1].toBigInt(), + value[2].toBigInt(), + value[3].toBigInt(), + value[4].toBigInt() + ) + ); + } + + getLockedOiRatio(marketId: BigInt): BigInt { + let result = super.call('getLockedOiRatio', 'getLockedOiRatio(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBigInt(); + } + + try_getLockedOiRatio(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('getLockedOiRatio', 'getLockedOiRatio(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getMaxLiquidationParameters( + marketId: BigInt + ): PerpsMarketProxy__getMaxLiquidationParametersResult { + let result = super.call( + 'getMaxLiquidationParameters', + 'getMaxLiquidationParameters(uint128):(uint256,uint256,uint256,address)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + + return new PerpsMarketProxy__getMaxLiquidationParametersResult( + result[0].toBigInt(), + result[1].toBigInt(), + result[2].toBigInt(), + result[3].toAddress() + ); + } + + try_getMaxLiquidationParameters( + marketId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'getMaxLiquidationParameters', + 'getMaxLiquidationParameters(uint128):(uint256,uint256,uint256,address)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new PerpsMarketProxy__getMaxLiquidationParametersResult( + value[0].toBigInt(), + value[1].toBigInt(), + value[2].toBigInt(), + value[3].toAddress() + ) + ); + } + + getMaxMarketSize(marketId: BigInt): BigInt { + let result = super.call('getMaxMarketSize', 'getMaxMarketSize(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBigInt(); + } + + try_getMaxMarketSize(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('getMaxMarketSize', 'getMaxMarketSize(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getOrderFees(marketId: BigInt): PerpsMarketProxy__getOrderFeesResult { + let result = super.call('getOrderFees', 'getOrderFees(uint128):(uint256,uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return new PerpsMarketProxy__getOrderFeesResult(result[0].toBigInt(), result[1].toBigInt()); + } + + try_getOrderFees(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('getOrderFees', 'getOrderFees(uint128):(uint256,uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new PerpsMarketProxy__getOrderFeesResult(value[0].toBigInt(), value[1].toBigInt()) + ); + } + + getSettlementStrategy( + marketId: BigInt, + strategyId: BigInt + ): PerpsMarketProxy__getSettlementStrategyResultSettlementStrategyStruct { + let result = super.call( + 'getSettlementStrategy', + 'getSettlementStrategy(uint128,uint256):((uint8,uint256,uint256,uint256,address,bytes32,string,uint256,bool))', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(strategyId)] + ); + + return changetype( + result[0].toTuple() + ); + } + + try_getSettlementStrategy( + marketId: BigInt, + strategyId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'getSettlementStrategy', + 'getSettlementStrategy(uint128,uint256):((uint8,uint256,uint256,uint256,address,bytes32,string,uint256,bool))', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(strategyId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + changetype( + value[0].toTuple() + ) + ); + } + + getFeeCollector(): Address { + let result = super.call('getFeeCollector', 'getFeeCollector():(address)', []); + + return result[0].toAddress(); + } + + try_getFeeCollector(): ethereum.CallResult
{ + let result = super.tryCall('getFeeCollector', 'getFeeCollector():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + getLiquidationRewardGuards(): PerpsMarketProxy__getLiquidationRewardGuardsResult { + let result = super.call( + 'getLiquidationRewardGuards', + 'getLiquidationRewardGuards():(uint256,uint256)', + [] + ); + + return new PerpsMarketProxy__getLiquidationRewardGuardsResult( + result[0].toBigInt(), + result[1].toBigInt() + ); + } + + try_getLiquidationRewardGuards(): ethereum.CallResult { + let result = super.tryCall( + 'getLiquidationRewardGuards', + 'getLiquidationRewardGuards():(uint256,uint256)', + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new PerpsMarketProxy__getLiquidationRewardGuardsResult( + value[0].toBigInt(), + value[1].toBigInt() + ) + ); + } + + getMarkets(): Array { + let result = super.call('getMarkets', 'getMarkets():(uint256[])', []); + + return result[0].toBigIntArray(); + } + + try_getMarkets(): ethereum.CallResult> { + let result = super.tryCall('getMarkets', 'getMarkets():(uint256[])', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigIntArray()); + } + + getMaxCollateralAmount(synthMarketId: BigInt): BigInt { + let result = super.call('getMaxCollateralAmount', 'getMaxCollateralAmount(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(synthMarketId), + ]); + + return result[0].toBigInt(); + } + + try_getMaxCollateralAmount(synthMarketId: BigInt): ethereum.CallResult { + let result = super.tryCall( + 'getMaxCollateralAmount', + 'getMaxCollateralAmount(uint128):(uint256)', + [ethereum.Value.fromUnsignedBigInt(synthMarketId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getPerAccountCaps(): PerpsMarketProxy__getPerAccountCapsResult { + let result = super.call('getPerAccountCaps', 'getPerAccountCaps():(uint128,uint128)', []); + + return new PerpsMarketProxy__getPerAccountCapsResult( + result[0].toBigInt(), + result[1].toBigInt() + ); + } + + try_getPerAccountCaps(): ethereum.CallResult { + let result = super.tryCall('getPerAccountCaps', 'getPerAccountCaps():(uint128,uint128)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new PerpsMarketProxy__getPerAccountCapsResult(value[0].toBigInt(), value[1].toBigInt()) + ); + } + + getReferrerShare(referrer: Address): BigInt { + let result = super.call('getReferrerShare', 'getReferrerShare(address):(uint256)', [ + ethereum.Value.fromAddress(referrer), + ]); + + return result[0].toBigInt(); + } + + try_getReferrerShare(referrer: Address): ethereum.CallResult { + let result = super.tryCall('getReferrerShare', 'getReferrerShare(address):(uint256)', [ + ethereum.Value.fromAddress(referrer), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getSynthDeductionPriority(): Array { + let result = super.call( + 'getSynthDeductionPriority', + 'getSynthDeductionPriority():(uint128[])', + [] + ); + + return result[0].toBigIntArray(); + } + + try_getSynthDeductionPriority(): ethereum.CallResult> { + let result = super.tryCall( + 'getSynthDeductionPriority', + 'getSynthDeductionPriority():(uint128[])', + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigIntArray()); + } + + totalGlobalCollateralValue(): BigInt { + let result = super.call( + 'totalGlobalCollateralValue', + 'totalGlobalCollateralValue():(uint256)', + [] + ); + + return result[0].toBigInt(); + } + + try_totalGlobalCollateralValue(): ethereum.CallResult { + let result = super.tryCall( + 'totalGlobalCollateralValue', + 'totalGlobalCollateralValue():(uint256)', + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } +} + +export class CreateAccountCall extends ethereum.Call { + get inputs(): CreateAccountCall__Inputs { + return new CreateAccountCall__Inputs(this); + } + + get outputs(): CreateAccountCall__Outputs { + return new CreateAccountCall__Outputs(this); + } +} + +export class CreateAccountCall__Inputs { + _call: CreateAccountCall; + + constructor(call: CreateAccountCall) { + this._call = call; + } +} + +export class CreateAccountCall__Outputs { + _call: CreateAccountCall; + + constructor(call: CreateAccountCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class CreateAccount1Call extends ethereum.Call { + get inputs(): CreateAccount1Call__Inputs { + return new CreateAccount1Call__Inputs(this); + } + + get outputs(): CreateAccount1Call__Outputs { + return new CreateAccount1Call__Outputs(this); + } +} + +export class CreateAccount1Call__Inputs { + _call: CreateAccount1Call; + + constructor(call: CreateAccount1Call) { + this._call = call; + } + + get requestedAccountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class CreateAccount1Call__Outputs { + _call: CreateAccount1Call; + + constructor(call: CreateAccount1Call) { + this._call = call; + } +} + +export class GrantPermissionCall extends ethereum.Call { + get inputs(): GrantPermissionCall__Inputs { + return new GrantPermissionCall__Inputs(this); + } + + get outputs(): GrantPermissionCall__Outputs { + return new GrantPermissionCall__Outputs(this); + } +} + +export class GrantPermissionCall__Inputs { + _call: GrantPermissionCall; + + constructor(call: GrantPermissionCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get permission(): Bytes { + return this._call.inputValues[1].value.toBytes(); + } + + get user(): Address { + return this._call.inputValues[2].value.toAddress(); + } +} + +export class GrantPermissionCall__Outputs { + _call: GrantPermissionCall; + + constructor(call: GrantPermissionCall) { + this._call = call; + } +} + +export class NotifyAccountTransferCall extends ethereum.Call { + get inputs(): NotifyAccountTransferCall__Inputs { + return new NotifyAccountTransferCall__Inputs(this); + } + + get outputs(): NotifyAccountTransferCall__Outputs { + return new NotifyAccountTransferCall__Outputs(this); + } +} + +export class NotifyAccountTransferCall__Inputs { + _call: NotifyAccountTransferCall; + + constructor(call: NotifyAccountTransferCall) { + this._call = call; + } + + get to(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get accountId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class NotifyAccountTransferCall__Outputs { + _call: NotifyAccountTransferCall; + + constructor(call: NotifyAccountTransferCall) { + this._call = call; + } +} + +export class RenouncePermissionCall extends ethereum.Call { + get inputs(): RenouncePermissionCall__Inputs { + return new RenouncePermissionCall__Inputs(this); + } + + get outputs(): RenouncePermissionCall__Outputs { + return new RenouncePermissionCall__Outputs(this); + } +} + +export class RenouncePermissionCall__Inputs { + _call: RenouncePermissionCall; + + constructor(call: RenouncePermissionCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get permission(): Bytes { + return this._call.inputValues[1].value.toBytes(); + } +} + +export class RenouncePermissionCall__Outputs { + _call: RenouncePermissionCall; + + constructor(call: RenouncePermissionCall) { + this._call = call; + } +} + +export class RevokePermissionCall extends ethereum.Call { + get inputs(): RevokePermissionCall__Inputs { + return new RevokePermissionCall__Inputs(this); + } + + get outputs(): RevokePermissionCall__Outputs { + return new RevokePermissionCall__Outputs(this); + } +} + +export class RevokePermissionCall__Inputs { + _call: RevokePermissionCall; + + constructor(call: RevokePermissionCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get permission(): Bytes { + return this._call.inputValues[1].value.toBytes(); + } + + get user(): Address { + return this._call.inputValues[2].value.toAddress(); + } +} + +export class RevokePermissionCall__Outputs { + _call: RevokePermissionCall; + + constructor(call: RevokePermissionCall) { + this._call = call; + } +} + +export class InitOrUpgradeNftCall extends ethereum.Call { + get inputs(): InitOrUpgradeNftCall__Inputs { + return new InitOrUpgradeNftCall__Inputs(this); + } + + get outputs(): InitOrUpgradeNftCall__Outputs { + return new InitOrUpgradeNftCall__Outputs(this); + } +} + +export class InitOrUpgradeNftCall__Inputs { + _call: InitOrUpgradeNftCall; + + constructor(call: InitOrUpgradeNftCall) { + this._call = call; + } + + get id(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get name(): string { + return this._call.inputValues[1].value.toString(); + } + + get symbol(): string { + return this._call.inputValues[2].value.toString(); + } + + get uri(): string { + return this._call.inputValues[3].value.toString(); + } + + get impl(): Address { + return this._call.inputValues[4].value.toAddress(); + } +} + +export class InitOrUpgradeNftCall__Outputs { + _call: InitOrUpgradeNftCall; + + constructor(call: InitOrUpgradeNftCall) { + this._call = call; + } +} + +export class InitOrUpgradeTokenCall extends ethereum.Call { + get inputs(): InitOrUpgradeTokenCall__Inputs { + return new InitOrUpgradeTokenCall__Inputs(this); + } + + get outputs(): InitOrUpgradeTokenCall__Outputs { + return new InitOrUpgradeTokenCall__Outputs(this); + } +} + +export class InitOrUpgradeTokenCall__Inputs { + _call: InitOrUpgradeTokenCall; + + constructor(call: InitOrUpgradeTokenCall) { + this._call = call; + } + + get id(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get name(): string { + return this._call.inputValues[1].value.toString(); + } + + get symbol(): string { + return this._call.inputValues[2].value.toString(); + } + + get decimals(): i32 { + return this._call.inputValues[3].value.toI32(); + } + + get impl(): Address { + return this._call.inputValues[4].value.toAddress(); + } +} + +export class InitOrUpgradeTokenCall__Outputs { + _call: InitOrUpgradeTokenCall; + + constructor(call: InitOrUpgradeTokenCall) { + this._call = call; + } +} + +export class RegisterUnmanagedSystemCall extends ethereum.Call { + get inputs(): RegisterUnmanagedSystemCall__Inputs { + return new RegisterUnmanagedSystemCall__Inputs(this); + } + + get outputs(): RegisterUnmanagedSystemCall__Outputs { + return new RegisterUnmanagedSystemCall__Outputs(this); + } +} + +export class RegisterUnmanagedSystemCall__Inputs { + _call: RegisterUnmanagedSystemCall; + + constructor(call: RegisterUnmanagedSystemCall) { + this._call = call; + } + + get id(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get endpoint(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class RegisterUnmanagedSystemCall__Outputs { + _call: RegisterUnmanagedSystemCall; + + constructor(call: RegisterUnmanagedSystemCall) { + this._call = call; + } +} + +export class MulticallCall extends ethereum.Call { + get inputs(): MulticallCall__Inputs { + return new MulticallCall__Inputs(this); + } + + get outputs(): MulticallCall__Outputs { + return new MulticallCall__Outputs(this); + } +} + +export class MulticallCall__Inputs { + _call: MulticallCall; + + constructor(call: MulticallCall) { + this._call = call; + } + + get data(): Array { + return this._call.inputValues[0].value.toBytesArray(); + } +} + +export class MulticallCall__Outputs { + _call: MulticallCall; + + constructor(call: MulticallCall) { + this._call = call; + } + + get results(): Array { + return this._call.outputValues[0].value.toBytesArray(); + } +} + +export class AcceptOwnershipCall extends ethereum.Call { + get inputs(): AcceptOwnershipCall__Inputs { + return new AcceptOwnershipCall__Inputs(this); + } + + get outputs(): AcceptOwnershipCall__Outputs { + return new AcceptOwnershipCall__Outputs(this); + } +} + +export class AcceptOwnershipCall__Inputs { + _call: AcceptOwnershipCall; + + constructor(call: AcceptOwnershipCall) { + this._call = call; + } +} + +export class AcceptOwnershipCall__Outputs { + _call: AcceptOwnershipCall; + + constructor(call: AcceptOwnershipCall) { + this._call = call; + } +} + +export class NominateNewOwnerCall extends ethereum.Call { + get inputs(): NominateNewOwnerCall__Inputs { + return new NominateNewOwnerCall__Inputs(this); + } + + get outputs(): NominateNewOwnerCall__Outputs { + return new NominateNewOwnerCall__Outputs(this); + } +} + +export class NominateNewOwnerCall__Inputs { + _call: NominateNewOwnerCall; + + constructor(call: NominateNewOwnerCall) { + this._call = call; + } + + get newNominatedOwner(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class NominateNewOwnerCall__Outputs { + _call: NominateNewOwnerCall; + + constructor(call: NominateNewOwnerCall) { + this._call = call; + } +} + +export class RenounceNominationCall extends ethereum.Call { + get inputs(): RenounceNominationCall__Inputs { + return new RenounceNominationCall__Inputs(this); + } + + get outputs(): RenounceNominationCall__Outputs { + return new RenounceNominationCall__Outputs(this); + } +} + +export class RenounceNominationCall__Inputs { + _call: RenounceNominationCall; + + constructor(call: RenounceNominationCall) { + this._call = call; + } +} + +export class RenounceNominationCall__Outputs { + _call: RenounceNominationCall; + + constructor(call: RenounceNominationCall) { + this._call = call; + } +} + +export class SimulateUpgradeToCall extends ethereum.Call { + get inputs(): SimulateUpgradeToCall__Inputs { + return new SimulateUpgradeToCall__Inputs(this); + } + + get outputs(): SimulateUpgradeToCall__Outputs { + return new SimulateUpgradeToCall__Outputs(this); + } +} + +export class SimulateUpgradeToCall__Inputs { + _call: SimulateUpgradeToCall; + + constructor(call: SimulateUpgradeToCall) { + this._call = call; + } + + get newImplementation(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class SimulateUpgradeToCall__Outputs { + _call: SimulateUpgradeToCall; + + constructor(call: SimulateUpgradeToCall) { + this._call = call; + } +} + +export class UpgradeToCall extends ethereum.Call { + get inputs(): UpgradeToCall__Inputs { + return new UpgradeToCall__Inputs(this); + } + + get outputs(): UpgradeToCall__Outputs { + return new UpgradeToCall__Outputs(this); + } +} + +export class UpgradeToCall__Inputs { + _call: UpgradeToCall; + + constructor(call: UpgradeToCall) { + this._call = call; + } + + get newImplementation(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class UpgradeToCall__Outputs { + _call: UpgradeToCall; + + constructor(call: UpgradeToCall) { + this._call = call; + } +} + +export class CreateMarketCall extends ethereum.Call { + get inputs(): CreateMarketCall__Inputs { + return new CreateMarketCall__Inputs(this); + } + + get outputs(): CreateMarketCall__Outputs { + return new CreateMarketCall__Outputs(this); + } +} + +export class CreateMarketCall__Inputs { + _call: CreateMarketCall; + + constructor(call: CreateMarketCall) { + this._call = call; + } + + get requestedMarketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get marketName(): string { + return this._call.inputValues[1].value.toString(); + } + + get marketSymbol(): string { + return this._call.inputValues[2].value.toString(); + } +} + +export class CreateMarketCall__Outputs { + _call: CreateMarketCall; + + constructor(call: CreateMarketCall) { + this._call = call; + } + + get value0(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class InitializeFactoryCall extends ethereum.Call { + get inputs(): InitializeFactoryCall__Inputs { + return new InitializeFactoryCall__Inputs(this); + } + + get outputs(): InitializeFactoryCall__Outputs { + return new InitializeFactoryCall__Outputs(this); + } +} + +export class InitializeFactoryCall__Inputs { + _call: InitializeFactoryCall; + + constructor(call: InitializeFactoryCall) { + this._call = call; + } +} + +export class InitializeFactoryCall__Outputs { + _call: InitializeFactoryCall; + + constructor(call: InitializeFactoryCall) { + this._call = call; + } + + get value0(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class SetSpotMarketCall extends ethereum.Call { + get inputs(): SetSpotMarketCall__Inputs { + return new SetSpotMarketCall__Inputs(this); + } + + get outputs(): SetSpotMarketCall__Outputs { + return new SetSpotMarketCall__Outputs(this); + } +} + +export class SetSpotMarketCall__Inputs { + _call: SetSpotMarketCall; + + constructor(call: SetSpotMarketCall) { + this._call = call; + } + + get spotMarket(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class SetSpotMarketCall__Outputs { + _call: SetSpotMarketCall; + + constructor(call: SetSpotMarketCall) { + this._call = call; + } +} + +export class SetSynthetixCall extends ethereum.Call { + get inputs(): SetSynthetixCall__Inputs { + return new SetSynthetixCall__Inputs(this); + } + + get outputs(): SetSynthetixCall__Outputs { + return new SetSynthetixCall__Outputs(this); + } +} + +export class SetSynthetixCall__Inputs { + _call: SetSynthetixCall; + + constructor(call: SetSynthetixCall) { + this._call = call; + } + + get synthetix(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class SetSynthetixCall__Outputs { + _call: SetSynthetixCall; + + constructor(call: SetSynthetixCall) { + this._call = call; + } +} + +export class ModifyCollateralCall extends ethereum.Call { + get inputs(): ModifyCollateralCall__Inputs { + return new ModifyCollateralCall__Inputs(this); + } + + get outputs(): ModifyCollateralCall__Outputs { + return new ModifyCollateralCall__Outputs(this); + } +} + +export class ModifyCollateralCall__Inputs { + _call: ModifyCollateralCall; + + constructor(call: ModifyCollateralCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get synthMarketId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get amountDelta(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class ModifyCollateralCall__Outputs { + _call: ModifyCollateralCall; + + constructor(call: ModifyCollateralCall) { + this._call = call; + } +} + +export class CommitOrderCall extends ethereum.Call { + get inputs(): CommitOrderCall__Inputs { + return new CommitOrderCall__Inputs(this); + } + + get outputs(): CommitOrderCall__Outputs { + return new CommitOrderCall__Outputs(this); + } +} + +export class CommitOrderCall__Inputs { + _call: CommitOrderCall; + + constructor(call: CommitOrderCall) { + this._call = call; + } + + get commitment(): CommitOrderCallCommitmentStruct { + return changetype(this._call.inputValues[0].value.toTuple()); + } +} + +export class CommitOrderCall__Outputs { + _call: CommitOrderCall; + + constructor(call: CommitOrderCall) { + this._call = call; + } + + get retOrder(): CommitOrderCallRetOrderStruct { + return changetype(this._call.outputValues[0].value.toTuple()); + } + + get fees(): BigInt { + return this._call.outputValues[1].value.toBigInt(); + } +} + +export class CommitOrderCallCommitmentStruct extends ethereum.Tuple { + get marketId(): BigInt { + return this[0].toBigInt(); + } + + get accountId(): BigInt { + return this[1].toBigInt(); + } + + get sizeDelta(): BigInt { + return this[2].toBigInt(); + } + + get settlementStrategyId(): BigInt { + return this[3].toBigInt(); + } + + get acceptablePrice(): BigInt { + return this[4].toBigInt(); + } + + get trackingCode(): Bytes { + return this[5].toBytes(); + } + + get referrer(): Address { + return this[6].toAddress(); + } +} + +export class CommitOrderCallRetOrderStruct extends ethereum.Tuple { + get settlementTime(): BigInt { + return this[0].toBigInt(); + } + + get request(): CommitOrderCallRetOrderRequestStruct { + return changetype(this[1].toTuple()); + } +} + +export class CommitOrderCallRetOrderRequestStruct extends ethereum.Tuple { + get marketId(): BigInt { + return this[0].toBigInt(); + } + + get accountId(): BigInt { + return this[1].toBigInt(); + } + + get sizeDelta(): BigInt { + return this[2].toBigInt(); + } + + get settlementStrategyId(): BigInt { + return this[3].toBigInt(); + } + + get acceptablePrice(): BigInt { + return this[4].toBigInt(); + } + + get trackingCode(): Bytes { + return this[5].toBytes(); + } + + get referrer(): Address { + return this[6].toAddress(); + } +} + +export class SettlePythOrderCall extends ethereum.Call { + get inputs(): SettlePythOrderCall__Inputs { + return new SettlePythOrderCall__Inputs(this); + } + + get outputs(): SettlePythOrderCall__Outputs { + return new SettlePythOrderCall__Outputs(this); + } +} + +export class SettlePythOrderCall__Inputs { + _call: SettlePythOrderCall; + + constructor(call: SettlePythOrderCall) { + this._call = call; + } + + get result(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get extraData(): Bytes { + return this._call.inputValues[1].value.toBytes(); + } +} + +export class SettlePythOrderCall__Outputs { + _call: SettlePythOrderCall; + + constructor(call: SettlePythOrderCall) { + this._call = call; + } +} + +export class AddToFeatureFlagAllowlistCall extends ethereum.Call { + get inputs(): AddToFeatureFlagAllowlistCall__Inputs { + return new AddToFeatureFlagAllowlistCall__Inputs(this); + } + + get outputs(): AddToFeatureFlagAllowlistCall__Outputs { + return new AddToFeatureFlagAllowlistCall__Outputs(this); + } +} + +export class AddToFeatureFlagAllowlistCall__Inputs { + _call: AddToFeatureFlagAllowlistCall; + + constructor(call: AddToFeatureFlagAllowlistCall) { + this._call = call; + } + + get feature(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get account(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class AddToFeatureFlagAllowlistCall__Outputs { + _call: AddToFeatureFlagAllowlistCall; + + constructor(call: AddToFeatureFlagAllowlistCall) { + this._call = call; + } +} + +export class RemoveFromFeatureFlagAllowlistCall extends ethereum.Call { + get inputs(): RemoveFromFeatureFlagAllowlistCall__Inputs { + return new RemoveFromFeatureFlagAllowlistCall__Inputs(this); + } + + get outputs(): RemoveFromFeatureFlagAllowlistCall__Outputs { + return new RemoveFromFeatureFlagAllowlistCall__Outputs(this); + } +} + +export class RemoveFromFeatureFlagAllowlistCall__Inputs { + _call: RemoveFromFeatureFlagAllowlistCall; + + constructor(call: RemoveFromFeatureFlagAllowlistCall) { + this._call = call; + } + + get feature(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get account(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class RemoveFromFeatureFlagAllowlistCall__Outputs { + _call: RemoveFromFeatureFlagAllowlistCall; + + constructor(call: RemoveFromFeatureFlagAllowlistCall) { + this._call = call; + } +} + +export class SetDeniersCall extends ethereum.Call { + get inputs(): SetDeniersCall__Inputs { + return new SetDeniersCall__Inputs(this); + } + + get outputs(): SetDeniersCall__Outputs { + return new SetDeniersCall__Outputs(this); + } +} + +export class SetDeniersCall__Inputs { + _call: SetDeniersCall; + + constructor(call: SetDeniersCall) { + this._call = call; + } + + get feature(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get deniers(): Array
{ + return this._call.inputValues[1].value.toAddressArray(); + } +} + +export class SetDeniersCall__Outputs { + _call: SetDeniersCall; + + constructor(call: SetDeniersCall) { + this._call = call; + } +} + +export class SetFeatureFlagAllowAllCall extends ethereum.Call { + get inputs(): SetFeatureFlagAllowAllCall__Inputs { + return new SetFeatureFlagAllowAllCall__Inputs(this); + } + + get outputs(): SetFeatureFlagAllowAllCall__Outputs { + return new SetFeatureFlagAllowAllCall__Outputs(this); + } +} + +export class SetFeatureFlagAllowAllCall__Inputs { + _call: SetFeatureFlagAllowAllCall; + + constructor(call: SetFeatureFlagAllowAllCall) { + this._call = call; + } + + get feature(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get allowAll(): boolean { + return this._call.inputValues[1].value.toBoolean(); + } +} + +export class SetFeatureFlagAllowAllCall__Outputs { + _call: SetFeatureFlagAllowAllCall; + + constructor(call: SetFeatureFlagAllowAllCall) { + this._call = call; + } +} + +export class SetFeatureFlagDenyAllCall extends ethereum.Call { + get inputs(): SetFeatureFlagDenyAllCall__Inputs { + return new SetFeatureFlagDenyAllCall__Inputs(this); + } + + get outputs(): SetFeatureFlagDenyAllCall__Outputs { + return new SetFeatureFlagDenyAllCall__Outputs(this); + } +} + +export class SetFeatureFlagDenyAllCall__Inputs { + _call: SetFeatureFlagDenyAllCall; + + constructor(call: SetFeatureFlagDenyAllCall) { + this._call = call; + } + + get feature(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get denyAll(): boolean { + return this._call.inputValues[1].value.toBoolean(); + } +} + +export class SetFeatureFlagDenyAllCall__Outputs { + _call: SetFeatureFlagDenyAllCall; + + constructor(call: SetFeatureFlagDenyAllCall) { + this._call = call; + } +} + +export class LiquidateCall extends ethereum.Call { + get inputs(): LiquidateCall__Inputs { + return new LiquidateCall__Inputs(this); + } + + get outputs(): LiquidateCall__Outputs { + return new LiquidateCall__Outputs(this); + } +} + +export class LiquidateCall__Inputs { + _call: LiquidateCall; + + constructor(call: LiquidateCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class LiquidateCall__Outputs { + _call: LiquidateCall; + + constructor(call: LiquidateCall) { + this._call = call; + } + + get liquidationReward(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class LiquidateFlaggedCall extends ethereum.Call { + get inputs(): LiquidateFlaggedCall__Inputs { + return new LiquidateFlaggedCall__Inputs(this); + } + + get outputs(): LiquidateFlaggedCall__Outputs { + return new LiquidateFlaggedCall__Outputs(this); + } +} + +export class LiquidateFlaggedCall__Inputs { + _call: LiquidateFlaggedCall; + + constructor(call: LiquidateFlaggedCall) { + this._call = call; + } +} + +export class LiquidateFlaggedCall__Outputs { + _call: LiquidateFlaggedCall; + + constructor(call: LiquidateFlaggedCall) { + this._call = call; + } + + get liquidationReward(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class AddSettlementStrategyCall extends ethereum.Call { + get inputs(): AddSettlementStrategyCall__Inputs { + return new AddSettlementStrategyCall__Inputs(this); + } + + get outputs(): AddSettlementStrategyCall__Outputs { + return new AddSettlementStrategyCall__Outputs(this); + } +} + +export class AddSettlementStrategyCall__Inputs { + _call: AddSettlementStrategyCall; + + constructor(call: AddSettlementStrategyCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get strategy(): AddSettlementStrategyCallStrategyStruct { + return changetype( + this._call.inputValues[1].value.toTuple() + ); + } +} + +export class AddSettlementStrategyCall__Outputs { + _call: AddSettlementStrategyCall; + + constructor(call: AddSettlementStrategyCall) { + this._call = call; + } + + get strategyId(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class AddSettlementStrategyCallStrategyStruct extends ethereum.Tuple { + get strategyType(): i32 { + return this[0].toI32(); + } + + get settlementDelay(): BigInt { + return this[1].toBigInt(); + } + + get settlementWindowDuration(): BigInt { + return this[2].toBigInt(); + } + + get priceWindowDuration(): BigInt { + return this[3].toBigInt(); + } + + get priceVerificationContract(): Address { + return this[4].toAddress(); + } + + get feedId(): Bytes { + return this[5].toBytes(); + } + + get url(): string { + return this[6].toString(); + } + + get settlementReward(): BigInt { + return this[7].toBigInt(); + } + + get disabled(): boolean { + return this[8].toBoolean(); + } +} + +export class SetFundingParametersCall extends ethereum.Call { + get inputs(): SetFundingParametersCall__Inputs { + return new SetFundingParametersCall__Inputs(this); + } + + get outputs(): SetFundingParametersCall__Outputs { + return new SetFundingParametersCall__Outputs(this); + } +} + +export class SetFundingParametersCall__Inputs { + _call: SetFundingParametersCall; + + constructor(call: SetFundingParametersCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get skewScale(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get maxFundingVelocity(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class SetFundingParametersCall__Outputs { + _call: SetFundingParametersCall; + + constructor(call: SetFundingParametersCall) { + this._call = call; + } +} + +export class SetLiquidationParametersCall extends ethereum.Call { + get inputs(): SetLiquidationParametersCall__Inputs { + return new SetLiquidationParametersCall__Inputs(this); + } + + get outputs(): SetLiquidationParametersCall__Outputs { + return new SetLiquidationParametersCall__Outputs(this); + } +} + +export class SetLiquidationParametersCall__Inputs { + _call: SetLiquidationParametersCall; + + constructor(call: SetLiquidationParametersCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get initialMarginRatioD18(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get minimumInitialMarginRatioD18(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get maintenanceMarginScalarD18(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } + + get liquidationRewardRatioD18(): BigInt { + return this._call.inputValues[4].value.toBigInt(); + } + + get minimumPositionMargin(): BigInt { + return this._call.inputValues[5].value.toBigInt(); + } +} + +export class SetLiquidationParametersCall__Outputs { + _call: SetLiquidationParametersCall; + + constructor(call: SetLiquidationParametersCall) { + this._call = call; + } +} + +export class SetLockedOiRatioCall extends ethereum.Call { + get inputs(): SetLockedOiRatioCall__Inputs { + return new SetLockedOiRatioCall__Inputs(this); + } + + get outputs(): SetLockedOiRatioCall__Outputs { + return new SetLockedOiRatioCall__Outputs(this); + } +} + +export class SetLockedOiRatioCall__Inputs { + _call: SetLockedOiRatioCall; + + constructor(call: SetLockedOiRatioCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get lockedOiRatioD18(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class SetLockedOiRatioCall__Outputs { + _call: SetLockedOiRatioCall; + + constructor(call: SetLockedOiRatioCall) { + this._call = call; + } +} + +export class SetMaxLiquidationParametersCall extends ethereum.Call { + get inputs(): SetMaxLiquidationParametersCall__Inputs { + return new SetMaxLiquidationParametersCall__Inputs(this); + } + + get outputs(): SetMaxLiquidationParametersCall__Outputs { + return new SetMaxLiquidationParametersCall__Outputs(this); + } +} + +export class SetMaxLiquidationParametersCall__Inputs { + _call: SetMaxLiquidationParametersCall; + + constructor(call: SetMaxLiquidationParametersCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get maxLiquidationLimitAccumulationMultiplier(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get maxSecondsInLiquidationWindow(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get maxLiquidationPd(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } + + get endorsedLiquidator(): Address { + return this._call.inputValues[4].value.toAddress(); + } +} + +export class SetMaxLiquidationParametersCall__Outputs { + _call: SetMaxLiquidationParametersCall; + + constructor(call: SetMaxLiquidationParametersCall) { + this._call = call; + } +} + +export class SetMaxMarketSizeCall extends ethereum.Call { + get inputs(): SetMaxMarketSizeCall__Inputs { + return new SetMaxMarketSizeCall__Inputs(this); + } + + get outputs(): SetMaxMarketSizeCall__Outputs { + return new SetMaxMarketSizeCall__Outputs(this); + } +} + +export class SetMaxMarketSizeCall__Inputs { + _call: SetMaxMarketSizeCall; + + constructor(call: SetMaxMarketSizeCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get maxMarketSize(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class SetMaxMarketSizeCall__Outputs { + _call: SetMaxMarketSizeCall; + + constructor(call: SetMaxMarketSizeCall) { + this._call = call; + } +} + +export class SetOrderFeesCall extends ethereum.Call { + get inputs(): SetOrderFeesCall__Inputs { + return new SetOrderFeesCall__Inputs(this); + } + + get outputs(): SetOrderFeesCall__Outputs { + return new SetOrderFeesCall__Outputs(this); + } +} + +export class SetOrderFeesCall__Inputs { + _call: SetOrderFeesCall; + + constructor(call: SetOrderFeesCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get makerFeeRatio(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get takerFeeRatio(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class SetOrderFeesCall__Outputs { + _call: SetOrderFeesCall; + + constructor(call: SetOrderFeesCall) { + this._call = call; + } +} + +export class SetSettlementStrategyEnabledCall extends ethereum.Call { + get inputs(): SetSettlementStrategyEnabledCall__Inputs { + return new SetSettlementStrategyEnabledCall__Inputs(this); + } + + get outputs(): SetSettlementStrategyEnabledCall__Outputs { + return new SetSettlementStrategyEnabledCall__Outputs(this); + } +} + +export class SetSettlementStrategyEnabledCall__Inputs { + _call: SetSettlementStrategyEnabledCall; + + constructor(call: SetSettlementStrategyEnabledCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get strategyId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get enabled(): boolean { + return this._call.inputValues[2].value.toBoolean(); + } +} + +export class SetSettlementStrategyEnabledCall__Outputs { + _call: SetSettlementStrategyEnabledCall; + + constructor(call: SetSettlementStrategyEnabledCall) { + this._call = call; + } +} + +export class UpdatePriceDataCall extends ethereum.Call { + get inputs(): UpdatePriceDataCall__Inputs { + return new UpdatePriceDataCall__Inputs(this); + } + + get outputs(): UpdatePriceDataCall__Outputs { + return new UpdatePriceDataCall__Outputs(this); + } +} + +export class UpdatePriceDataCall__Inputs { + _call: UpdatePriceDataCall; + + constructor(call: UpdatePriceDataCall) { + this._call = call; + } + + get perpsMarketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get feedId(): Bytes { + return this._call.inputValues[1].value.toBytes(); + } +} + +export class UpdatePriceDataCall__Outputs { + _call: UpdatePriceDataCall; + + constructor(call: UpdatePriceDataCall) { + this._call = call; + } +} + +export class SetFeeCollectorCall extends ethereum.Call { + get inputs(): SetFeeCollectorCall__Inputs { + return new SetFeeCollectorCall__Inputs(this); + } + + get outputs(): SetFeeCollectorCall__Outputs { + return new SetFeeCollectorCall__Outputs(this); + } +} + +export class SetFeeCollectorCall__Inputs { + _call: SetFeeCollectorCall; + + constructor(call: SetFeeCollectorCall) { + this._call = call; + } + + get feeCollector(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class SetFeeCollectorCall__Outputs { + _call: SetFeeCollectorCall; + + constructor(call: SetFeeCollectorCall) { + this._call = call; + } +} + +export class SetLiquidationRewardGuardsCall extends ethereum.Call { + get inputs(): SetLiquidationRewardGuardsCall__Inputs { + return new SetLiquidationRewardGuardsCall__Inputs(this); + } + + get outputs(): SetLiquidationRewardGuardsCall__Outputs { + return new SetLiquidationRewardGuardsCall__Outputs(this); + } +} + +export class SetLiquidationRewardGuardsCall__Inputs { + _call: SetLiquidationRewardGuardsCall; + + constructor(call: SetLiquidationRewardGuardsCall) { + this._call = call; + } + + get minLiquidationRewardUsd(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get maxLiquidationRewardUsd(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class SetLiquidationRewardGuardsCall__Outputs { + _call: SetLiquidationRewardGuardsCall; + + constructor(call: SetLiquidationRewardGuardsCall) { + this._call = call; + } +} + +export class SetMaxCollateralAmountCall extends ethereum.Call { + get inputs(): SetMaxCollateralAmountCall__Inputs { + return new SetMaxCollateralAmountCall__Inputs(this); + } + + get outputs(): SetMaxCollateralAmountCall__Outputs { + return new SetMaxCollateralAmountCall__Outputs(this); + } +} + +export class SetMaxCollateralAmountCall__Inputs { + _call: SetMaxCollateralAmountCall; + + constructor(call: SetMaxCollateralAmountCall) { + this._call = call; + } + + get synthMarketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralAmount(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class SetMaxCollateralAmountCall__Outputs { + _call: SetMaxCollateralAmountCall; + + constructor(call: SetMaxCollateralAmountCall) { + this._call = call; + } +} + +export class SetPerAccountCapsCall extends ethereum.Call { + get inputs(): SetPerAccountCapsCall__Inputs { + return new SetPerAccountCapsCall__Inputs(this); + } + + get outputs(): SetPerAccountCapsCall__Outputs { + return new SetPerAccountCapsCall__Outputs(this); + } +} + +export class SetPerAccountCapsCall__Inputs { + _call: SetPerAccountCapsCall; + + constructor(call: SetPerAccountCapsCall) { + this._call = call; + } + + get maxPositionsPerAccount(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get maxCollateralsPerAccount(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class SetPerAccountCapsCall__Outputs { + _call: SetPerAccountCapsCall; + + constructor(call: SetPerAccountCapsCall) { + this._call = call; + } +} + +export class SetSynthDeductionPriorityCall extends ethereum.Call { + get inputs(): SetSynthDeductionPriorityCall__Inputs { + return new SetSynthDeductionPriorityCall__Inputs(this); + } + + get outputs(): SetSynthDeductionPriorityCall__Outputs { + return new SetSynthDeductionPriorityCall__Outputs(this); + } +} + +export class SetSynthDeductionPriorityCall__Inputs { + _call: SetSynthDeductionPriorityCall; + + constructor(call: SetSynthDeductionPriorityCall) { + this._call = call; + } + + get newSynthDeductionPriority(): Array { + return this._call.inputValues[0].value.toBigIntArray(); + } +} + +export class SetSynthDeductionPriorityCall__Outputs { + _call: SetSynthDeductionPriorityCall; + + constructor(call: SetSynthDeductionPriorityCall) { + this._call = call; + } +} + +export class UpdateReferrerShareCall extends ethereum.Call { + get inputs(): UpdateReferrerShareCall__Inputs { + return new UpdateReferrerShareCall__Inputs(this); + } + + get outputs(): UpdateReferrerShareCall__Outputs { + return new UpdateReferrerShareCall__Outputs(this); + } +} + +export class UpdateReferrerShareCall__Inputs { + _call: UpdateReferrerShareCall; + + constructor(call: UpdateReferrerShareCall) { + this._call = call; + } + + get referrer(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get shareRatioD18(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class UpdateReferrerShareCall__Outputs { + _call: UpdateReferrerShareCall; + + constructor(call: UpdateReferrerShareCall) { + this._call = call; + } +} diff --git a/markets/perps-market/subgraph/base-goerli-competition/generated/schema.ts b/markets/perps-market/subgraph/base-goerli-competition/generated/schema.ts new file mode 100644 index 0000000000..d19211d99e --- /dev/null +++ b/markets/perps-market/subgraph/base-goerli-competition/generated/schema.ts @@ -0,0 +1,2184 @@ +// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. + +import { + TypedMap, + Entity, + Value, + ValueKind, + store, + Bytes, + BigInt, + BigDecimal, +} from '@graphprotocol/graph-ts'; + +export class Account extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save Account entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type Account must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('Account', id.toString(), this); + } + } + + static loadInBlock(id: string): Account | null { + return changetype(store.get_in_block('Account', id)); + } + + static load(id: string): Account | null { + return changetype(store.get('Account', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get accountId(): BigInt { + let value = this.get('accountId'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set accountId(value: BigInt) { + this.set('accountId', Value.fromBigInt(value)); + } + + get owner(): string { + let value = this.get('owner'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set owner(value: string) { + this.set('owner', Value.fromString(value)); + } +} + +export class Market extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save Market entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type Market must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('Market', id.toString(), this); + } + } + + static loadInBlock(id: string): Market | null { + return changetype(store.get_in_block('Market', id)); + } + + static load(id: string): Market | null { + return changetype(store.get('Market', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get perpsMarketId(): BigInt { + let value = this.get('perpsMarketId'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set perpsMarketId(value: BigInt) { + this.set('perpsMarketId', Value.fromBigInt(value)); + } + + get marketName(): string | null { + let value = this.get('marketName'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set marketName(value: string | null) { + if (!value) { + this.unset('marketName'); + } else { + this.set('marketName', Value.fromString(value)); + } + } + + get marketSymbol(): string | null { + let value = this.get('marketSymbol'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set marketSymbol(value: string | null) { + if (!value) { + this.unset('marketSymbol'); + } else { + this.set('marketSymbol', Value.fromString(value)); + } + } + + get price(): BigInt | null { + let value = this.get('price'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set price(value: BigInt | null) { + if (!value) { + this.unset('price'); + } else { + this.set('price', Value.fromBigInt(value)); + } + } + + get skew(): BigInt | null { + let value = this.get('skew'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set skew(value: BigInt | null) { + if (!value) { + this.unset('skew'); + } else { + this.set('skew', Value.fromBigInt(value)); + } + } + + get size(): BigInt | null { + let value = this.get('size'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set size(value: BigInt | null) { + if (!value) { + this.unset('size'); + } else { + this.set('size', Value.fromBigInt(value)); + } + } + + get sizeDelta(): BigInt | null { + let value = this.get('sizeDelta'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set sizeDelta(value: BigInt | null) { + if (!value) { + this.unset('sizeDelta'); + } else { + this.set('sizeDelta', Value.fromBigInt(value)); + } + } + + get currentFundingRate(): BigInt | null { + let value = this.get('currentFundingRate'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set currentFundingRate(value: BigInt | null) { + if (!value) { + this.unset('currentFundingRate'); + } else { + this.set('currentFundingRate', Value.fromBigInt(value)); + } + } + + get currentFundingVelocity(): BigInt | null { + let value = this.get('currentFundingVelocity'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set currentFundingVelocity(value: BigInt | null) { + if (!value) { + this.unset('currentFundingVelocity'); + } else { + this.set('currentFundingVelocity', Value.fromBigInt(value)); + } + } + + get feedId(): Bytes | null { + let value = this.get('feedId'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBytes(); + } + } + + set feedId(value: Bytes | null) { + if (!value) { + this.unset('feedId'); + } else { + this.set('feedId', Value.fromBytes(value)); + } + } + + get maxFundingVelocity(): BigInt | null { + let value = this.get('maxFundingVelocity'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set maxFundingVelocity(value: BigInt | null) { + if (!value) { + this.unset('maxFundingVelocity'); + } else { + this.set('maxFundingVelocity', Value.fromBigInt(value)); + } + } + + get skewScale(): BigInt | null { + let value = this.get('skewScale'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set skewScale(value: BigInt | null) { + if (!value) { + this.unset('skewScale'); + } else { + this.set('skewScale', Value.fromBigInt(value)); + } + } + + get lockedOiPercent(): BigInt | null { + let value = this.get('lockedOiPercent'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set lockedOiPercent(value: BigInt | null) { + if (!value) { + this.unset('lockedOiPercent'); + } else { + this.set('lockedOiPercent', Value.fromBigInt(value)); + } + } + + get marketOwner(): string | null { + let value = this.get('marketOwner'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set marketOwner(value: string | null) { + if (!value) { + this.unset('marketOwner'); + } else { + this.set('marketOwner', Value.fromString(value)); + } + } + + get owner(): string | null { + let value = this.get('owner'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set owner(value: string | null) { + if (!value) { + this.unset('owner'); + } else { + this.set('owner', Value.fromString(value)); + } + } + + get initialMarginRatioD18(): BigInt | null { + let value = this.get('initialMarginRatioD18'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set initialMarginRatioD18(value: BigInt | null) { + if (!value) { + this.unset('initialMarginRatioD18'); + } else { + this.set('initialMarginRatioD18', Value.fromBigInt(value)); + } + } + + get maintenanceMarginRatioD18(): BigInt | null { + let value = this.get('maintenanceMarginRatioD18'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set maintenanceMarginRatioD18(value: BigInt | null) { + if (!value) { + this.unset('maintenanceMarginRatioD18'); + } else { + this.set('maintenanceMarginRatioD18', Value.fromBigInt(value)); + } + } + + get liquidationRewardRatioD18(): BigInt | null { + let value = this.get('liquidationRewardRatioD18'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set liquidationRewardRatioD18(value: BigInt | null) { + if (!value) { + this.unset('liquidationRewardRatioD18'); + } else { + this.set('liquidationRewardRatioD18', Value.fromBigInt(value)); + } + } + + get maxSecondsInLiquidationWindow(): BigInt | null { + let value = this.get('maxSecondsInLiquidationWindow'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set maxSecondsInLiquidationWindow(value: BigInt | null) { + if (!value) { + this.unset('maxSecondsInLiquidationWindow'); + } else { + this.set('maxSecondsInLiquidationWindow', Value.fromBigInt(value)); + } + } + + get minimumPositionMargin(): BigInt | null { + let value = this.get('minimumPositionMargin'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set minimumPositionMargin(value: BigInt | null) { + if (!value) { + this.unset('minimumPositionMargin'); + } else { + this.set('minimumPositionMargin', Value.fromBigInt(value)); + } + } + + get maxLiquidationLimitAccumulationMultiplier(): BigInt | null { + let value = this.get('maxLiquidationLimitAccumulationMultiplier'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set maxLiquidationLimitAccumulationMultiplier(value: BigInt | null) { + if (!value) { + this.unset('maxLiquidationLimitAccumulationMultiplier'); + } else { + this.set('maxLiquidationLimitAccumulationMultiplier', Value.fromBigInt(value)); + } + } + + get makerFee(): BigInt | null { + let value = this.get('makerFee'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set makerFee(value: BigInt | null) { + if (!value) { + this.unset('makerFee'); + } else { + this.set('makerFee', Value.fromBigInt(value)); + } + } + + get takerFee(): BigInt | null { + let value = this.get('takerFee'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set takerFee(value: BigInt | null) { + if (!value) { + this.unset('takerFee'); + } else { + this.set('takerFee', Value.fromBigInt(value)); + } + } + + get factoryInitialized(): boolean { + let value = this.get('factoryInitialized'); + if (!value || value.kind == ValueKind.NULL) { + return false; + } else { + return value.toBoolean(); + } + } + + set factoryInitialized(value: boolean) { + this.set('factoryInitialized', Value.fromBoolean(value)); + } +} + +export class Order extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save Order entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type Order must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('Order', id.toString(), this); + } + } + + static loadInBlock(id: string): Order | null { + return changetype(store.get_in_block('Order', id)); + } + + static load(id: string): Order | null { + return changetype(store.get('Order', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get marketId(): BigInt | null { + let value = this.get('marketId'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set marketId(value: BigInt | null) { + if (!value) { + this.unset('marketId'); + } else { + this.set('marketId', Value.fromBigInt(value)); + } + } + + get accountId(): BigInt | null { + let value = this.get('accountId'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set accountId(value: BigInt | null) { + if (!value) { + this.unset('accountId'); + } else { + this.set('accountId', Value.fromBigInt(value)); + } + } + + get amountProvided(): BigInt | null { + let value = this.get('amountProvided'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set amountProvided(value: BigInt | null) { + if (!value) { + this.unset('amountProvided'); + } else { + this.set('amountProvided', Value.fromBigInt(value)); + } + } + + get orderType(): i32 { + let value = this.get('orderType'); + if (!value || value.kind == ValueKind.NULL) { + return 0; + } else { + return value.toI32(); + } + } + + set orderType(value: i32) { + this.set('orderType', Value.fromI32(value)); + } + + get size(): BigInt | null { + let value = this.get('size'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set size(value: BigInt | null) { + if (!value) { + this.unset('size'); + } else { + this.set('size', Value.fromBigInt(value)); + } + } + + get acceptablePrice(): BigInt | null { + let value = this.get('acceptablePrice'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set acceptablePrice(value: BigInt | null) { + if (!value) { + this.unset('acceptablePrice'); + } else { + this.set('acceptablePrice', Value.fromBigInt(value)); + } + } + + get settlementTime(): BigInt | null { + let value = this.get('settlementTime'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set settlementTime(value: BigInt | null) { + if (!value) { + this.unset('settlementTime'); + } else { + this.set('settlementTime', Value.fromBigInt(value)); + } + } + + get expirationTime(): BigInt | null { + let value = this.get('expirationTime'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set expirationTime(value: BigInt | null) { + if (!value) { + this.unset('expirationTime'); + } else { + this.set('expirationTime', Value.fromBigInt(value)); + } + } + + get trackingCode(): Bytes | null { + let value = this.get('trackingCode'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBytes(); + } + } + + set trackingCode(value: Bytes | null) { + if (!value) { + this.unset('trackingCode'); + } else { + this.set('trackingCode', Value.fromBytes(value)); + } + } + + get owner(): string | null { + let value = this.get('owner'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set owner(value: string | null) { + if (!value) { + this.unset('owner'); + } else { + this.set('owner', Value.fromString(value)); + } + } + + get fillPrice(): BigInt | null { + let value = this.get('fillPrice'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set fillPrice(value: BigInt | null) { + if (!value) { + this.unset('fillPrice'); + } else { + this.set('fillPrice', Value.fromBigInt(value)); + } + } + + get accountPnlRealized(): BigInt | null { + let value = this.get('accountPnlRealized'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set accountPnlRealized(value: BigInt | null) { + if (!value) { + this.unset('accountPnlRealized'); + } else { + this.set('accountPnlRealized', Value.fromBigInt(value)); + } + } + + get newSize(): BigInt | null { + let value = this.get('newSize'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set newSize(value: BigInt | null) { + if (!value) { + this.unset('newSize'); + } else { + this.set('newSize', Value.fromBigInt(value)); + } + } + + get collectedFees(): BigInt | null { + let value = this.get('collectedFees'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set collectedFees(value: BigInt | null) { + if (!value) { + this.unset('collectedFees'); + } else { + this.set('collectedFees', Value.fromBigInt(value)); + } + } + + get settlementReward(): BigInt | null { + let value = this.get('settlementReward'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set settlementReward(value: BigInt | null) { + if (!value) { + this.unset('settlementReward'); + } else { + this.set('settlementReward', Value.fromBigInt(value)); + } + } + + get settler(): string | null { + let value = this.get('settler'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set settler(value: string | null) { + if (!value) { + this.unset('settler'); + } else { + this.set('settler', Value.fromString(value)); + } + } + + get block(): BigInt { + let value = this.get('block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set block(value: BigInt) { + this.set('block', Value.fromBigInt(value)); + } + + get timestamp(): BigInt { + let value = this.get('timestamp'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set timestamp(value: BigInt) { + this.set('timestamp', Value.fromBigInt(value)); + } +} + +export class SettlementStrategy extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save SettlementStrategy entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type SettlementStrategy must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('SettlementStrategy', id.toString(), this); + } + } + + static loadInBlock(id: string): SettlementStrategy | null { + return changetype(store.get_in_block('SettlementStrategy', id)); + } + + static load(id: string): SettlementStrategy | null { + return changetype(store.get('SettlementStrategy', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get strategyId(): BigInt { + let value = this.get('strategyId'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set strategyId(value: BigInt) { + this.set('strategyId', Value.fromBigInt(value)); + } + + get marketId(): BigInt { + let value = this.get('marketId'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set marketId(value: BigInt) { + this.set('marketId', Value.fromBigInt(value)); + } + + get enabled(): boolean { + let value = this.get('enabled'); + if (!value || value.kind == ValueKind.NULL) { + return false; + } else { + return value.toBoolean(); + } + } + + set enabled(value: boolean) { + this.set('enabled', Value.fromBoolean(value)); + } + + get strategyType(): i32 { + let value = this.get('strategyType'); + if (!value || value.kind == ValueKind.NULL) { + return 0; + } else { + return value.toI32(); + } + } + + set strategyType(value: i32) { + this.set('strategyType', Value.fromI32(value)); + } + + get settlementDelay(): BigInt | null { + let value = this.get('settlementDelay'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set settlementDelay(value: BigInt | null) { + if (!value) { + this.unset('settlementDelay'); + } else { + this.set('settlementDelay', Value.fromBigInt(value)); + } + } + + get settlementWindowDuration(): BigInt | null { + let value = this.get('settlementWindowDuration'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set settlementWindowDuration(value: BigInt | null) { + if (!value) { + this.unset('settlementWindowDuration'); + } else { + this.set('settlementWindowDuration', Value.fromBigInt(value)); + } + } + + get priceVerificationContract(): string | null { + let value = this.get('priceVerificationContract'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set priceVerificationContract(value: string | null) { + if (!value) { + this.unset('priceVerificationContract'); + } else { + this.set('priceVerificationContract', Value.fromString(value)); + } + } + + get feedId(): Bytes | null { + let value = this.get('feedId'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBytes(); + } + } + + set feedId(value: Bytes | null) { + if (!value) { + this.unset('feedId'); + } else { + this.set('feedId', Value.fromBytes(value)); + } + } + + get url(): string | null { + let value = this.get('url'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set url(value: string | null) { + if (!value) { + this.unset('url'); + } else { + this.set('url', Value.fromString(value)); + } + } + + get settlementReward(): BigInt | null { + let value = this.get('settlementReward'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set settlementReward(value: BigInt | null) { + if (!value) { + this.unset('settlementReward'); + } else { + this.set('settlementReward', Value.fromBigInt(value)); + } + } + + get priceDeviationTolerance(): BigInt | null { + let value = this.get('priceDeviationTolerance'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set priceDeviationTolerance(value: BigInt | null) { + if (!value) { + this.unset('priceDeviationTolerance'); + } else { + this.set('priceDeviationTolerance', Value.fromBigInt(value)); + } + } + + get minimumUsdExchangeAmount(): BigInt | null { + let value = this.get('minimumUsdExchangeAmount'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set minimumUsdExchangeAmount(value: BigInt | null) { + if (!value) { + this.unset('minimumUsdExchangeAmount'); + } else { + this.set('minimumUsdExchangeAmount', Value.fromBigInt(value)); + } + } + + get maxRoundingLoss(): BigInt | null { + let value = this.get('maxRoundingLoss'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set maxRoundingLoss(value: BigInt | null) { + if (!value) { + this.unset('maxRoundingLoss'); + } else { + this.set('maxRoundingLoss', Value.fromBigInt(value)); + } + } +} + +export class ReferrerShare extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save ReferrerShare entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type ReferrerShare must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('ReferrerShare', id.toString(), this); + } + } + + static loadInBlock(id: string): ReferrerShare | null { + return changetype(store.get_in_block('ReferrerShare', id)); + } + + static load(id: string): ReferrerShare | null { + return changetype(store.get('ReferrerShare', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get referrer(): string | null { + let value = this.get('referrer'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set referrer(value: string | null) { + if (!value) { + this.unset('referrer'); + } else { + this.set('referrer', Value.fromString(value)); + } + } + + get shareRatioD18(): BigInt | null { + let value = this.get('shareRatioD18'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set shareRatioD18(value: BigInt | null) { + if (!value) { + this.unset('shareRatioD18'); + } else { + this.set('shareRatioD18', Value.fromBigInt(value)); + } + } +} + +export class GlobalConfiguration extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save GlobalConfiguration entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type GlobalConfiguration must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('GlobalConfiguration', id.toString(), this); + } + } + + static loadInBlock(id: string): GlobalConfiguration | null { + return changetype(store.get_in_block('GlobalConfiguration', id)); + } + + static load(id: string): GlobalConfiguration | null { + return changetype(store.get('GlobalConfiguration', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get feeCollector(): string | null { + let value = this.get('feeCollector'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set feeCollector(value: string | null) { + if (!value) { + this.unset('feeCollector'); + } else { + this.set('feeCollector', Value.fromString(value)); + } + } +} + +export class AccountLiquidated extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save AccountLiquidated entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type AccountLiquidated must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('AccountLiquidated', id.toString(), this); + } + } + + static loadInBlock(id: string): AccountLiquidated | null { + return changetype(store.get_in_block('AccountLiquidated', id)); + } + + static load(id: string): AccountLiquidated | null { + return changetype(store.get('AccountLiquidated', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get timestamp(): BigInt { + let value = this.get('timestamp'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set timestamp(value: BigInt) { + this.set('timestamp', Value.fromBigInt(value)); + } + + get accountId(): BigInt { + let value = this.get('accountId'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set accountId(value: BigInt) { + this.set('accountId', Value.fromBigInt(value)); + } + + get liquidationReward(): BigInt { + let value = this.get('liquidationReward'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set liquidationReward(value: BigInt) { + this.set('liquidationReward', Value.fromBigInt(value)); + } + + get fullyLiquidated(): boolean { + let value = this.get('fullyLiquidated'); + if (!value || value.kind == ValueKind.NULL) { + return false; + } else { + return value.toBoolean(); + } + } + + set fullyLiquidated(value: boolean) { + this.set('fullyLiquidated', Value.fromBoolean(value)); + } +} + +export class PositionLiquidated extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save PositionLiquidated entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type PositionLiquidated must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('PositionLiquidated', id.toString(), this); + } + } + + static loadInBlock(id: string): PositionLiquidated | null { + return changetype(store.get_in_block('PositionLiquidated', id)); + } + + static load(id: string): PositionLiquidated | null { + return changetype(store.get('PositionLiquidated', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get timestamp(): BigInt { + let value = this.get('timestamp'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set timestamp(value: BigInt) { + this.set('timestamp', Value.fromBigInt(value)); + } + + get accountId(): BigInt { + let value = this.get('accountId'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set accountId(value: BigInt) { + this.set('accountId', Value.fromBigInt(value)); + } + + get marketId(): BigInt { + let value = this.get('marketId'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set marketId(value: BigInt) { + this.set('marketId', Value.fromBigInt(value)); + } + + get amountLiquidated(): BigInt { + let value = this.get('amountLiquidated'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set amountLiquidated(value: BigInt) { + this.set('amountLiquidated', Value.fromBigInt(value)); + } + + get currentPositionSize(): BigInt { + let value = this.get('currentPositionSize'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set currentPositionSize(value: BigInt) { + this.set('currentPositionSize', Value.fromBigInt(value)); + } +} + +export class CollateralModified extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save CollateralModified entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type CollateralModified must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('CollateralModified', id.toString(), this); + } + } + + static loadInBlock(id: string): CollateralModified | null { + return changetype(store.get_in_block('CollateralModified', id)); + } + + static load(id: string): CollateralModified | null { + return changetype(store.get('CollateralModified', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get timestamp(): BigInt { + let value = this.get('timestamp'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set timestamp(value: BigInt) { + this.set('timestamp', Value.fromBigInt(value)); + } + + get accountId(): BigInt { + let value = this.get('accountId'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set accountId(value: BigInt) { + this.set('accountId', Value.fromBigInt(value)); + } + + get synthMarketId(): BigInt { + let value = this.get('synthMarketId'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set synthMarketId(value: BigInt) { + this.set('synthMarketId', Value.fromBigInt(value)); + } + + get amount(): BigInt { + let value = this.get('amount'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set amount(value: BigInt) { + this.set('amount', Value.fromBigInt(value)); + } + + get sender(): Bytes { + let value = this.get('sender'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set sender(value: Bytes) { + this.set('sender', Value.fromBytes(value)); + } +} + +export class OrderCommitted extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save OrderCommitted entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type OrderCommitted must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('OrderCommitted', id.toString(), this); + } + } + + static loadInBlock(id: string): OrderCommitted | null { + return changetype(store.get_in_block('OrderCommitted', id)); + } + + static load(id: string): OrderCommitted | null { + return changetype(store.get('OrderCommitted', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get timestamp(): BigInt { + let value = this.get('timestamp'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set timestamp(value: BigInt) { + this.set('timestamp', Value.fromBigInt(value)); + } + + get marketId(): BigInt { + let value = this.get('marketId'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set marketId(value: BigInt) { + this.set('marketId', Value.fromBigInt(value)); + } + + get accountId(): BigInt { + let value = this.get('accountId'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set accountId(value: BigInt) { + this.set('accountId', Value.fromBigInt(value)); + } + + get orderType(): i32 { + let value = this.get('orderType'); + if (!value || value.kind == ValueKind.NULL) { + return 0; + } else { + return value.toI32(); + } + } + + set orderType(value: i32) { + this.set('orderType', Value.fromI32(value)); + } + + get sizeDelta(): BigInt { + let value = this.get('sizeDelta'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set sizeDelta(value: BigInt) { + this.set('sizeDelta', Value.fromBigInt(value)); + } + + get acceptablePrice(): BigInt { + let value = this.get('acceptablePrice'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set acceptablePrice(value: BigInt) { + this.set('acceptablePrice', Value.fromBigInt(value)); + } + + get settlementTime(): BigInt { + let value = this.get('settlementTime'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set settlementTime(value: BigInt) { + this.set('settlementTime', Value.fromBigInt(value)); + } + + get expirationTime(): BigInt { + let value = this.get('expirationTime'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set expirationTime(value: BigInt) { + this.set('expirationTime', Value.fromBigInt(value)); + } + + get trackingCode(): Bytes { + let value = this.get('trackingCode'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set trackingCode(value: Bytes) { + this.set('trackingCode', Value.fromBytes(value)); + } + + get sender(): Bytes { + let value = this.get('sender'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set sender(value: Bytes) { + this.set('sender', Value.fromBytes(value)); + } +} + +export class OrderSettled extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save OrderSettled entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type OrderSettled must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('OrderSettled', id.toString(), this); + } + } + + static loadInBlock(id: string): OrderSettled | null { + return changetype(store.get_in_block('OrderSettled', id)); + } + + static load(id: string): OrderSettled | null { + return changetype(store.get('OrderSettled', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get timestamp(): BigInt { + let value = this.get('timestamp'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set timestamp(value: BigInt) { + this.set('timestamp', Value.fromBigInt(value)); + } + + get marketId(): BigInt { + let value = this.get('marketId'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set marketId(value: BigInt) { + this.set('marketId', Value.fromBigInt(value)); + } + + get accountId(): BigInt { + let value = this.get('accountId'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set accountId(value: BigInt) { + this.set('accountId', Value.fromBigInt(value)); + } + + get fillPrice(): BigInt { + let value = this.get('fillPrice'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set fillPrice(value: BigInt) { + this.set('fillPrice', Value.fromBigInt(value)); + } + + get accruedFunding(): BigInt { + let value = this.get('accruedFunding'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set accruedFunding(value: BigInt) { + this.set('accruedFunding', Value.fromBigInt(value)); + } + + get sizeDelta(): BigInt { + let value = this.get('sizeDelta'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set sizeDelta(value: BigInt) { + this.set('sizeDelta', Value.fromBigInt(value)); + } + + get newSize(): BigInt { + let value = this.get('newSize'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set newSize(value: BigInt) { + this.set('newSize', Value.fromBigInt(value)); + } + + get totalFees(): BigInt { + let value = this.get('totalFees'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set totalFees(value: BigInt) { + this.set('totalFees', Value.fromBigInt(value)); + } + + get referralFees(): BigInt { + let value = this.get('referralFees'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set referralFees(value: BigInt) { + this.set('referralFees', Value.fromBigInt(value)); + } + + get collectedFees(): BigInt { + let value = this.get('collectedFees'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set collectedFees(value: BigInt) { + this.set('collectedFees', Value.fromBigInt(value)); + } + + get settlementReward(): BigInt { + let value = this.get('settlementReward'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set settlementReward(value: BigInt) { + this.set('settlementReward', Value.fromBigInt(value)); + } + + get trackingCode(): Bytes { + let value = this.get('trackingCode'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set trackingCode(value: Bytes) { + this.set('trackingCode', Value.fromBytes(value)); + } + + get settler(): Bytes { + let value = this.get('settler'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set settler(value: Bytes) { + this.set('settler', Value.fromBytes(value)); + } +} + +export class PreviousOrderExpired extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save PreviousOrderExpired entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type PreviousOrderExpired must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('PreviousOrderExpired', id.toString(), this); + } + } + + static loadInBlock(id: string): PreviousOrderExpired | null { + return changetype(store.get_in_block('PreviousOrderExpired', id)); + } + + static load(id: string): PreviousOrderExpired | null { + return changetype(store.get('PreviousOrderExpired', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get timestamp(): BigInt { + let value = this.get('timestamp'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set timestamp(value: BigInt) { + this.set('timestamp', Value.fromBigInt(value)); + } + + get marketId(): BigInt { + let value = this.get('marketId'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set marketId(value: BigInt) { + this.set('marketId', Value.fromBigInt(value)); + } + + get accountId(): BigInt { + let value = this.get('accountId'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set accountId(value: BigInt) { + this.set('accountId', Value.fromBigInt(value)); + } + + get sizeDelta(): BigInt { + let value = this.get('sizeDelta'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set sizeDelta(value: BigInt) { + this.set('sizeDelta', Value.fromBigInt(value)); + } + + get acceptablePrice(): BigInt { + let value = this.get('acceptablePrice'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set acceptablePrice(value: BigInt) { + this.set('acceptablePrice', Value.fromBigInt(value)); + } + + get settlementTime(): BigInt { + let value = this.get('settlementTime'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set settlementTime(value: BigInt) { + this.set('settlementTime', Value.fromBigInt(value)); + } + + get trackingCode(): Bytes { + let value = this.get('trackingCode'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set trackingCode(value: Bytes) { + this.set('trackingCode', Value.fromBytes(value)); + } +} + +export class MarketUpdated extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save MarketUpdated entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type MarketUpdated must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('MarketUpdated', id.toString(), this); + } + } + + static loadInBlock(id: string): MarketUpdated | null { + return changetype(store.get_in_block('MarketUpdated', id)); + } + + static load(id: string): MarketUpdated | null { + return changetype(store.get('MarketUpdated', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get timestamp(): BigInt { + let value = this.get('timestamp'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set timestamp(value: BigInt) { + this.set('timestamp', Value.fromBigInt(value)); + } + + get marketId(): BigInt { + let value = this.get('marketId'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set marketId(value: BigInt) { + this.set('marketId', Value.fromBigInt(value)); + } + + get price(): BigInt { + let value = this.get('price'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set price(value: BigInt) { + this.set('price', Value.fromBigInt(value)); + } + + get skew(): BigInt { + let value = this.get('skew'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set skew(value: BigInt) { + this.set('skew', Value.fromBigInt(value)); + } + + get size(): BigInt { + let value = this.get('size'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set size(value: BigInt) { + this.set('size', Value.fromBigInt(value)); + } + + get sizeDelta(): BigInt { + let value = this.get('sizeDelta'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set sizeDelta(value: BigInt) { + this.set('sizeDelta', Value.fromBigInt(value)); + } + + get currentFundingRate(): BigInt { + let value = this.get('currentFundingRate'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set currentFundingRate(value: BigInt) { + this.set('currentFundingRate', Value.fromBigInt(value)); + } + + get currentFundingVelocity(): BigInt { + let value = this.get('currentFundingVelocity'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set currentFundingVelocity(value: BigInt) { + this.set('currentFundingVelocity', Value.fromBigInt(value)); + } +} diff --git a/markets/perps-market/subgraph/base-goerli-competition/index.ts b/markets/perps-market/subgraph/base-goerli-competition/index.ts new file mode 100644 index 0000000000..c071cea03e --- /dev/null +++ b/markets/perps-market/subgraph/base-goerli-competition/index.ts @@ -0,0 +1,17 @@ +export * from '../optimism-goerli/handleAccountCreated'; +export * from '../optimism-goerli/handleAccountLiquidated'; +export * from '../optimism-goerli/handleCollateralModified'; +export * from '../optimism-goerli/handleFundingParametersSet'; +export * from '../optimism-goerli/handleLiquidationParametersSet'; +export * from '../optimism-goerli/handleLockedOiRatioSet'; +export * from '../optimism-goerli/handleMarketCreated'; +export * from '../optimism-goerli/handleMarketPriceDataUpdated'; +export * from '../optimism-goerli/handleMarketUpdated'; +export * from '../optimism-goerli/handleOrderCommitted'; +export * from '../optimism-goerli/handleOrderFeesSet'; +export * from '../optimism-goerli/handleOrderSettled'; +export * from '../optimism-goerli/handlePositionLiquidated'; +export * from '../optimism-goerli/handlePreviousOrderExpired'; +export * from '../optimism-goerli/handleReferrerShareUpdated'; +export * from '../optimism-goerli/handleSettlementStrategyAdded'; +export * from '../optimism-goerli/handleSettlementStrategyEnabled'; diff --git a/markets/perps-market/subgraph/base-goerli-competition/schema.graphql b/markets/perps-market/subgraph/base-goerli-competition/schema.graphql new file mode 100644 index 0000000000..70eec813e1 --- /dev/null +++ b/markets/perps-market/subgraph/base-goerli-competition/schema.graphql @@ -0,0 +1,167 @@ +type Account @entity { + id: ID! + accountId: BigInt! + owner: String! +} + +type Market @entity { + id: ID! + perpsMarketId: BigInt! + marketName: String + marketSymbol: String + price: BigInt + skew: BigInt + size: BigInt + sizeDelta: BigInt + currentFundingRate: BigInt + currentFundingVelocity: BigInt + feedId: Bytes + maxFundingVelocity: BigInt + skewScale: BigInt + lockedOiPercent: BigInt + marketOwner: String + owner: String + initialMarginRatioD18: BigInt + maintenanceMarginRatioD18: BigInt + liquidationRewardRatioD18: BigInt + maxSecondsInLiquidationWindow: BigInt + minimumPositionMargin: BigInt + maxLiquidationLimitAccumulationMultiplier: BigInt + makerFee: BigInt + takerFee: BigInt + + factoryInitialized: Boolean +} + +type Order @entity { + id: ID! + marketId: BigInt + accountId: BigInt + amountProvided: BigInt + orderType: Int + size: BigInt + acceptablePrice: BigInt + settlementTime: BigInt + expirationTime: BigInt + trackingCode: Bytes + owner: String + + fillPrice: BigInt + accountPnlRealized: BigInt + newSize: BigInt + collectedFees: BigInt + settlementReward: BigInt + settler: String + + block: BigInt! + timestamp: BigInt! +} + +type SettlementStrategy @entity { + id: ID! + strategyId: BigInt! + marketId: BigInt! + enabled: Boolean + strategyType: Int + settlementDelay: BigInt + settlementWindowDuration: BigInt + priceVerificationContract: String + feedId: Bytes + url: String + settlementReward: BigInt + priceDeviationTolerance: BigInt + minimumUsdExchangeAmount: BigInt + maxRoundingLoss: BigInt +} + +type ReferrerShare @entity { + id: ID! + referrer: String + shareRatioD18: BigInt +} + +type GlobalConfiguration @entity { + id: ID! + feeCollector: String +} + +# raw events +type AccountLiquidated @entity { + id: ID! + timestamp: BigInt! + accountId: BigInt! + liquidationReward: BigInt! + fullyLiquidated: Boolean! +} + +type PositionLiquidated @entity { + id: ID! + timestamp: BigInt! + accountId: BigInt! + marketId: BigInt! + amountLiquidated: BigInt! + currentPositionSize: BigInt! +} + +type CollateralModified @entity { + id: ID! + timestamp: BigInt! + accountId: BigInt! + synthMarketId: BigInt! + amount: BigInt! + sender: Bytes! +} + +type OrderCommitted @entity { + id: ID! + timestamp: BigInt! + marketId: BigInt! + accountId: BigInt! + orderType: Int! + sizeDelta: BigInt! + acceptablePrice: BigInt! + settlementTime: BigInt! + expirationTime: BigInt! + trackingCode: Bytes! + sender: Bytes! +} + +type OrderSettled @entity { + id: ID! + timestamp: BigInt! + marketId: BigInt! + accountId: BigInt! + fillPrice: BigInt! + accruedFunding: BigInt! + sizeDelta: BigInt! + newSize: BigInt! + totalFees: BigInt! + referralFees: BigInt! + collectedFees: BigInt! + settlementReward: BigInt! + trackingCode: Bytes! + settler: Bytes! +} + +type PreviousOrderExpired @entity { + id: ID! + timestamp: BigInt! + marketId: BigInt! + accountId: BigInt! + sizeDelta: BigInt! + acceptablePrice: BigInt! + settlementTime: BigInt! + trackingCode: Bytes! +} + +type MarketUpdated @entity { + id: ID! + timestamp: BigInt! + marketId: BigInt! + price: BigInt! + skew: BigInt! + size: BigInt! + sizeDelta: BigInt! + currentFundingRate: BigInt! + currentFundingVelocity: BigInt! +} diff --git a/markets/perps-market/subgraph/codegen.sh b/markets/perps-market/subgraph/codegen.sh new file mode 100755 index 0000000000..26a35e56c3 --- /dev/null +++ b/markets/perps-market/subgraph/codegen.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +codegen() { + namespace=$1 + chainId=$2 + cannonPackage=$3 + cannonPreset=$4 + + echo + echo + echo + echo '>' cannon inspect "$cannonPackage" --preset $cannonPreset --chain-id "$chainId" --write-deployments "./$namespace/deployments" + yarn cannon inspect "$cannonPackage" --preset $cannonPreset --chain-id "$chainId" --write-deployments "./$namespace/deployments" + + echo + echo + echo + echo '>' graph codegen "subgraph.$namespace.yaml" --output-dir "$namespace/generated" + yarn graph codegen "subgraph.$namespace.yaml" --output-dir "$namespace/generated" + yarn prettier --write "$namespace/generated" + + echo + echo + echo + echo '>' graph build "subgraph.$namespace.yaml" --output-dir "./build/$namespace" + yarn graph build "subgraph.$namespace.yaml" --output-dir "./build/$namespace" + yarn prettier --write "subgraph.$namespace.yaml" +} + + +releaseVersion=$(yarn workspace '@synthetixio/perps-market' node -p 'require(`./package.json`).version') + +#codegen mainnet 1 "synthetix-perps-market:$releaseVersion" main +#codegen goerli 5 "synthetix-perps-market:$releaseVersion" main +#codegen optimism-mainnet 10 "synthetix-perps-market:$releaseVersion" main +codegen optimism-goerli 420 "synthetix-perps-market:$releaseVersion" main +#codegen base-goerli 84531 "synthetix-perps-market:$releaseVersion" main +codegen base-goerli-competition 84531 "synthetix-perps-market:latest" competition diff --git a/markets/perps-market/subgraph/optimism-goerli/generated/PerpsMarketProxy/PerpsMarketProxy.ts b/markets/perps-market/subgraph/optimism-goerli/generated/PerpsMarketProxy/PerpsMarketProxy.ts index 38ffcfc1f0..4d2cee9eda 100644 --- a/markets/perps-market/subgraph/optimism-goerli/generated/PerpsMarketProxy/PerpsMarketProxy.ts +++ b/markets/perps-market/subgraph/optimism-goerli/generated/PerpsMarketProxy/PerpsMarketProxy.ts @@ -679,16 +679,8 @@ export class LiquidationParametersSet__Params { return this._event.parameters[4].value.toBigInt(); } - get maxLiquidationLimitAccumulationMultiplier(): BigInt { - return this._event.parameters[5].value.toBigInt(); - } - - get maxSecondsInLiquidationWindow(): BigInt { - return this._event.parameters[6].value.toBigInt(); - } - get minimumPositionMargin(): BigInt { - return this._event.parameters[7].value.toBigInt(); + return this._event.parameters[5].value.toBigInt(); } } @@ -736,6 +728,40 @@ export class MarketPriceDataUpdated__Params { } } +export class MaxLiquidationParametersSet extends ethereum.Event { + get params(): MaxLiquidationParametersSet__Params { + return new MaxLiquidationParametersSet__Params(this); + } +} + +export class MaxLiquidationParametersSet__Params { + _event: MaxLiquidationParametersSet; + + constructor(event: MaxLiquidationParametersSet) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get maxLiquidationLimitAccumulationMultiplier(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get maxSecondsInLiquidationWindow(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get maxLiquidationPd(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get endorsedLiquidator(): Address { + return this._event.parameters[4].value.toAddress(); + } +} + export class MaxMarketSizeSet extends ethereum.Event { get params(): MaxMarketSizeSet__Params { return new MaxMarketSizeSet__Params(this); @@ -942,6 +968,28 @@ export class MaxCollateralAmountSet__Params { } } +export class PerAccountCapsSet extends ethereum.Event { + get params(): PerAccountCapsSet__Params { + return new PerAccountCapsSet__Params(this); + } +} + +export class PerAccountCapsSet__Params { + _event: PerAccountCapsSet; + + constructor(event: PerAccountCapsSet) { + this._event = event; + } + + get maxPositionsPerAccount(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get maxCollateralsPerAccount(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + export class ReferrerShareUpdated extends ethereum.Event { get params(): ReferrerShareUpdated__Params { return new ReferrerShareUpdated__Params(this); @@ -1372,25 +1420,13 @@ export class PerpsMarketProxy__getLiquidationParametersResult { value2: BigInt; value3: BigInt; value4: BigInt; - value5: BigInt; - value6: BigInt; - - constructor( - value0: BigInt, - value1: BigInt, - value2: BigInt, - value3: BigInt, - value4: BigInt, - value5: BigInt, - value6: BigInt - ) { + + constructor(value0: BigInt, value1: BigInt, value2: BigInt, value3: BigInt, value4: BigInt) { this.value0 = value0; this.value1 = value1; this.value2 = value2; this.value3 = value3; this.value4 = value4; - this.value5 = value5; - this.value6 = value6; } toMap(): TypedMap { @@ -1400,8 +1436,6 @@ export class PerpsMarketProxy__getLiquidationParametersResult { map.set('value2', ethereum.Value.fromUnsignedBigInt(this.value2)); map.set('value3', ethereum.Value.fromUnsignedBigInt(this.value3)); map.set('value4', ethereum.Value.fromUnsignedBigInt(this.value4)); - map.set('value5', ethereum.Value.fromUnsignedBigInt(this.value5)); - map.set('value6', ethereum.Value.fromUnsignedBigInt(this.value6)); return map; } @@ -1421,16 +1455,47 @@ export class PerpsMarketProxy__getLiquidationParametersResult { return this.value3; } - getMaxLiquidationLimitAccumulationMultiplier(): BigInt { + getMinimumPositionMargin(): BigInt { return this.value4; } +} + +export class PerpsMarketProxy__getMaxLiquidationParametersResult { + value0: BigInt; + value1: BigInt; + value2: BigInt; + value3: Address; + + constructor(value0: BigInt, value1: BigInt, value2: BigInt, value3: Address) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + this.value3 = value3; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + map.set('value2', ethereum.Value.fromUnsignedBigInt(this.value2)); + map.set('value3', ethereum.Value.fromAddress(this.value3)); + return map; + } + + getMaxLiquidationLimitAccumulationMultiplier(): BigInt { + return this.value0; + } getMaxSecondsInLiquidationWindow(): BigInt { - return this.value5; + return this.value1; } - getMinimumPositionMargin(): BigInt { - return this.value6; + getMaxLiquidationPd(): BigInt { + return this.value2; + } + + getEndorsedLiquidator(): Address { + return this.value3; } } @@ -1526,6 +1591,31 @@ export class PerpsMarketProxy__getLiquidationRewardGuardsResult { } } +export class PerpsMarketProxy__getPerAccountCapsResult { + value0: BigInt; + value1: BigInt; + + constructor(value0: BigInt, value1: BigInt) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + return map; + } + + getMaxPositionsPerAccount(): BigInt { + return this.value0; + } + + getMaxCollateralsPerAccount(): BigInt { + return this.value1; + } +} + export class PerpsMarketProxy extends ethereum.SmartContract { static bind(address: Address): PerpsMarketProxy { return new PerpsMarketProxy('PerpsMarketProxy', address); @@ -1716,6 +1806,40 @@ export class PerpsMarketProxy extends ethereum.SmartContract { ); } + getMessageSender(): Address { + let result = super.call('getMessageSender', 'getMessageSender():(address)', []); + + return result[0].toAddress(); + } + + try_getMessageSender(): ethereum.CallResult
{ + let result = super.tryCall('getMessageSender', 'getMessageSender():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + multicall(data: Array): Array { + let result = super.call('multicall', 'multicall(bytes[]):(bytes[])', [ + ethereum.Value.fromBytesArray(data), + ]); + + return result[0].toBytesArray(); + } + + try_multicall(data: Array): ethereum.CallResult> { + let result = super.tryCall('multicall', 'multicall(bytes[]):(bytes[])', [ + ethereum.Value.fromBytesArray(data), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBytesArray()); + } + getImplementation(): Address { let result = super.call('getImplementation', 'getImplementation():(address)', []); @@ -2493,6 +2617,59 @@ export class PerpsMarketProxy extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBoolean()); } + canLiquidate(accountId: BigInt): boolean { + let result = super.call('canLiquidate', 'canLiquidate(uint128):(bool)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ]); + + return result[0].toBoolean(); + } + + try_canLiquidate(accountId: BigInt): ethereum.CallResult { + let result = super.tryCall('canLiquidate', 'canLiquidate(uint128):(bool)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + liquidate(accountId: BigInt): BigInt { + let result = super.call('liquidate', 'liquidate(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ]); + + return result[0].toBigInt(); + } + + try_liquidate(accountId: BigInt): ethereum.CallResult { + let result = super.tryCall('liquidate', 'liquidate(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + liquidateFlagged(): BigInt { + let result = super.call('liquidateFlagged', 'liquidateFlagged():(uint256)', []); + + return result[0].toBigInt(); + } + + try_liquidateFlagged(): ethereum.CallResult { + let result = super.tryCall('liquidateFlagged', 'liquidateFlagged():(uint256)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + addSettlementStrategy( marketId: BigInt, strategy: PerpsMarketProxy__addSettlementStrategyInputStrategyStruct @@ -2555,7 +2732,7 @@ export class PerpsMarketProxy extends ethereum.SmartContract { getLiquidationParameters(marketId: BigInt): PerpsMarketProxy__getLiquidationParametersResult { let result = super.call( 'getLiquidationParameters', - 'getLiquidationParameters(uint128):(uint256,uint256,uint256,uint256,uint256,uint256,uint256)', + 'getLiquidationParameters(uint128):(uint256,uint256,uint256,uint256,uint256)', [ethereum.Value.fromUnsignedBigInt(marketId)] ); @@ -2564,9 +2741,7 @@ export class PerpsMarketProxy extends ethereum.SmartContract { result[1].toBigInt(), result[2].toBigInt(), result[3].toBigInt(), - result[4].toBigInt(), - result[5].toBigInt(), - result[6].toBigInt() + result[4].toBigInt() ); } @@ -2575,7 +2750,7 @@ export class PerpsMarketProxy extends ethereum.SmartContract { ): ethereum.CallResult { let result = super.tryCall( 'getLiquidationParameters', - 'getLiquidationParameters(uint128):(uint256,uint256,uint256,uint256,uint256,uint256,uint256)', + 'getLiquidationParameters(uint128):(uint256,uint256,uint256,uint256,uint256)', [ethereum.Value.fromUnsignedBigInt(marketId)] ); if (result.reverted) { @@ -2588,9 +2763,7 @@ export class PerpsMarketProxy extends ethereum.SmartContract { value[1].toBigInt(), value[2].toBigInt(), value[3].toBigInt(), - value[4].toBigInt(), - value[5].toBigInt(), - value[6].toBigInt() + value[4].toBigInt() ) ); } @@ -2614,6 +2787,45 @@ export class PerpsMarketProxy extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } + getMaxLiquidationParameters( + marketId: BigInt + ): PerpsMarketProxy__getMaxLiquidationParametersResult { + let result = super.call( + 'getMaxLiquidationParameters', + 'getMaxLiquidationParameters(uint128):(uint256,uint256,uint256,address)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + + return new PerpsMarketProxy__getMaxLiquidationParametersResult( + result[0].toBigInt(), + result[1].toBigInt(), + result[2].toBigInt(), + result[3].toAddress() + ); + } + + try_getMaxLiquidationParameters( + marketId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'getMaxLiquidationParameters', + 'getMaxLiquidationParameters(uint128):(uint256,uint256,uint256,address)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new PerpsMarketProxy__getMaxLiquidationParametersResult( + value[0].toBigInt(), + value[1].toBigInt(), + value[2].toBigInt(), + value[3].toAddress() + ) + ); + } + getMaxMarketSize(marketId: BigInt): BigInt { let result = super.call('getMaxMarketSize', 'getMaxMarketSize(uint128):(uint256)', [ ethereum.Value.fromUnsignedBigInt(marketId), @@ -2771,6 +2983,26 @@ export class PerpsMarketProxy extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } + getPerAccountCaps(): PerpsMarketProxy__getPerAccountCapsResult { + let result = super.call('getPerAccountCaps', 'getPerAccountCaps():(uint128,uint128)', []); + + return new PerpsMarketProxy__getPerAccountCapsResult( + result[0].toBigInt(), + result[1].toBigInt() + ); + } + + try_getPerAccountCaps(): ethereum.CallResult { + let result = super.tryCall('getPerAccountCaps', 'getPerAccountCaps():(uint128,uint128)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new PerpsMarketProxy__getPerAccountCapsResult(value[0].toBigInt(), value[1].toBigInt()) + ); + } + getReferrerShare(referrer: Address): BigInt { let result = super.call('getReferrerShare', 'getReferrerShare(address):(uint256)', [ ethereum.Value.fromAddress(referrer), @@ -3167,6 +3399,116 @@ export class RegisterUnmanagedSystemCall__Outputs { } } +export class MulticallCall extends ethereum.Call { + get inputs(): MulticallCall__Inputs { + return new MulticallCall__Inputs(this); + } + + get outputs(): MulticallCall__Outputs { + return new MulticallCall__Outputs(this); + } +} + +export class MulticallCall__Inputs { + _call: MulticallCall; + + constructor(call: MulticallCall) { + this._call = call; + } + + get data(): Array { + return this._call.inputValues[0].value.toBytesArray(); + } +} + +export class MulticallCall__Outputs { + _call: MulticallCall; + + constructor(call: MulticallCall) { + this._call = call; + } + + get results(): Array { + return this._call.outputValues[0].value.toBytesArray(); + } +} + +export class MulticallThroughCall extends ethereum.Call { + get inputs(): MulticallThroughCall__Inputs { + return new MulticallThroughCall__Inputs(this); + } + + get outputs(): MulticallThroughCall__Outputs { + return new MulticallThroughCall__Outputs(this); + } +} + +export class MulticallThroughCall__Inputs { + _call: MulticallThroughCall; + + constructor(call: MulticallThroughCall) { + this._call = call; + } + + get to(): Array
{ + return this._call.inputValues[0].value.toAddressArray(); + } + + get data(): Array { + return this._call.inputValues[1].value.toBytesArray(); + } + + get values(): Array { + return this._call.inputValues[2].value.toBigIntArray(); + } +} + +export class MulticallThroughCall__Outputs { + _call: MulticallThroughCall; + + constructor(call: MulticallThroughCall) { + this._call = call; + } + + get results(): Array { + return this._call.outputValues[0].value.toBytesArray(); + } +} + +export class SetAllowlistedMulticallTargetCall extends ethereum.Call { + get inputs(): SetAllowlistedMulticallTargetCall__Inputs { + return new SetAllowlistedMulticallTargetCall__Inputs(this); + } + + get outputs(): SetAllowlistedMulticallTargetCall__Outputs { + return new SetAllowlistedMulticallTargetCall__Outputs(this); + } +} + +export class SetAllowlistedMulticallTargetCall__Inputs { + _call: SetAllowlistedMulticallTargetCall; + + constructor(call: SetAllowlistedMulticallTargetCall) { + this._call = call; + } + + get target(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get allowlisted(): boolean { + return this._call.inputValues[1].value.toBoolean(); + } +} + +export class SetAllowlistedMulticallTargetCall__Outputs { + _call: SetAllowlistedMulticallTargetCall; + + constructor(call: SetAllowlistedMulticallTargetCall) { + this._call = call; + } +} + export class AcceptOwnershipCall extends ethereum.Call { get inputs(): AcceptOwnershipCall__Inputs { return new AcceptOwnershipCall__Inputs(this); @@ -3819,6 +4161,10 @@ export class LiquidateCall__Outputs { constructor(call: LiquidateCall) { this._call = call; } + + get liquidationReward(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } } export class LiquidateFlaggedCall extends ethereum.Call { @@ -3845,6 +4191,10 @@ export class LiquidateFlaggedCall__Outputs { constructor(call: LiquidateFlaggedCall) { this._call = call; } + + get liquidationReward(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } } export class AddSettlementStrategyCall extends ethereum.Call { @@ -4004,16 +4354,8 @@ export class SetLiquidationParametersCall__Inputs { return this._call.inputValues[4].value.toBigInt(); } - get maxLiquidationLimitAccumulationMultiplier(): BigInt { - return this._call.inputValues[5].value.toBigInt(); - } - - get maxSecondsInLiquidationWindow(): BigInt { - return this._call.inputValues[6].value.toBigInt(); - } - get minimumPositionMargin(): BigInt { - return this._call.inputValues[7].value.toBigInt(); + return this._call.inputValues[5].value.toBigInt(); } } @@ -4059,6 +4401,52 @@ export class SetLockedOiRatioCall__Outputs { } } +export class SetMaxLiquidationParametersCall extends ethereum.Call { + get inputs(): SetMaxLiquidationParametersCall__Inputs { + return new SetMaxLiquidationParametersCall__Inputs(this); + } + + get outputs(): SetMaxLiquidationParametersCall__Outputs { + return new SetMaxLiquidationParametersCall__Outputs(this); + } +} + +export class SetMaxLiquidationParametersCall__Inputs { + _call: SetMaxLiquidationParametersCall; + + constructor(call: SetMaxLiquidationParametersCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get maxLiquidationLimitAccumulationMultiplier(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get maxSecondsInLiquidationWindow(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get maxLiquidationPd(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } + + get endorsedLiquidator(): Address { + return this._call.inputValues[4].value.toAddress(); + } +} + +export class SetMaxLiquidationParametersCall__Outputs { + _call: SetMaxLiquidationParametersCall; + + constructor(call: SetMaxLiquidationParametersCall) { + this._call = call; + } +} + export class SetMaxMarketSizeCall extends ethereum.Call { get inputs(): SetMaxMarketSizeCall__Inputs { return new SetMaxMarketSizeCall__Inputs(this); @@ -4301,6 +4689,40 @@ export class SetMaxCollateralAmountCall__Outputs { } } +export class SetPerAccountCapsCall extends ethereum.Call { + get inputs(): SetPerAccountCapsCall__Inputs { + return new SetPerAccountCapsCall__Inputs(this); + } + + get outputs(): SetPerAccountCapsCall__Outputs { + return new SetPerAccountCapsCall__Outputs(this); + } +} + +export class SetPerAccountCapsCall__Inputs { + _call: SetPerAccountCapsCall; + + constructor(call: SetPerAccountCapsCall) { + this._call = call; + } + + get maxPositionsPerAccount(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get maxCollateralsPerAccount(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class SetPerAccountCapsCall__Outputs { + _call: SetPerAccountCapsCall; + + constructor(call: SetPerAccountCapsCall) { + this._call = call; + } +} + export class SetSynthDeductionPriorityCall extends ethereum.Call { get inputs(): SetSynthDeductionPriorityCall__Inputs { return new SetSynthDeductionPriorityCall__Inputs(this); diff --git a/markets/perps-market/subgraph/optimism-goerli/handleLiquidationParametersSet.ts b/markets/perps-market/subgraph/optimism-goerli/handleLiquidationParametersSet.ts index 54a94e45d1..bf0962df41 100644 --- a/markets/perps-market/subgraph/optimism-goerli/handleLiquidationParametersSet.ts +++ b/markets/perps-market/subgraph/optimism-goerli/handleLiquidationParametersSet.ts @@ -9,10 +9,9 @@ export function handleLiquidationParametersSet(event: LiquidationParametersSet): market.initialMarginRatioD18 = event.params.initialMarginRatioD18; market.liquidationRewardRatioD18 = event.params.liquidationRewardRatioD18; market.maintenanceMarginRatioD18 = event.params.maintenanceMarginRatioD18; - market.maxSecondsInLiquidationWindow = event.params.maxSecondsInLiquidationWindow; + // market.maxSecondsInLiquidationWindow = event.params.maxSecondsInLiquidationWindow; market.minimumPositionMargin = event.params.minimumPositionMargin; - market.maxLiquidationLimitAccumulationMultiplier = - event.params.maxLiquidationLimitAccumulationMultiplier; + // market.maxLiquidationLimitAccumulationMultiplier = event.params.maxLiquidationLimitAccumulationMultiplier; market.save(); } } diff --git a/markets/perps-market/subgraph/package.json b/markets/perps-market/subgraph/package.json index 482bdaeefd..0c80fbc900 100644 --- a/markets/perps-market/subgraph/package.json +++ b/markets/perps-market/subgraph/package.json @@ -4,15 +4,13 @@ "private": true, "version": "1.0.0", "scripts": { - "subgraphgen": "yarn subgraph:deployments && yarn subgraph:codegen && yarn subgraph:build", - "subgraph:deployments": "yarn deployments:optimism-goerli", - "subgraph:codegen": "yarn codegen:optimism-goerli", - "subgraph:build": "yarn build:optimism-goerli", + "cannon": "cannon", + "prettier": "prettier", + "graph": "graph", + "subgraphgen": "./codegen.sh", "auth": "graph auth --product hosted-service $V3_GRAPH_KEY", - "deployments:optimism-goerli": "cannon inspect synthetix-perps-market:latest --chain-id 420 --write-deployments ./optimism-goerli/deployments", - "codegen:optimism-goerli": "node ./codegen optimism-goerli && graph codegen subgraph.optimism-goerli.yaml --output-dir=optimism-goerli/generated && prettier --write optimism-goerli/generated", - "build:optimism-goerli": "graph build subgraph.optimism-goerli.yaml --output-dir ./build/optimism-goerli --network optimism-goerli", - "deploy:optimism-goerli": "graph deploy snx-v3/v3-perps-opt-goerli subgraph.optimism-goerli.yaml --output-dir ./build/optimism-goerli --network optimism-goerli --product hosted-service", + "deploy:optimism-goerli": "graph deploy perps-market-optimism-goerli subgraph.optimism-goerli.yaml --output-dir ./build/optimism-goerli --network optimism-goerli --version-label v0.0.1 --node https://app.satsuma.xyz/api/subgraphs/deploy --deploy-key $SATSUMA_KEY --ipfs https://ipfs.satsuma.xyz", + "deploy:base-goerli-competition": "graph deploy perps-market-base-testnet subgraph.base-goerli-competition.yaml --output-dir ./build/base-goerli-competition --network base-testnet --version-label v0.0.1 --node https://app.satsuma.xyz/api/subgraphs/deploy --deploy-key $SATSUMA_KEY --ipfs https://ipfs.satsuma.xyz", "test": "graph test", "coverage": "yarn deployments:optimism-goerli && yarn codegen:optimism-goerli && git diff --exit-code && yarn test --coverage", "create-local": "graph create --node http://localhost:8020/ snx-v3/v3-perps-opt-goerli", @@ -22,9 +20,9 @@ "devDependencies": { "@graphprotocol/graph-cli": "^0.50.1", "@graphprotocol/graph-ts": "^0.30.0", - "@usecannon/cli": "^2.5.1", + "@usecannon/cli": "^2.7.1", "ethers": "^5.7.2", "matchstick-as": "^0.5.2", - "prettier": "^2.8.8" + "prettier": "^3.0.3" } } diff --git a/markets/perps-market/subgraph/startBlock.js b/markets/perps-market/subgraph/startBlock.js new file mode 100755 index 0000000000..dbc4cc4a30 --- /dev/null +++ b/markets/perps-market/subgraph/startBlock.js @@ -0,0 +1,43 @@ +#!/usr/bin/env node + +const ethers = require('ethers'); + +async function getStartBlock({ namespace, networkName }) { + const provider = new ethers.providers.JsonRpcProvider( + `https://${networkName}.infura.io/v3/${process.env.INFURA_KEY}` + ); + const address = require(`./${namespace}/deployments/PerpsMarketProxy.json`).address; + const deployTx = require(`./${namespace}/deployments/InitialProxy.json`).deployTxnHash; + const tx = await provider.getTransactionReceipt(deployTx); + return { namespace, networkName, address, startBlock: tx.blockNumber }; +} +exports.findDeploymentBlock = getStartBlock; + +async function findAll() { + const data = await Promise.all([ + // getStartBlock({ namespace: 'mainnet', networkName: 'mainnet' }), + // getStartBlock({ namespace: 'goerli', networkName: 'goerli' }), + // getStartBlock({ namespace: 'optimism-mainnet', networkName: 'optimism-mainnet' }), + getStartBlock({ namespace: 'optimism-goerli', networkName: 'optimism-goerli' }), + // getStartBlock({ namespace: 'base-goerli', networkName: 'base-goerli' }), + getStartBlock({ namespace: 'base-goerli-competition', networkName: 'base-goerli' }), + ]); + + return Object.fromEntries( + data.map(({ namespace, address, startBlock }) => [ + namespace, + { PerpsMarketProxy: { address, startBlock } }, + ]) + ); +} + +if (require.main === module) { + const [namespace, networkName] = process.argv.slice(2); + if (namespace && networkName) { + getStartBlock({ namespace, networkName }).then(({ address, startBlock }) => + console.log({ PerpsMarketProxy: { address, startBlock } }) + ); + } else { + findAll().then((data) => console.log(data)); + } +} diff --git a/markets/perps-market/subgraph/subgraph.base-goerli-competition.yaml b/markets/perps-market/subgraph/subgraph.base-goerli-competition.yaml new file mode 100644 index 0000000000..a80e5add28 --- /dev/null +++ b/markets/perps-market/subgraph/subgraph.base-goerli-competition.yaml @@ -0,0 +1,72 @@ +specVersion: 0.0.4 +schema: + file: ./base-goerli-competition/schema.graphql +dataSources: + - kind: ethereum + network: base-testnet + name: PerpsMarketProxy + source: + abi: PerpsMarketProxy + address: "0x9863Dae3f4b5F4Ffe3A841a21565d57F2BA10E87" + startBlock: 9243743 + mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + file: ./base-goerli-competition/index.ts + abis: + - name: PerpsMarketProxy + file: ./base-goerli-competition/deployments/PerpsMarketProxy.json + entities: + - Account + - Market + - Order + - SettlementStrategy + - CollateralModified + - AccountLiquidated + - PositionLiquidated + - OrderCommitted + - OrderSettled + - PreviousOrderExpired + - MarketUpdated + eventHandlers: + - event: AccountCreated(indexed uint128,indexed address) + handler: handleAccountCreated + - event: MarketCreated(indexed uint128,string,string) + handler: handleMarketCreated + - event: MarketUpdated(uint128,uint256,int256,uint256,int256,int256,int256) + handler: handleMarketUpdated + - event: MarketPriceDataUpdated(indexed uint128,bytes32) + handler: handleMarketPriceDataUpdated + - event: FundingParametersSet(indexed uint128,uint256,uint256) + handler: handleFundingParametersSet + - event: LiquidationParametersSet(indexed + uint128,uint256,uint256,uint256,uint256,uint256) + handler: handleLiquidationParametersSet + - event: LockedOiRatioSet(indexed uint128,uint256) + handler: handleLockedOiRatioSet + - event: OrderFeesSet(indexed uint128,uint256,uint256) + handler: handleOrderFeesSet + - event: SettlementStrategyAdded(indexed uint128,(uint8,uint256,uint256,uint256,address,bytes32,string,uint256,bool),indexed uint256) + handler: handleSettlementStrategyAdded + - event: SettlementStrategyEnabled(indexed uint128,uint256,bool) + handler: handleSettlementStrategyEnabled + - event: OrderCommitted(indexed uint128,indexed + uint128,uint8,int128,uint256,uint256,uint256,indexed + bytes32,address) + handler: handleOrderCommitted + - event: OrderSettled(indexed uint128,indexed + uint128,uint256,int256,int256,int128,int128,uint256,uint256,uint256,uint256,indexed + bytes32,address) + handler: handleOrderSettled + - event: PreviousOrderExpired(indexed uint128,indexed + uint128,int128,uint256,uint256,indexed bytes32) + handler: handlePreviousOrderExpired + - event: PositionLiquidated(indexed uint128,indexed uint128,uint256,int128) + handler: handlePositionLiquidated + - event: AccountLiquidated(indexed uint128,uint256,bool) + handler: handleAccountLiquidated + - event: + CollateralModified(indexed uint128,indexed uint128,int256,indexed + address) + handler: handleCollateralModified diff --git a/markets/perps-market/subgraph/subgraph.optimism-goerli.yaml b/markets/perps-market/subgraph/subgraph.optimism-goerli.yaml index 945c8a1540..1dce17d034 100644 --- a/markets/perps-market/subgraph/subgraph.optimism-goerli.yaml +++ b/markets/perps-market/subgraph/subgraph.optimism-goerli.yaml @@ -41,7 +41,7 @@ dataSources: - event: FundingParametersSet(indexed uint128,uint256,uint256) handler: handleFundingParametersSet - event: LiquidationParametersSet(indexed - uint128,uint256,uint256,uint256,uint256,uint256,uint256,uint256) + uint128,uint256,uint256,uint256,uint256,uint256) handler: handleLiquidationParametersSet - event: LockedOiRatioSet(indexed uint128,uint256) handler: handleLockedOiRatioSet @@ -68,6 +68,7 @@ dataSources: handler: handlePositionLiquidated - event: AccountLiquidated(indexed uint128,uint256,bool) handler: handleAccountLiquidated - - event: CollateralModified(indexed uint128,indexed uint128,int256,indexed + - event: + CollateralModified(indexed uint128,indexed uint128,int256,indexed address) handler: handleCollateralModified diff --git a/markets/perps-market/subgraph/tests/PerpsMarketProxy.test.ts b/markets/perps-market/subgraph/tests/PerpsMarketProxy.test.ts index 81afd9bb42..3d74d274ed 100644 --- a/markets/perps-market/subgraph/tests/PerpsMarketProxy.test.ts +++ b/markets/perps-market/subgraph/tests/PerpsMarketProxy.test.ts @@ -4,6 +4,21 @@ import handleAccountCreated from './handleAccountCreated'; import handleAccountLiquidated from './handleAccountLiquidated'; import handleCollateralModified from './handleCollateralModified'; +import handleFundingParametersSet from './handleFundingParametersSet'; +import handleLiquidationParametersSet from './handleLiquidationParametersSet'; +import handleLockedOiRatioSet from './handleLockedOiRatioSet'; +import handleMarketCreated from './handleMarketCreated'; +import handleMarketPriceDataUpdated from './handleMarketPriceDataUpdated'; +import handleMarketUpdated from './handleMarketUpdated'; +import handleOrderCommitted from './handleOrderCommitted'; +import handleOrderFeesSet from './handleOrderFeesSet'; +import handleOrderSettled from './handleOrderSettled'; +import handlePositionLiquidated from './handlePositionLiquidated'; +import handlePreviousOrderExpired from './handlePreviousOrderExpired'; +import handleReferrerShareUpdated from './handleReferrerShareUpdated'; +import handleSettlementStrategyAdded from './handleSettlementStrategyAdded'; +import handleSettlementStrategyEnabled from './handleSettlementStrategyEnabled'; + describe('PerpsMarketProxy', () => { beforeEach(() => { clearStore(); @@ -16,4 +31,18 @@ describe('PerpsMarketProxy', () => { test('handleAccountCreated', handleAccountCreated); test('handleAccountLiquidated', handleAccountLiquidated); test('handleCollateralModified', handleCollateralModified); + test('handleFundingParametersSet', handleFundingParametersSet); + test('handleLiquidationParametersSet', handleLiquidationParametersSet); + test('handleLockedOiRatioSet', handleLockedOiRatioSet); + test('handleMarketCreated', handleMarketCreated); + test('handleMarketPriceDataUpdated', handleMarketPriceDataUpdated); + test('handleMarketUpdated', handleMarketUpdated); + test('handleOrderCommitted', handleOrderCommitted); + test('handleOrderFeesSet', handleOrderFeesSet); + test('handleOrderSettled', handleOrderSettled); + test('handlePositionLiquidated', handlePositionLiquidated); + test('handlePreviousOrderExpired', handlePreviousOrderExpired); + test('handleReferrerShareUpdated', handleReferrerShareUpdated); + test('handleSettlementStrategyAdded', handleSettlementStrategyAdded); + test('handleSettlementStrategyEnabled', handleSettlementStrategyEnabled); }); diff --git a/markets/perps-market/subgraph/tests/event-factories/createAccountCreatedEvent.ts b/markets/perps-market/subgraph/tests/event-factories/createAccountCreatedEvent.ts index f26703b5bc..661f33b56f 100644 --- a/markets/perps-market/subgraph/tests/event-factories/createAccountCreatedEvent.ts +++ b/markets/perps-market/subgraph/tests/event-factories/createAccountCreatedEvent.ts @@ -1,5 +1,5 @@ import { Address, BigInt, ethereum } from '@graphprotocol/graph-ts'; -import { newMockEvent } from 'matchstick-as'; +import { newTypedMockEvent } from 'matchstick-as'; import { AccountCreated } from '../../optimism-goerli/generated/PerpsMarketProxy/PerpsMarketProxy'; export function createAccountCreatedEvent( @@ -8,7 +8,7 @@ export function createAccountCreatedEvent( timestamp: i64, blockNumber: i64 ): AccountCreated { - const event = changetype(newMockEvent()); + const event = newTypedMockEvent(); event.parameters = []; event.parameters.push(new ethereum.EventParam('accountId', ethereum.Value.fromI32(id))); event.parameters.push( diff --git a/markets/perps-market/subgraph/tests/event-factories/createAccountLiquidatedEvent.ts b/markets/perps-market/subgraph/tests/event-factories/createAccountLiquidatedEvent.ts index b51cb39abd..3e48d784d0 100644 --- a/markets/perps-market/subgraph/tests/event-factories/createAccountLiquidatedEvent.ts +++ b/markets/perps-market/subgraph/tests/event-factories/createAccountLiquidatedEvent.ts @@ -1,5 +1,5 @@ import { BigInt, ethereum } from '@graphprotocol/graph-ts'; -import { newMockEvent } from 'matchstick-as'; +import { newTypedMockEvent } from 'matchstick-as'; import { AccountLiquidated } from '../../optimism-goerli/generated/PerpsMarketProxy/PerpsMarketProxy'; export function createAccountLiquidatedEvent( @@ -9,7 +9,7 @@ export function createAccountLiquidatedEvent( timestamp: i64, blockNumber: i64 ): AccountLiquidated { - const event = changetype(newMockEvent()); + const event = newTypedMockEvent(); event.parameters = []; event.parameters.push(new ethereum.EventParam('accountId', ethereum.Value.fromI32(id))); event.parameters.push( diff --git a/markets/perps-market/subgraph/tests/event-factories/createCollateralModifiedEvent.ts b/markets/perps-market/subgraph/tests/event-factories/createCollateralModifiedEvent.ts index 57a99ddb77..eef1b30f82 100644 --- a/markets/perps-market/subgraph/tests/event-factories/createCollateralModifiedEvent.ts +++ b/markets/perps-market/subgraph/tests/event-factories/createCollateralModifiedEvent.ts @@ -1,5 +1,5 @@ import { Address, BigInt, ethereum } from '@graphprotocol/graph-ts'; -import { newMockEvent } from 'matchstick-as'; +import { newTypedMockEvent } from 'matchstick-as'; import { CollateralModified as CollateralModifiedEvent } from '../../optimism-goerli/generated/PerpsMarketProxy/PerpsMarketProxy'; export function createCollateralModifiedEvent( @@ -11,7 +11,7 @@ export function createCollateralModifiedEvent( blockNumber: i64, logIndex: i64 ): CollateralModifiedEvent { - const event = changetype(newMockEvent()); + const event = newTypedMockEvent(); event.parameters = []; event.parameters.push(new ethereum.EventParam('accountId', ethereum.Value.fromI32(id))); event.parameters.push( diff --git a/markets/perps-market/subgraph/tests/event-factories/createFundingParametersSetEvent.ts b/markets/perps-market/subgraph/tests/event-factories/createFundingParametersSetEvent.ts new file mode 100644 index 0000000000..2e9b8e2937 --- /dev/null +++ b/markets/perps-market/subgraph/tests/event-factories/createFundingParametersSetEvent.ts @@ -0,0 +1,35 @@ +import { BigInt, ethereum } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { FundingParametersSet as FundingParametersSetEvent } from '../../optimism-goerli/generated/PerpsMarketProxy/PerpsMarketProxy'; + +export function createFundingParametersSetEvent( + id: i32, + skewScale: i64, + maxFundingVelocity: i64, + timestamp: i64, + blockNumber: i64, + logIndex: i64 +): FundingParametersSetEvent { + const event = newTypedMockEvent(); + + event.parameters = []; + event.parameters.push(new ethereum.EventParam('marketId', ethereum.Value.fromI32(id))); + event.parameters.push( + new ethereum.EventParam( + 'skewScale', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(skewScale)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'maxFundingVelocity', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(maxFundingVelocity)) + ) + ); + + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + event.logIndex = BigInt.fromI64(logIndex); + + return event; +} diff --git a/markets/perps-market/subgraph/tests/event-factories/createLiquidationParametersSetEvent.ts b/markets/perps-market/subgraph/tests/event-factories/createLiquidationParametersSetEvent.ts new file mode 100644 index 0000000000..8121f51078 --- /dev/null +++ b/markets/perps-market/subgraph/tests/event-factories/createLiquidationParametersSetEvent.ts @@ -0,0 +1,56 @@ +import { BigInt, ethereum } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { LiquidationParametersSet as LiquidationParametersSetEvent } from '../../optimism-goerli/generated/PerpsMarketProxy/PerpsMarketProxy'; + +export function createLiquidationParametersSetEvent( + id: i32, + initialMarginRatioD18: i64, + maintenanceMarginRatioD18: i64, + minimumInitialMarginRatioD18: i64, + liquidationRewardRatioD18: i64, + minimumPositionMargin: i64, + timestamp: i64, + blockNumber: i64, + logIndex: i64 +): LiquidationParametersSetEvent { + const event = newTypedMockEvent(); + + event.parameters = []; + event.parameters.push(new ethereum.EventParam('marketId', ethereum.Value.fromI32(id))); + event.parameters.push( + new ethereum.EventParam( + 'initialMarginRatioD18', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(initialMarginRatioD18)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'maintenanceMarginRatioD18', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(maintenanceMarginRatioD18)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'minimumInitialMarginRatioD18', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(minimumInitialMarginRatioD18)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'liquidationRewardRatioD18', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(liquidationRewardRatioD18)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'minimumPositionMargin', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(minimumPositionMargin)) + ) + ); + + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + event.logIndex = BigInt.fromI64(logIndex); + + return event; +} diff --git a/markets/perps-market/subgraph/tests/event-factories/createLockedOiRatioSetEvent.ts b/markets/perps-market/subgraph/tests/event-factories/createLockedOiRatioSetEvent.ts new file mode 100644 index 0000000000..8e254e6d97 --- /dev/null +++ b/markets/perps-market/subgraph/tests/event-factories/createLockedOiRatioSetEvent.ts @@ -0,0 +1,28 @@ +import { BigInt, ethereum } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { LockedOiRatioSet as LockedOiRatioSetEvent } from '../../optimism-goerli/generated/PerpsMarketProxy/PerpsMarketProxy'; + +export function createLockedOiRatioSetEvent( + id: i32, + lockedOiRatioD18: i64, + timestamp: i64, + blockNumber: i64, + logIndex: i64 +): LockedOiRatioSetEvent { + const event = newTypedMockEvent(); + + event.parameters = []; + event.parameters.push(new ethereum.EventParam('marketId', ethereum.Value.fromI32(id))); + event.parameters.push( + new ethereum.EventParam( + 'lockedOiRatioD18', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(lockedOiRatioD18)) + ) + ); + + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + event.logIndex = BigInt.fromI64(logIndex); + + return event; +} diff --git a/markets/perps-market/subgraph/tests/event-factories/createMarketCreatedEvent.ts b/markets/perps-market/subgraph/tests/event-factories/createMarketCreatedEvent.ts new file mode 100644 index 0000000000..b2b1ae4661 --- /dev/null +++ b/markets/perps-market/subgraph/tests/event-factories/createMarketCreatedEvent.ts @@ -0,0 +1,31 @@ +import { BigInt, ethereum } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { MarketCreated as MarketCreatedEvent } from '../../optimism-goerli/generated/PerpsMarketProxy/PerpsMarketProxy'; + +export function createMarketCreatedEvent( + perpsMarketId: i32, + marketName: string, + marketSymbol: string, + timestamp: i64, + blockNumber: i64, + logIndex: i64 +): MarketCreatedEvent { + const event = newTypedMockEvent(); + + event.parameters = []; + event.parameters.push( + new ethereum.EventParam('perpsMarketId', ethereum.Value.fromI32(perpsMarketId)) + ); + event.parameters.push( + new ethereum.EventParam('marketName', ethereum.Value.fromString(marketName)) + ); + event.parameters.push( + new ethereum.EventParam('marketSymbol', ethereum.Value.fromString(marketSymbol)) + ); + + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + event.logIndex = BigInt.fromI64(logIndex); + + return event; +} diff --git a/markets/perps-market/subgraph/tests/event-factories/createMarketPriceDataUpdatedEvent.ts b/markets/perps-market/subgraph/tests/event-factories/createMarketPriceDataUpdatedEvent.ts new file mode 100644 index 0000000000..ca4ac0f760 --- /dev/null +++ b/markets/perps-market/subgraph/tests/event-factories/createMarketPriceDataUpdatedEvent.ts @@ -0,0 +1,28 @@ +import { BigInt, ethereum, Bytes } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { MarketPriceDataUpdated as MarketPriceDataUpdatedEvent } from '../../optimism-goerli/generated/PerpsMarketProxy/PerpsMarketProxy'; + +export function createMarketPriceDataUpdatedEvent( + marketId: i32, + feedId: string, + timestamp: i64, + blockNumber: i64, + logIndex: i64 +): MarketPriceDataUpdatedEvent { + const event = newTypedMockEvent(); + + event.parameters = []; + event.parameters.push(new ethereum.EventParam('marketId', ethereum.Value.fromI32(marketId))); + event.parameters.push( + new ethereum.EventParam( + 'feedId', + ethereum.Value.fromBytes(Bytes.fromHexString(feedId) as Bytes) + ) + ); + + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + event.logIndex = BigInt.fromI64(logIndex); + + return event; +} diff --git a/markets/perps-market/subgraph/tests/event-factories/createMarketUpdatedEvent.ts b/markets/perps-market/subgraph/tests/event-factories/createMarketUpdatedEvent.ts new file mode 100644 index 0000000000..eeabebd540 --- /dev/null +++ b/markets/perps-market/subgraph/tests/event-factories/createMarketUpdatedEvent.ts @@ -0,0 +1,54 @@ +import { BigInt, ethereum } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { MarketUpdated as MarketUpdatedEvent } from '../../optimism-goerli/generated/PerpsMarketProxy/PerpsMarketProxy'; + +export function createMarketUpdatedEvent( + marketId: i32, + price: i64, + skew: i64, + size: i64, + sizeDelta: i64, + currentFundingRate: i64, + currentFundingVelocity: i64, + timestamp: i64, + blockNumber: i64, + logIndex: i64 +): MarketUpdatedEvent { + const event = newTypedMockEvent(); + + event.parameters = []; + event.parameters.push(new ethereum.EventParam('marketId', ethereum.Value.fromI32(marketId))); + event.parameters.push( + new ethereum.EventParam('price', ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(price))) + ); + event.parameters.push( + new ethereum.EventParam('skew', ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(skew))) + ); + event.parameters.push( + new ethereum.EventParam('size', ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(size))) + ); + event.parameters.push( + new ethereum.EventParam( + 'sizeDelta', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(sizeDelta)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'currentFundingRate', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(currentFundingRate)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'currentFundingVelocity', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(currentFundingVelocity)) + ) + ); + + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + event.logIndex = BigInt.fromI64(logIndex); + + return event; +} diff --git a/markets/perps-market/subgraph/tests/event-factories/createOrderCommittedEvent.ts b/markets/perps-market/subgraph/tests/event-factories/createOrderCommittedEvent.ts new file mode 100644 index 0000000000..c399003419 --- /dev/null +++ b/markets/perps-market/subgraph/tests/event-factories/createOrderCommittedEvent.ts @@ -0,0 +1,64 @@ +import { BigInt, ethereum, Address, Bytes } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { OrderCommitted as OrderCommittedEvent } from '../../optimism-goerli/generated/PerpsMarketProxy/PerpsMarketProxy'; + +export function createOrderCommittedEvent( + marketId: i32, + accountId: i32, + orderType: i32, + sizeDelta: i64, + acceptablePrice: i64, + settlementTime: i64, + expirationTime: i64, + trackingCode: string, + sender: string, + timestamp: i64, + blockNumber: i64, + logIndex: i64 +): OrderCommittedEvent { + const event = newTypedMockEvent(); + + event.parameters = []; + event.parameters.push(new ethereum.EventParam('marketId', ethereum.Value.fromI32(marketId))); + event.parameters.push(new ethereum.EventParam('accountId', ethereum.Value.fromI32(accountId))); + event.parameters.push(new ethereum.EventParam('orderType', ethereum.Value.fromI32(orderType))); + event.parameters.push( + new ethereum.EventParam( + 'sizeDelta', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(sizeDelta)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'acceptablePrice', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(acceptablePrice)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'settlementTime', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(settlementTime)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'expirationTime', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(expirationTime)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'trackingCode', + ethereum.Value.fromBytes(Bytes.fromHexString(trackingCode) as Bytes) + ) + ); + event.parameters.push( + new ethereum.EventParam('sender', ethereum.Value.fromAddress(Address.fromString(sender))) + ); + + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + event.logIndex = BigInt.fromI64(logIndex); + + return event; +} diff --git a/markets/perps-market/subgraph/tests/event-factories/createOrderFeesSetEvent.ts b/markets/perps-market/subgraph/tests/event-factories/createOrderFeesSetEvent.ts new file mode 100644 index 0000000000..dbdace5a81 --- /dev/null +++ b/markets/perps-market/subgraph/tests/event-factories/createOrderFeesSetEvent.ts @@ -0,0 +1,35 @@ +import { BigInt, ethereum } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { OrderFeesSet as OrderFeesSetEvent } from '../../optimism-goerli/generated/PerpsMarketProxy/PerpsMarketProxy'; + +export function createOrderFeesSetEvent( + marketId: i32, + makerFeeRatio: i64, + takerFeeRatio: i64, + timestamp: i64, + blockNumber: i64, + logIndex: i64 +): OrderFeesSetEvent { + const event = newTypedMockEvent(); + + event.parameters = []; + event.parameters.push(new ethereum.EventParam('marketId', ethereum.Value.fromI32(marketId))); + event.parameters.push( + new ethereum.EventParam( + 'makerFeeRatio', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(makerFeeRatio)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'takerFeeRatio', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(takerFeeRatio)) + ) + ); + + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + event.logIndex = BigInt.fromI64(logIndex); + + return event; +} diff --git a/markets/perps-market/subgraph/tests/event-factories/createOrderSettledEvent.ts b/markets/perps-market/subgraph/tests/event-factories/createOrderSettledEvent.ts new file mode 100644 index 0000000000..55a7e5bbaa --- /dev/null +++ b/markets/perps-market/subgraph/tests/event-factories/createOrderSettledEvent.ts @@ -0,0 +1,91 @@ +import { BigInt, ethereum, Address, Bytes } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { OrderSettled as OrderSettledEvent } from '../../optimism-goerli/generated/PerpsMarketProxy/PerpsMarketProxy'; + +export function createOrderSettledEvent( + marketId: i32, + accountId: i32, + fillPrice: i64, + pnl: i64, + accruedFunding: i64, + sizeDelta: i64, + newSize: i64, + totalFees: i64, + referralFees: i64, + collectedFees: i64, + settlementReward: i64, + trackingCode: string, + settler: string, + timestamp: i64, + blockNumber: i64, + logIndex: i64 +): OrderSettledEvent { + const event = newTypedMockEvent(); + + event.parameters = []; + event.parameters.push(new ethereum.EventParam('marketId', ethereum.Value.fromI32(marketId))); + event.parameters.push(new ethereum.EventParam('accountId', ethereum.Value.fromI32(accountId))); + event.parameters.push( + new ethereum.EventParam( + 'fillPrice', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(fillPrice)) + ) + ); + event.parameters.push( + new ethereum.EventParam('pnl', ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(pnl))) + ); + event.parameters.push( + new ethereum.EventParam( + 'accruedFunding', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(accruedFunding)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'sizeDelta', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(sizeDelta)) + ) + ); + event.parameters.push( + new ethereum.EventParam('newSize', ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(newSize))) + ); + event.parameters.push( + new ethereum.EventParam( + 'totalFees', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(totalFees)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'referralFees', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(referralFees)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'collectedFees', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(collectedFees)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'settlementReward', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(settlementReward)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'trackingCode', + ethereum.Value.fromBytes(Bytes.fromHexString(trackingCode) as Bytes) + ) + ); + event.parameters.push( + new ethereum.EventParam('settler', ethereum.Value.fromAddress(Address.fromString(settler))) + ); + + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + event.logIndex = BigInt.fromI64(logIndex); + + return event; +} diff --git a/markets/perps-market/subgraph/tests/event-factories/createPositionLiquidatedEvent.ts b/markets/perps-market/subgraph/tests/event-factories/createPositionLiquidatedEvent.ts new file mode 100644 index 0000000000..c4b1f918fa --- /dev/null +++ b/markets/perps-market/subgraph/tests/event-factories/createPositionLiquidatedEvent.ts @@ -0,0 +1,37 @@ +import { BigInt, ethereum } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { PositionLiquidated as PositionLiquidatedEvent } from '../../optimism-goerli/generated/PerpsMarketProxy/PerpsMarketProxy'; + +export function createPositionLiquidatedEvent( + accountId: i32, + marketId: i32, + amountLiquidated: i64, + currentPositionSize: i64, + timestamp: i64, + blockNumber: i64, + logIndex: i64 +): PositionLiquidatedEvent { + const event = newTypedMockEvent(); + + event.parameters = []; + event.parameters.push(new ethereum.EventParam('accountId', ethereum.Value.fromI32(accountId))); + event.parameters.push(new ethereum.EventParam('marketId', ethereum.Value.fromI32(marketId))); + event.parameters.push( + new ethereum.EventParam( + 'amountLiquidated', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(amountLiquidated)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'currentPositionSize', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(currentPositionSize)) + ) + ); + + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + event.logIndex = BigInt.fromI64(logIndex); + + return event; +} diff --git a/markets/perps-market/subgraph/tests/event-factories/createPreviousOrderExpiredEvent.ts b/markets/perps-market/subgraph/tests/event-factories/createPreviousOrderExpiredEvent.ts new file mode 100644 index 0000000000..4cc027b5a9 --- /dev/null +++ b/markets/perps-market/subgraph/tests/event-factories/createPreviousOrderExpiredEvent.ts @@ -0,0 +1,51 @@ +import { BigInt, ethereum, Bytes } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { PreviousOrderExpired as PreviousOrderExpiredEvent } from '../../optimism-goerli/generated/PerpsMarketProxy/PerpsMarketProxy'; + +export function createPreviousOrderExpiredEvent( + marketId: i32, + accountId: i32, + sizeDelta: i64, + acceptablePrice: i64, + settlementTime: i64, + trackingCode: string, + timestamp: i64, + blockNumber: i64, + logIndex: i64 +): PreviousOrderExpiredEvent { + const event = newTypedMockEvent(); + + event.parameters = []; + event.parameters.push(new ethereum.EventParam('marketId', ethereum.Value.fromI32(marketId))); + event.parameters.push(new ethereum.EventParam('accountId', ethereum.Value.fromI32(accountId))); + event.parameters.push( + new ethereum.EventParam( + 'sizeDelta', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(sizeDelta)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'acceptablePrice', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(acceptablePrice)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'settlementTime', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(settlementTime)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'trackingCode', + ethereum.Value.fromBytes(Bytes.fromHexString(trackingCode) as Bytes) + ) + ); + + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + event.logIndex = BigInt.fromI64(logIndex); + + return event; +} diff --git a/markets/perps-market/subgraph/tests/event-factories/createReferrerShareUpdatedEvent.ts b/markets/perps-market/subgraph/tests/event-factories/createReferrerShareUpdatedEvent.ts new file mode 100644 index 0000000000..0c06861c84 --- /dev/null +++ b/markets/perps-market/subgraph/tests/event-factories/createReferrerShareUpdatedEvent.ts @@ -0,0 +1,30 @@ +import { BigInt, ethereum, Address } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { ReferrerShareUpdated as ReferrerShareUpdatedEvent } from '../../optimism-goerli/generated/PerpsMarketProxy/PerpsMarketProxy'; + +export function createReferrerShareUpdatedEvent( + referrer: string, + shareRatioD18: i64, + timestamp: i64, + blockNumber: i64, + logIndex: i64 +): ReferrerShareUpdatedEvent { + const event = newTypedMockEvent(); + + event.parameters = []; + event.parameters.push( + new ethereum.EventParam('referrer', ethereum.Value.fromAddress(Address.fromString(referrer))) + ); + event.parameters.push( + new ethereum.EventParam( + 'shareRatioD18', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(shareRatioD18)) + ) + ); + + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + event.logIndex = BigInt.fromI64(logIndex); + + return event; +} diff --git a/markets/perps-market/subgraph/tests/event-factories/createSettlementStrategyAddedEvent.ts b/markets/perps-market/subgraph/tests/event-factories/createSettlementStrategyAddedEvent.ts new file mode 100644 index 0000000000..a5a1e2839c --- /dev/null +++ b/markets/perps-market/subgraph/tests/event-factories/createSettlementStrategyAddedEvent.ts @@ -0,0 +1,53 @@ +import { BigInt, ethereum, Address, Bytes } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { + SettlementStrategyAdded as SettlementStrategyAddedEvent, + SettlementStrategyAddedStrategyStruct, +} from '../../optimism-goerli/generated/PerpsMarketProxy/PerpsMarketProxy'; + +export function createSettlementStrategyAddedEvent( + marketId: i32, + // strategy struct + strategyType: i32, + settlementDelay: i64, + settlementWindowDuration: i64, + priceWindowDuration: i64, + priceVerificationContract: string, + feedId: string, + url: string, + settlementReward: i64, + priceDeviationTolerance: i64, + disabled: boolean, + // end of strategy struct + strategyId: i32, + timestamp: i64, + blockNumber: i64, + logIndex: i64 +): SettlementStrategyAddedEvent { + const event = newTypedMockEvent(); + + event.parameters = []; + event.parameters.push(new ethereum.EventParam('marketId', ethereum.Value.fromI32(marketId))); + + const strategy = changetype([ + ethereum.Value.fromI32(strategyType), + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(settlementDelay)), + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(settlementWindowDuration)), + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(priceWindowDuration)), + ethereum.Value.fromAddress(Address.fromString(priceVerificationContract)), + ethereum.Value.fromBytes(Bytes.fromHexString(feedId) as Bytes), + ethereum.Value.fromString(url), + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(settlementReward)), + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(priceDeviationTolerance)), + ethereum.Value.fromBoolean(disabled), + ]); + event.parameters.push(new ethereum.EventParam('strategy', ethereum.Value.fromTuple(strategy))); + + event.parameters.push(new ethereum.EventParam('strategyId', ethereum.Value.fromI32(strategyId))); + + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + event.logIndex = BigInt.fromI64(logIndex); + + return event; +} diff --git a/markets/perps-market/subgraph/tests/event-factories/createSettlementStrategyEnabledEvent.ts b/markets/perps-market/subgraph/tests/event-factories/createSettlementStrategyEnabledEvent.ts new file mode 100644 index 0000000000..4ad119858f --- /dev/null +++ b/markets/perps-market/subgraph/tests/event-factories/createSettlementStrategyEnabledEvent.ts @@ -0,0 +1,25 @@ +import { BigInt, ethereum } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { SettlementStrategyEnabled as SettlementStrategyEnabledEvent } from '../../optimism-goerli/generated/PerpsMarketProxy/PerpsMarketProxy'; + +export function createSettlementStrategyEnabledEvent( + marketId: i32, + strategyId: i32, + enabled: boolean, + timestamp: i64, + blockNumber: i64, + logIndex: i64 +): SettlementStrategyEnabledEvent { + const event = newTypedMockEvent(); + + event.parameters = []; + event.parameters.push(new ethereum.EventParam('marketId', ethereum.Value.fromI32(marketId))); + event.parameters.push(new ethereum.EventParam('strategyId', ethereum.Value.fromI32(strategyId))); + event.parameters.push(new ethereum.EventParam('enabled', ethereum.Value.fromBoolean(enabled))); + + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + event.logIndex = BigInt.fromI64(logIndex); + + return event; +} diff --git a/markets/perps-market/subgraph/tests/handleAccountCreated.ts b/markets/perps-market/subgraph/tests/handleAccountCreated.ts index 484aa44270..d5ef153100 100644 --- a/markets/perps-market/subgraph/tests/handleAccountCreated.ts +++ b/markets/perps-market/subgraph/tests/handleAccountCreated.ts @@ -1,19 +1,15 @@ -import { assert } from 'matchstick-as'; +import { assert, log } from 'matchstick-as'; import { handleAccountCreated } from '../optimism-goerli'; import { createAccountCreatedEvent } from './event-factories/createAccountCreatedEvent'; export default function test(): void { - const accountCreatedEvent = createAccountCreatedEvent( - 1, - '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', - 10_000, - 10 - ); - - handleAccountCreated(accountCreatedEvent); + assert.entityCount('Account', 0); + log.info('Should create a new record for the account', []); + const owner1 = '0x4200000000000000000000000000000000000000'; + handleAccountCreated(createAccountCreatedEvent(1, owner1, 10_000, 10)); + assert.entityCount('Account', 1); assert.fieldEquals('Account', '1', 'id', '1'); assert.fieldEquals('Account', '1', 'accountId', '1'); - assert.fieldEquals('Account', '1', 'owner', '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'); - assert.notInStore('Account', '2'); + assert.fieldEquals('Account', '1', 'owner', owner1); } diff --git a/markets/perps-market/subgraph/tests/handleAccountLiquidated.ts b/markets/perps-market/subgraph/tests/handleAccountLiquidated.ts index 8edf4cf8c1..fb0da029ce 100644 --- a/markets/perps-market/subgraph/tests/handleAccountLiquidated.ts +++ b/markets/perps-market/subgraph/tests/handleAccountLiquidated.ts @@ -1,15 +1,24 @@ -import { assert } from 'matchstick-as'; -import { Address, BigInt, ethereum } from '@graphprotocol/graph-ts'; +import { assert, log } from 'matchstick-as'; import { handleAccountLiquidated } from '../optimism-goerli'; import { createAccountLiquidatedEvent } from './event-factories/createAccountLiquidatedEvent'; export default function test(): void { - const accountLiquidatedEvent = createAccountLiquidatedEvent(1, 123, true, 10_000, 10); - - handleAccountLiquidated(accountLiquidatedEvent); + assert.entityCount('AccountLiquidated', 0); + log.info('Should create a new record for the liquidation', []); + handleAccountLiquidated(createAccountLiquidatedEvent(1, 123, true, 10_000, 10)); + assert.entityCount('AccountLiquidated', 1); assert.fieldEquals('AccountLiquidated', '1-10', 'accountId', '1'); assert.fieldEquals('AccountLiquidated', '1-10', 'timestamp', '10000'); assert.fieldEquals('AccountLiquidated', '1-10', 'liquidationReward', '123'); assert.fieldEquals('AccountLiquidated', '1-10', 'fullyLiquidated', 'true'); + + // TODO: can we have 2 separate liquidation events in the same block? Potentially yes + log.info('Should create another record for the liquidation of the same account', []); + handleAccountLiquidated(createAccountLiquidatedEvent(1, 123, true, 20_000, 20)); + assert.entityCount('AccountLiquidated', 2); + assert.fieldEquals('AccountLiquidated', '1-20', 'accountId', '1'); + assert.fieldEquals('AccountLiquidated', '1-20', 'timestamp', '20000'); + assert.fieldEquals('AccountLiquidated', '1-20', 'liquidationReward', '123'); + assert.fieldEquals('AccountLiquidated', '1-20', 'fullyLiquidated', 'true'); } diff --git a/markets/perps-market/subgraph/tests/handleCollateralModified.ts b/markets/perps-market/subgraph/tests/handleCollateralModified.ts index aba08500a0..d702af510b 100644 --- a/markets/perps-market/subgraph/tests/handleCollateralModified.ts +++ b/markets/perps-market/subgraph/tests/handleCollateralModified.ts @@ -1,52 +1,27 @@ -import { assert } from 'matchstick-as'; -import { Address, BigInt, ethereum } from '@graphprotocol/graph-ts'; +import { assert, log } from 'matchstick-as'; import { handleCollateralModified } from '../optimism-goerli'; import { createCollateralModifiedEvent } from './event-factories/createCollateralModifiedEvent'; export default function test(): void { - handleCollateralModified( - createCollateralModifiedEvent( - 1, - 69, - 100, - '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', - 10_000, - 10, - 1 - ) - ); + assert.entityCount('CollateralModified', 0); + log.info('Should create a new record when collateral modified', []); + const sender1 = '0x4200000000000000000000000000000000000000'; + handleCollateralModified(createCollateralModifiedEvent(1, 69, 100, sender1, 10_000, 10, 1)); + assert.entityCount('CollateralModified', 1); assert.fieldEquals('CollateralModified', '1-10-1', 'accountId', '1'); assert.fieldEquals('CollateralModified', '1-10-1', 'timestamp', '10000'); assert.fieldEquals('CollateralModified', '1-10-1', 'amount', '100'); - assert.fieldEquals( - 'CollateralModified', - '1-10-1', - 'sender', - '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266' - ); + assert.fieldEquals('CollateralModified', '1-10-1', 'sender', sender1); assert.fieldEquals('CollateralModified', '1-10-1', 'synthMarketId', '69'); - handleCollateralModified( - createCollateralModifiedEvent( - 1, - 69, - -200, - '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', - 10_000, - 11, - 2 - ) - ); - + log.info('Should create another record when collateral modified with negative amount', []); + const sender2 = '0x6900000000000000000000000000000000000000'; + handleCollateralModified(createCollateralModifiedEvent(1, 69, -200, sender2, 10_000, 11, 2)); + assert.entityCount('CollateralModified', 2); assert.fieldEquals('CollateralModified', '1-11-2', 'accountId', '1'); assert.fieldEquals('CollateralModified', '1-11-2', 'timestamp', '10000'); assert.fieldEquals('CollateralModified', '1-11-2', 'amount', '-200'); - assert.fieldEquals( - 'CollateralModified', - '1-11-2', - 'sender', - '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266' - ); + assert.fieldEquals('CollateralModified', '1-11-2', 'sender', sender2); assert.fieldEquals('CollateralModified', '1-11-2', 'synthMarketId', '69'); } diff --git a/markets/perps-market/subgraph/tests/handleFundingParametersSet.ts b/markets/perps-market/subgraph/tests/handleFundingParametersSet.ts new file mode 100644 index 0000000000..22d6a76102 --- /dev/null +++ b/markets/perps-market/subgraph/tests/handleFundingParametersSet.ts @@ -0,0 +1,6 @@ +import { assert, log } from 'matchstick-as'; + +export default function test(): void { + assert.entityCount('Market', 0); + log.error('NOT IMPLEMENTED', []); +} diff --git a/markets/perps-market/subgraph/tests/handleLiquidationParametersSet.ts b/markets/perps-market/subgraph/tests/handleLiquidationParametersSet.ts new file mode 100644 index 0000000000..22d6a76102 --- /dev/null +++ b/markets/perps-market/subgraph/tests/handleLiquidationParametersSet.ts @@ -0,0 +1,6 @@ +import { assert, log } from 'matchstick-as'; + +export default function test(): void { + assert.entityCount('Market', 0); + log.error('NOT IMPLEMENTED', []); +} diff --git a/markets/perps-market/subgraph/tests/handleLockedOiRatioSet.ts b/markets/perps-market/subgraph/tests/handleLockedOiRatioSet.ts new file mode 100644 index 0000000000..22d6a76102 --- /dev/null +++ b/markets/perps-market/subgraph/tests/handleLockedOiRatioSet.ts @@ -0,0 +1,6 @@ +import { assert, log } from 'matchstick-as'; + +export default function test(): void { + assert.entityCount('Market', 0); + log.error('NOT IMPLEMENTED', []); +} diff --git a/markets/perps-market/subgraph/tests/handleMarketCreated.ts b/markets/perps-market/subgraph/tests/handleMarketCreated.ts new file mode 100644 index 0000000000..22d6a76102 --- /dev/null +++ b/markets/perps-market/subgraph/tests/handleMarketCreated.ts @@ -0,0 +1,6 @@ +import { assert, log } from 'matchstick-as'; + +export default function test(): void { + assert.entityCount('Market', 0); + log.error('NOT IMPLEMENTED', []); +} diff --git a/markets/perps-market/subgraph/tests/handleMarketPriceDataUpdated.ts b/markets/perps-market/subgraph/tests/handleMarketPriceDataUpdated.ts new file mode 100644 index 0000000000..22d6a76102 --- /dev/null +++ b/markets/perps-market/subgraph/tests/handleMarketPriceDataUpdated.ts @@ -0,0 +1,6 @@ +import { assert, log } from 'matchstick-as'; + +export default function test(): void { + assert.entityCount('Market', 0); + log.error('NOT IMPLEMENTED', []); +} diff --git a/markets/perps-market/subgraph/tests/handleMarketUpdated.ts b/markets/perps-market/subgraph/tests/handleMarketUpdated.ts new file mode 100644 index 0000000000..4461e3620d --- /dev/null +++ b/markets/perps-market/subgraph/tests/handleMarketUpdated.ts @@ -0,0 +1,7 @@ +import { assert, log } from 'matchstick-as'; + +export default function test(): void { + assert.entityCount('Market', 0); + assert.entityCount('MarketUpdated', 0); + log.error('NOT IMPLEMENTED', []); +} diff --git a/markets/perps-market/subgraph/tests/handleOrderCommitted.ts b/markets/perps-market/subgraph/tests/handleOrderCommitted.ts new file mode 100644 index 0000000000..96ee463ab5 --- /dev/null +++ b/markets/perps-market/subgraph/tests/handleOrderCommitted.ts @@ -0,0 +1,7 @@ +import { assert, log } from 'matchstick-as'; + +export default function test(): void { + assert.entityCount('Order', 0); + assert.entityCount('OrderCommitted', 0); + log.error('NOT IMPLEMENTED', []); +} diff --git a/markets/perps-market/subgraph/tests/handleOrderFeesSet.ts b/markets/perps-market/subgraph/tests/handleOrderFeesSet.ts new file mode 100644 index 0000000000..22d6a76102 --- /dev/null +++ b/markets/perps-market/subgraph/tests/handleOrderFeesSet.ts @@ -0,0 +1,6 @@ +import { assert, log } from 'matchstick-as'; + +export default function test(): void { + assert.entityCount('Market', 0); + log.error('NOT IMPLEMENTED', []); +} diff --git a/markets/perps-market/subgraph/tests/handleOrderSettled.ts b/markets/perps-market/subgraph/tests/handleOrderSettled.ts new file mode 100644 index 0000000000..1162e4e464 --- /dev/null +++ b/markets/perps-market/subgraph/tests/handleOrderSettled.ts @@ -0,0 +1,7 @@ +import { assert, log } from 'matchstick-as'; + +export default function test(): void { + assert.entityCount('Order', 0); + assert.entityCount('OrderSettled', 0); + log.error('NOT IMPLEMENTED', []); +} diff --git a/markets/perps-market/subgraph/tests/handlePositionLiquidated.ts b/markets/perps-market/subgraph/tests/handlePositionLiquidated.ts new file mode 100644 index 0000000000..92e01f865f --- /dev/null +++ b/markets/perps-market/subgraph/tests/handlePositionLiquidated.ts @@ -0,0 +1,6 @@ +import { assert, log } from 'matchstick-as'; + +export default function test(): void { + assert.entityCount('PositionLiquidated', 0); + log.error('NOT IMPLEMENTED', []); +} diff --git a/markets/perps-market/subgraph/tests/handlePreviousOrderExpired.ts b/markets/perps-market/subgraph/tests/handlePreviousOrderExpired.ts new file mode 100644 index 0000000000..4a55c4829b --- /dev/null +++ b/markets/perps-market/subgraph/tests/handlePreviousOrderExpired.ts @@ -0,0 +1,6 @@ +import { assert, log } from 'matchstick-as'; + +export default function test(): void { + assert.entityCount('PreviousOrderExpired', 0); + log.error('NOT IMPLEMENTED', []); +} diff --git a/markets/perps-market/subgraph/tests/handleReferrerShareUpdated.ts b/markets/perps-market/subgraph/tests/handleReferrerShareUpdated.ts new file mode 100644 index 0000000000..6f93f1c415 --- /dev/null +++ b/markets/perps-market/subgraph/tests/handleReferrerShareUpdated.ts @@ -0,0 +1,6 @@ +import { assert, log } from 'matchstick-as'; + +export default function test(): void { + assert.entityCount('ReferrerShare', 0); + log.error('NOT IMPLEMENTED', []); +} diff --git a/markets/perps-market/subgraph/tests/handleSettlementStrategyAdded.ts b/markets/perps-market/subgraph/tests/handleSettlementStrategyAdded.ts new file mode 100644 index 0000000000..bd11b6cdf1 --- /dev/null +++ b/markets/perps-market/subgraph/tests/handleSettlementStrategyAdded.ts @@ -0,0 +1,6 @@ +import { assert, log } from 'matchstick-as'; + +export default function test(): void { + assert.entityCount('SettlementStrategy', 0); + log.error('NOT IMPLEMENTED', []); +} diff --git a/markets/perps-market/subgraph/tests/handleSettlementStrategyEnabled.ts b/markets/perps-market/subgraph/tests/handleSettlementStrategyEnabled.ts new file mode 100644 index 0000000000..bd11b6cdf1 --- /dev/null +++ b/markets/perps-market/subgraph/tests/handleSettlementStrategyEnabled.ts @@ -0,0 +1,6 @@ +import { assert, log } from 'matchstick-as'; + +export default function test(): void { + assert.entityCount('SettlementStrategy', 0); + log.error('NOT IMPLEMENTED', []); +} diff --git a/markets/perps-market/test/integration/Account/Margins.test.ts b/markets/perps-market/test/integration/Account/Margins.test.ts index b9ad31438f..39c7cf0ae3 100644 --- a/markets/perps-market/test/integration/Account/Margins.test.ts +++ b/markets/perps-market/test/integration/Account/Margins.test.ts @@ -3,6 +3,7 @@ import assertBn from '@synthetixio/core-utils/src/utils/assertions/assert-bignum import { openPosition } from '../helpers'; import Wei, { wei } from '@synthetixio/wei'; import { calculatePricePnl } from '../helpers/fillPrice'; +import { ethers } from 'ethers'; describe('Account margins test', () => { const accountId = 4; @@ -19,7 +20,7 @@ describe('Account margins test', () => { maintenanceMarginScalar: bn(0.5), maxLiquidationLimitAccumulationMultiplier: bn(1), liquidationRewardRatio: bn(0.05), - maxSecondsInLiquidationWindow: bn(10), + maxSecondsInLiquidationWindow: ethers.BigNumber.from(10), minimumPositionMargin: bn(1000), }, settlementStrategy: { @@ -38,7 +39,7 @@ describe('Account margins test', () => { maintenanceMarginScalar: bn(0.5), maxLiquidationLimitAccumulationMultiplier: bn(1), liquidationRewardRatio: bn(0.05), - maxSecondsInLiquidationWindow: bn(10), + maxSecondsInLiquidationWindow: ethers.BigNumber.from(10), minimumPositionMargin: bn(500), }, settlementStrategy: { @@ -67,9 +68,8 @@ describe('Account margins test', () => { }); it('has correct initial and maintenance margin', async () => { - const [initialMargin, maintenanceMargin] = await systems().PerpsMarket.getRequiredMargins( - accountId - ); + const [initialMargin, maintenanceMargin] = + await systems().PerpsMarket.getRequiredMargins(accountId); assertBn.equal(initialMargin, 0); assertBn.equal(maintenanceMargin, 0); }); diff --git a/markets/perps-market/test/integration/Account/ModifyCollateral.withdraw.test.ts b/markets/perps-market/test/integration/Account/ModifyCollateral.withdraw.test.ts index cf06a0f860..3091176dd7 100644 --- a/markets/perps-market/test/integration/Account/ModifyCollateral.withdraw.test.ts +++ b/markets/perps-market/test/integration/Account/ModifyCollateral.withdraw.test.ts @@ -17,28 +17,83 @@ describe('ModifyCollateral Withdraw', () => { const withdrawAmount = wei(0.1); const BTC_PRICE = wei(10_000); - const { systems, owner, synthMarkets, superMarketId, trader1 } = bootstrapMarkets({ - synthMarkets: [ - { - name: 'Bitcoin', - token: 'snxBTC', - buyPrice: BTC_PRICE.toBN(), - sellPrice: BTC_PRICE.toBN(), - }, - ], - perpsMarkets: [], - traderAccountIds: accountIds, - }); + const { systems, owner, synthMarkets, provider, superMarketId, trader1, trader2 } = + bootstrapMarkets({ + synthMarkets: [ + { + name: 'Bitcoin', + token: 'snxBTC', + buyPrice: BTC_PRICE.toBN(), + sellPrice: BTC_PRICE.toBN(), + }, + ], + perpsMarkets: [], + traderAccountIds: accountIds, + }); let synthBTCMarketId: ethers.BigNumber; before('identify actors', () => { synthBTCMarketId = synthMarkets()[0].marketId(); }); + const restoreToSetup = snapshotCheckpoint(provider); + + describe('withdraw without open position modifyCollateral() from another account', async () => { + before(restoreToSetup); + + before('owner sets limits to max', async () => { + await systems() + .PerpsMarket.connect(owner()) + .setMaxCollateralAmount(synthBTCMarketId, ethers.constants.MaxUint256); + }); + + before('trader1 buys 1 snxBTC', async () => { + await systems() + .SpotMarket.connect(trader1()) + .buy(synthBTCMarketId, marginAmount.toBN(), oneBTC.toBN(), ethers.constants.AddressZero); + }); + + before('trader1 approves the perps market', async () => { + await synthMarkets()[0] + .synth() + .connect(trader1()) + .approve(systems().PerpsMarket.address, depositAmount.toBN()); + }); + + before('trader1 deposits collateral', async () => { + await systems() + .PerpsMarket.connect(trader1()) + .modifyCollateral(accountIds[0], synthBTCMarketId, depositAmount.toBN()); + }); + before('trader2 deposits snxUSD as collateral', async () => { + await systems() + .PerpsMarket.connect(trader2()) + .modifyCollateral(accountIds[1], sUSDSynthId, depositAmount.toBN()); + }); + it('reverts when trader1 tries to withdraw snxUSD', async () => { + await assertRevert( + systems() + .PerpsMarket.connect(trader1()) + .modifyCollateral(accountIds[0], sUSDSynthId, withdrawAmount.mul(-1).toBN()), + `InsufficientSynthCollateral("${sUSDSynthId}", "0", "${withdrawAmount.toBN()}")` + ); + }); + it('reverts when trader2 tries to withdraw snxBTC', async () => { + await assertRevert( + systems() + .PerpsMarket.connect(trader2()) + .modifyCollateral(accountIds[1], synthBTCMarketId, withdrawAmount.mul(-1).toBN()), + `InsufficientSynthCollateral("${synthBTCMarketId}", "0", "${withdrawAmount.toBN()}")` + ); + }); + }); + describe('withdraw without open position modifyCollateral()', async () => { let spotBalanceBefore: ethers.BigNumber; let modifyCollateralWithdrawTxn: ethers.providers.TransactionResponse; + before(restoreToSetup); + before('owner sets limits to max', async () => { await systems() .PerpsMarket.connect(owner()) @@ -125,7 +180,7 @@ describe('ModifyCollateral Withdraw', () => { maintenanceMarginScalar: bn(0.5), maxLiquidationLimitAccumulationMultiplier: bn(1), liquidationRewardRatio: bn(0.05), - maxSecondsInLiquidationWindow: bn(10), + maxSecondsInLiquidationWindow: ethers.BigNumber.from(10), minimumPositionMargin: bn(0), }, settlementStrategy: { @@ -144,7 +199,7 @@ describe('ModifyCollateral Withdraw', () => { maintenanceMarginScalar: bn(0.5), maxLiquidationLimitAccumulationMultiplier: bn(1), liquidationRewardRatio: bn(0.05), - maxSecondsInLiquidationWindow: bn(10), + maxSecondsInLiquidationWindow: ethers.BigNumber.from(10), minimumPositionMargin: bn(0), }, settlementStrategy: { diff --git a/markets/perps-market/test/integration/Liquidation/Liquidation.margin.test.ts b/markets/perps-market/test/integration/Liquidation/Liquidation.margin.test.ts index 07743089c2..208e7a25ac 100644 --- a/markets/perps-market/test/integration/Liquidation/Liquidation.margin.test.ts +++ b/markets/perps-market/test/integration/Liquidation/Liquidation.margin.test.ts @@ -4,6 +4,7 @@ import { bn, bootstrapMarkets } from '../bootstrap'; import { OpenPositionData, openPosition } from '../helpers'; import { snapshotCheckpoint } from '@synthetixio/core-utils/utils/mocha/snapshot'; import { ethers } from 'ethers'; +import assert from 'assert/strict'; describe('Liquidation - margin', async () => { const perpsMarketConfigs = [ @@ -19,7 +20,7 @@ describe('Liquidation - margin', async () => { maintenanceMarginScalar: bn(0.5), maxLiquidationLimitAccumulationMultiplier: bn(1), liquidationRewardRatio: bn(0.05), - maxSecondsInLiquidationWindow: bn(10), + maxSecondsInLiquidationWindow: ethers.BigNumber.from(10), minimumPositionMargin: bn(0), }, settlementStrategy: { @@ -38,7 +39,7 @@ describe('Liquidation - margin', async () => { maintenanceMarginScalar: bn(0.5), maxLiquidationLimitAccumulationMultiplier: bn(1), liquidationRewardRatio: bn(0.05), - maxSecondsInLiquidationWindow: bn(10), + maxSecondsInLiquidationWindow: ethers.BigNumber.from(10), minimumPositionMargin: bn(0), }, settlementStrategy: { @@ -57,7 +58,7 @@ describe('Liquidation - margin', async () => { maintenanceMarginScalar: bn(0.5), maxLiquidationLimitAccumulationMultiplier: bn(1), liquidationRewardRatio: bn(0.05), - maxSecondsInLiquidationWindow: bn(10), + maxSecondsInLiquidationWindow: ethers.BigNumber.from(10), minimumPositionMargin: bn(0), }, settlementStrategy: { @@ -76,7 +77,7 @@ describe('Liquidation - margin', async () => { maintenanceMarginScalar: bn(0.5), maxLiquidationLimitAccumulationMultiplier: bn(1), liquidationRewardRatio: bn(0.05), - maxSecondsInLiquidationWindow: bn(10), + maxSecondsInLiquidationWindow: ethers.BigNumber.from(10), minimumPositionMargin: bn(0), }, settlementStrategy: { @@ -95,7 +96,7 @@ describe('Liquidation - margin', async () => { maintenanceMarginScalar: bn(0.5), maxLiquidationLimitAccumulationMultiplier: bn(1), liquidationRewardRatio: bn(0.05), - maxSecondsInLiquidationWindow: bn(10), + maxSecondsInLiquidationWindow: ethers.BigNumber.from(10), minimumPositionMargin: bn(0), }, settlementStrategy: { @@ -237,6 +238,8 @@ describe('Liquidation - margin', async () => { systems().PerpsMarket.connect(keeper()).liquidate(2), 'NotEligibleForLiquidation' ); + + assert.equal(await systems().PerpsMarket.canLiquidate(2), false); }); }); describe('price change - available margin 0 ', () => { @@ -281,7 +284,7 @@ describe('Liquidation - margin', async () => { const minimumInitialMarginRatio = bn(0.5); const maxLiquidationLimitAccumulationMultiplier = bn(1); const liquidationRewardRatio = bn(0.05); - const maxSecondsInLiquidationWindow = bn(10); + const maxSecondsInLiquidationWindow = ethers.BigNumber.from(10); const minimumPositionMargin = bn(50); // this is the only change from the initial values await systems() .PerpsMarket.connect(owner()) @@ -315,6 +318,11 @@ describe('Liquidation - margin', async () => { 'AccountLiquidatable(2)' ); }); + + // sanity check + it('is eligible for liquidation', async () => { + assert.equal(await systems().PerpsMarket.canLiquidate(2), true); + }); // reset minimumPositionMargin to 0 after(restoreMinimumPositionMargin); }); diff --git a/markets/perps-market/test/integration/Liquidation/Liquidation.maxLiquidationAmount.endorsedLiquidator.ts b/markets/perps-market/test/integration/Liquidation/Liquidation.maxLiquidationAmount.endorsedLiquidator.ts index 80e7f439af..bb368605a8 100644 --- a/markets/perps-market/test/integration/Liquidation/Liquidation.maxLiquidationAmount.endorsedLiquidator.ts +++ b/markets/perps-market/test/integration/Liquidation/Liquidation.maxLiquidationAmount.endorsedLiquidator.ts @@ -90,5 +90,9 @@ describe('Liquidation - endorsed liquidator', async () => { .getOpenPosition(2, perpsMarket.marketId()); assertBn.equal(size, bn(0)); }); + + it('did not send any liquidation reward', async () => { + assertBn.equal(await systems().USD.balanceOf(keeper().getAddress()), 0); + }); }); }); diff --git a/markets/perps-market/test/integration/Liquidation/Liquidation.maxLiquidationAmount.macro.test.ts b/markets/perps-market/test/integration/Liquidation/Liquidation.maxLiquidationAmount.macro.test.ts new file mode 100644 index 0000000000..7ea47ff559 --- /dev/null +++ b/markets/perps-market/test/integration/Liquidation/Liquidation.maxLiquidationAmount.macro.test.ts @@ -0,0 +1,227 @@ +import { fastForwardTo, getTxTime } from '@synthetixio/core-utils/utils/hardhat/rpc'; +import { PerpsMarket, bn, bootstrapMarkets } from '../bootstrap'; +import { openPosition } from '../helpers'; +import assertBn from '@synthetixio/core-utils/src/utils/assertions/assert-bignumber'; +import { ethers } from 'ethers'; + +describe('Liquidation - max liquidatable amount with multiple continuing liquidations', async () => { + const { systems, provider, trader1, trader2, keeper, perpsMarkets } = bootstrapMarkets({ + synthMarkets: [], + perpsMarkets: [ + { + requestedMarketId: 50, + name: 'Optimism', + token: 'OP', + price: bn(10), + orderFees: { + makerFee: bn(0.007), + takerFee: bn(0.003), + }, + fundingParams: { skewScale: bn(1000), maxFundingVelocity: bn(0) }, + liquidationParams: { + initialMarginFraction: bn(3), + minimumInitialMarginRatio: bn(0), + maintenanceMarginScalar: bn(0.66), + maxLiquidationLimitAccumulationMultiplier: bn(1), + liquidationRewardRatio: bn(0.05), + // time window 30 seconds + maxSecondsInLiquidationWindow: ethers.BigNumber.from(30), + minimumPositionMargin: bn(0), + }, + settlementStrategy: { + settlementReward: bn(0), + }, + }, + ], + traderAccountIds: [2, 3], + }); + + let perpsMarket: PerpsMarket; + before('identify actors', () => { + perpsMarket = perpsMarkets()[0]; + }); + + before('add collateral to margin', async () => { + await systems().PerpsMarket.connect(trader1()).modifyCollateral(2, 0, bn(900)); + await systems().PerpsMarket.connect(trader2()).modifyCollateral(3, 0, bn(3400)); + }); + + before('open position', async () => { + await openPosition({ + systems, + provider, + trader: trader1(), + accountId: 2, + keeper: keeper(), + marketId: perpsMarket.marketId(), + sizeDelta: bn(100), + settlementStrategyId: perpsMarket.strategyId(), + price: bn(10), + }); + await openPosition({ + systems, + provider, + trader: trader2(), + accountId: 3, + keeper: keeper(), + marketId: perpsMarket.marketId(), + sizeDelta: bn(300), + settlementStrategyId: perpsMarket.strategyId(), + price: bn(10), + }); + }); + + before('lower price to liquidation', async () => { + await perpsMarket.aggregator().mockSetCurrentPrice(bn(1)); + }); + + /** + * Based on the above configuration, the max liquidation amount for window == 300 + * * (maker + taker) * skewScale * secondsInWindow * multiplier + */ + + let initialLiquidationTime: number; + + describe('1st liquidation amount', () => { + before('call liquidate', async () => { + const tx = await systems().PerpsMarket.connect(keeper()).liquidate(2); + initialLiquidationTime = await getTxTime(provider(), tx); + }); + + it('liquidated all 100 OP', async () => { + const [, , size] = await systems().PerpsMarket.getOpenPosition(2, perpsMarket.marketId()); + assertBn.equal(size, bn(0)); + }); + }); + + describe('after 29 seconds', () => { + let timeSetupCompletes: number; + + before('setup previous position', async () => { + await perpsMarket.aggregator().mockSetCurrentPrice(bn(10)); + await systems().PerpsMarket.connect(trader1()).modifyCollateral(2, 0, bn(90)); + await openPosition({ + systems, + provider, + trader: trader1(), + accountId: 2, + keeper: keeper(), + marketId: perpsMarket.marketId(), + // make size delta smaller + sizeDelta: bn(10), + settlementStrategyId: perpsMarket.strategyId(), + price: bn(10), + }); + const tx = await perpsMarket.aggregator().mockSetCurrentPrice(bn(1)); + timeSetupCompletes = await getTxTime(provider(), tx); + }); + + before('fastforward', async () => { + await fastForwardTo( + initialLiquidationTime + (29 - (timeSetupCompletes - initialLiquidationTime)), + provider() + ); + }); + // liquidate call liquidates trader again, now 20 has been liquidated within the window + before('call liquidate', async () => { + const tx = await systems().PerpsMarket.connect(keeper()).liquidate(2); + initialLiquidationTime = await getTxTime(provider(), tx); + }); + + it('liquidated 10', async () => { + const [, , size] = await systems().PerpsMarket.getOpenPosition(2, perpsMarket.marketId()); + assertBn.equal(size, bn(0)); + }); + }); + + describe('after another 29 seconds', () => { + let timeSetupCompletes: number; + + before('setup previous position', async () => { + await perpsMarket.aggregator().mockSetCurrentPrice(bn(10)); + await systems().PerpsMarket.connect(trader1()).modifyCollateral(2, 0, bn(90)); + await openPosition({ + systems, + provider, + trader: trader1(), + accountId: 2, + keeper: keeper(), + marketId: perpsMarket.marketId(), + // make size delta smaller + sizeDelta: bn(10), + settlementStrategyId: perpsMarket.strategyId(), + price: bn(10), + }); + const tx = await perpsMarket.aggregator().mockSetCurrentPrice(bn(1)); + timeSetupCompletes = await getTxTime(provider(), tx); + }); + + before('fastforward', async () => { + await fastForwardTo( + initialLiquidationTime + (29 - (timeSetupCompletes - initialLiquidationTime)), + provider() + ); + }); + // liquidate call liquidates trader again, now 20 has been liquidated within the window, but 30 has in the last 58 seconds + before('call liquidate', async () => { + const tx = await systems().PerpsMarket.connect(keeper()).liquidate(2); + initialLiquidationTime = await getTxTime(provider(), tx); + }); + + it('liquidated 10 again', async () => { + const [, , size] = await systems().PerpsMarket.getOpenPosition(2, perpsMarket.marketId()); + assertBn.equal(size, bn(0)); + }); + }); + + describe('after another 29 seconds', () => { + let timeSetupCompletes: number; + + before('setup previous position', async () => { + await perpsMarket.aggregator().mockSetCurrentPrice(bn(10)); + await systems().PerpsMarket.connect(trader1()).modifyCollateral(2, 0, bn(90)); + await openPosition({ + systems, + provider, + trader: trader1(), + accountId: 2, + keeper: keeper(), + marketId: perpsMarket.marketId(), + // make size delta smaller + sizeDelta: bn(10), + settlementStrategyId: perpsMarket.strategyId(), + price: bn(10), + }); + const tx = await perpsMarket.aggregator().mockSetCurrentPrice(bn(1)); + timeSetupCompletes = await getTxTime(provider(), tx); + }); + + before('fastforward', async () => { + await fastForwardTo( + initialLiquidationTime + (29 - (timeSetupCompletes - initialLiquidationTime)), + provider() + ); + }); + // liquidate call liquidates trader again, now 20 has been liquidated within the window, but 130 has in the last ~87 seconds + before('call liquidate', async () => { + const tx = await systems().PerpsMarket.connect(keeper()).liquidate(2); + initialLiquidationTime = await getTxTime(provider(), tx); + }); + + it('liquidated 10 again', async () => { + const [, , size] = await systems().PerpsMarket.getOpenPosition(2, perpsMarket.marketId()); + assertBn.equal(size, bn(0)); + }); + }); + + describe('liquidate second trader', () => { + before('call liquidate', async () => { + await systems().PerpsMarket.connect(keeper()).liquidate(3); + }); + + it('liquidated only 270, 20 left', async () => { + const [, , size] = await systems().PerpsMarket.getOpenPosition(3, perpsMarket.marketId()); + assertBn.equal(size, bn(20)); + }); + }); +}); diff --git a/markets/perps-market/test/integration/Liquidation/Liquidation.maxLiquidationAmount.maxPd.test.ts b/markets/perps-market/test/integration/Liquidation/Liquidation.maxLiquidationAmount.maxPd.test.ts index 65e98d8c56..969067b33b 100644 --- a/markets/perps-market/test/integration/Liquidation/Liquidation.maxLiquidationAmount.maxPd.test.ts +++ b/markets/perps-market/test/integration/Liquidation/Liquidation.maxLiquidationAmount.maxPd.test.ts @@ -148,7 +148,7 @@ describe('Liquidation - max pd', async () => { }); describe('next block', () => { - before('call liquidate twice more since under max pd', async () => { + before('call liquidate again', async () => { await systems().PerpsMarket.connect(keeper()).liquidate(2); }); @@ -169,9 +169,9 @@ describe('Liquidation - max pd', async () => { }); // because the previous liquidation of trader 1 was of 15 OP, the remaining amount that can be liquidated is 10 OP - it('liquidated 10 OP', async () => { + it('liquidated all 10 OP', async () => { const [, , size] = await systems().PerpsMarket.getOpenPosition(3, perpsMarket.marketId()); - assertBn.equal(size, bn(-15)); + assertBn.equal(size, 0); }); }); }); diff --git a/markets/perps-market/test/integration/Liquidation/Liquidation.multi-collateral.test.ts b/markets/perps-market/test/integration/Liquidation/Liquidation.multi-collateral.test.ts index abb9038b7e..b8cda4b634 100644 --- a/markets/perps-market/test/integration/Liquidation/Liquidation.multi-collateral.test.ts +++ b/markets/perps-market/test/integration/Liquidation/Liquidation.multi-collateral.test.ts @@ -21,7 +21,7 @@ describe('Liquidation - multi collateral', async () => { maintenanceMarginScalar: bn(0.5), maxLiquidationLimitAccumulationMultiplier: bn(1), liquidationRewardRatio: bn(0.01), - maxSecondsInLiquidationWindow: bn(10), + maxSecondsInLiquidationWindow: ethers.BigNumber.from(10), minimumPositionMargin: bn(0), }, settlementStrategy: { @@ -40,7 +40,7 @@ describe('Liquidation - multi collateral', async () => { maintenanceMarginScalar: bn(0.5), maxLiquidationLimitAccumulationMultiplier: bn(1), liquidationRewardRatio: bn(0.02), - maxSecondsInLiquidationWindow: bn(10), + maxSecondsInLiquidationWindow: ethers.BigNumber.from(10), minimumPositionMargin: bn(0), }, settlementStrategy: { @@ -59,7 +59,7 @@ describe('Liquidation - multi collateral', async () => { maintenanceMarginScalar: bn(0.5), maxLiquidationLimitAccumulationMultiplier: bn(1), liquidationRewardRatio: bn(0.05), - maxSecondsInLiquidationWindow: bn(10), + maxSecondsInLiquidationWindow: ethers.BigNumber.from(10), minimumPositionMargin: bn(0), }, settlementStrategy: { diff --git a/markets/perps-market/test/integration/Market/MarketConfiguration.test.ts b/markets/perps-market/test/integration/Market/MarketConfiguration.test.ts index 7c8b7fa63e..ec9435e0ec 100644 --- a/markets/perps-market/test/integration/Market/MarketConfiguration.test.ts +++ b/markets/perps-market/test/integration/Market/MarketConfiguration.test.ts @@ -42,7 +42,7 @@ describe('MarketConfiguration', async () => { maxLiquidationLimitAccumulationMultiplier: bn(5), minimumPositionMargin: bn(50), liquidationRewardRatioD18: bn(10e9), - maxSecondsInLiquidationWindow: bn(10), + maxSecondsInLiquidationWindow: ethers.BigNumber.from(10), maxLiquidationPd: bn(0), }; @@ -287,9 +287,8 @@ describe('MarketConfiguration', async () => { }); it('get fundingParameters', async () => { - const [skewScale, maxFundingVelocity] = await systems().PerpsMarket.getFundingParameters( - marketId - ); + const [skewScale, maxFundingVelocity] = + await systems().PerpsMarket.getFundingParameters(marketId); assertBn.equal(maxFundingVelocity, fixture.maxFundingVelocity); assertBn.equal(skewScale, fixture.skewScale); }); diff --git a/markets/perps-market/test/integration/Orders/Order.marginValidation.test.ts b/markets/perps-market/test/integration/Orders/Order.marginValidation.test.ts index ce22719c69..3a648c98c1 100644 --- a/markets/perps-market/test/integration/Orders/Order.marginValidation.test.ts +++ b/markets/perps-market/test/integration/Orders/Order.marginValidation.test.ts @@ -45,7 +45,7 @@ describe('Orders - margin validation', () => { maintenanceMarginScalar: liqParams.btc.mmScalar.toBN(), maxLiquidationLimitAccumulationMultiplier: bn(1), liquidationRewardRatio: liqParams.btc.liqRatio.toBN(), - maxSecondsInLiquidationWindow: bn(10), + maxSecondsInLiquidationWindow: ethers.BigNumber.from(10), minimumPositionMargin: bn(0), }, settlementStrategy: { @@ -64,7 +64,7 @@ describe('Orders - margin validation', () => { maintenanceMarginScalar: liqParams.eth.mmScalar.toBN(), maxLiquidationLimitAccumulationMultiplier: bn(1), liquidationRewardRatio: liqParams.eth.liqRatio.toBN(), - maxSecondsInLiquidationWindow: bn(10), + maxSecondsInLiquidationWindow: ethers.BigNumber.from(10), minimumPositionMargin: bn(0), }, settlementStrategy: { diff --git a/markets/perps-market/test/integration/bootstrap/bootstrap.ts b/markets/perps-market/test/integration/bootstrap/bootstrap.ts index 35d1390561..366645c5e8 100644 --- a/markets/perps-market/test/integration/bootstrap/bootstrap.ts +++ b/markets/perps-market/test/integration/bootstrap/bootstrap.ts @@ -1,15 +1,15 @@ -import { coreBootstrap } from '@synthetixio/router/dist/utils/tests'; -import { wei } from '@synthetixio/wei'; -import { ethers } from 'ethers'; -import { FeeCollectorMock, PerpsMarketProxy, AccountProxy } from '../../generated/typechain'; -import { SpotMarketProxy, SynthRouter } from '@synthetixio/spot-market/test/generated/typechain'; -import { SynthArguments, bootstrapSynthMarkets } from '@synthetixio/spot-market/test/common'; -import { PerpsMarketData, bootstrapPerpsMarkets, bootstrapTraders } from '.'; -import { MockPyth } from '@synthetixio/oracle-manager/typechain-types'; +import { snapshotCheckpoint } from '@synthetixio/core-utils/utils/mocha/snapshot'; import { CoreProxy, USDProxy } from '@synthetixio/main/test/generated/typechain'; -import { Proxy as OracleManagerProxy } from '@synthetixio/oracle-manager/test/generated/typechain'; import { CollateralMock } from '@synthetixio/main/typechain-types'; -import { snapshotCheckpoint } from '@synthetixio/core-utils/utils/mocha/snapshot'; +import { Proxy as OracleManagerProxy } from '@synthetixio/oracle-manager/test/generated/typechain'; +import { MockPyth } from '@synthetixio/oracle-manager/typechain-types'; +import { coreBootstrap } from '@synthetixio/router/utils/tests'; +import { bootstrapSynthMarkets, SynthArguments } from '@synthetixio/spot-market/test/common'; +import { SpotMarketProxy, SynthRouter } from '@synthetixio/spot-market/test/generated/typechain'; +import { wei } from '@synthetixio/wei'; +import { ethers } from 'ethers'; +import { AccountProxy, FeeCollectorMock, PerpsMarketProxy } from '../../generated/typechain'; +import { bootstrapPerpsMarkets, bootstrapTraders, PerpsMarketData } from './'; type Proxies = { ['synthetix.CoreProxy']: CoreProxy; diff --git a/markets/spot-market/cannonfile.test.toml b/markets/spot-market/cannonfile.test.toml index 67b86efc71..5211a006e8 100644 --- a/markets/spot-market/cannonfile.test.toml +++ b/markets/spot-market/cannonfile.test.toml @@ -51,31 +51,19 @@ artifact = "contracts/Proxy.sol:Proxy" args = ["<%= contracts.CoreModule.address %>", "<%= settings.owner %>"] abiOf = ["CoreModule"] salt = "<%= settings.salt %>" -depends = ["contract.CoreModule"] # Core [router.SpotMarketRouter] contracts = [ - "CoreModule", - "SpotMarketFactoryModule", - "AtomicOrderModule", - "AsyncOrderModule", - "AsyncOrderSettlementModule", - "AsyncOrderConfigurationModule", - "WrapperModule", - "MarketConfigurationModule", - "FeatureFlagModule" -] -depends = [ - "contract.CoreModule", - "contract.SpotMarketFactoryModule", - "contract.AtomicOrderModule", - "contract.AsyncOrderModule", - "contract.AsyncOrderSettlementModule", - "contract.AsyncOrderConfigurationModule", - "contract.WrapperModule", - "contract.MarketConfigurationModule", - "contract.FeatureFlagModule", + "CoreModule", + "SpotMarketFactoryModule", + "AtomicOrderModule", + "AsyncOrderModule", + "AsyncOrderSettlementModule", + "AsyncOrderConfigurationModule", + "WrapperModule", + "MarketConfigurationModule", + "FeatureFlagModule" ] [invoke.upgrade_spot_market_proxy] @@ -86,51 +74,41 @@ args = ["<%= contracts.SpotMarketRouter.address %>"] factory.SpotMarketProxy.abiOf = ["SpotMarketRouter"] factory.SpotMarketProxy.event = "Upgraded" factory.SpotMarketProxy.arg = 0 -depends = ["contract.InitialSpotMarketProxy", "router.SpotMarketRouter"] # create synth router [router.SynthRouter] -contracts = [ - "CoreModule", - "SynthTokenModule" -] -depends = [ - "contract.CoreModule", - "contract.SynthTokenModule" -] +contracts = ["CoreModule", "SynthTokenModule"] [invoke.set_synthetix_system] target = ["SpotMarketProxy"] from = "<%= settings.coreProxyOwner %>" func = "setSynthetix" -args = [ - "<%= imports.synthetix.contracts.CoreProxy.address %>" -] -depends = ["invoke.upgrade_spot_market_proxy", "import.synthetix"] +args = ["<%= imports.synthetix.contracts.CoreProxy.address %>"] [invoke.set_synth_implementation] target = ["SpotMarketProxy"] from = "<%= settings.coreProxyOwner %>" func = "setSynthImplementation" -args = [ - "<%= contracts.SynthRouter.address %>" -] -depends = ["invoke.upgrade_spot_market_proxy", "router.SynthRouter"] +args = ["<%= contracts.SynthRouter.address %>"] # add pool owner to feature flag allow list [invoke.addSpotMarketToFeatureFlag] target = ["synthetix.CoreProxy"] func = "addToFeatureFlagAllowlist" from = "<%= settings.coreProxyOwner %>" -args = ["0x72656769737465724d61726b6574000000000000000000000000000000000000", "<%= contracts.SpotMarketProxy.address %>"] # formatBytes32String("registerMarket") -depends = ['invoke.set_synthetix_system'] +args = [ + "0x72656769737465724d61726b6574000000000000000000000000000000000000", + "<%= contracts.SpotMarketProxy.address %>" +] # formatBytes32String("registerMarket") [invoke.addCreateSynthToFeatureFlag] target = ["SpotMarketProxy"] func = "addToFeatureFlagAllowlist" from = "<%= settings.owner %>" -args = ["0x63726561746553796e7468000000000000000000000000000000000000000000", "<%= settings.owner %>"] # formatBytes32String("createSynth") -depends = ["invoke.upgrade_spot_market_proxy"] +args = [ + "0x63726561746553796e7468000000000000000000000000000000000000000000", + "<%= settings.owner %>" +] # formatBytes32String("createSynth") [contract.FeeCollectorMock] artifact = "contracts/mocks/FeeCollectorMock.sol:FeeCollectorMock" @@ -142,10 +120,8 @@ artifact = "contracts/mocks/OracleVerifierMock.sol:OracleVerifierMock" target = ["FeeCollectorMock"] func = "setUsdToken" args = ["<%= imports.synthetix.contracts.USDProxy.address %>"] -depends = ["contract.FeeCollectorMock", "import.synthetix"] [invoke.set_initial_price] target = ["OracleVerifierMock"] func = "setPrice" args = ["2000"] -depends = ["contract.OracleVerifierMock"] diff --git a/markets/spot-market/cannonfile.toml b/markets/spot-market/cannonfile.toml index a7061834cd..24f811f6c6 100644 --- a/markets/spot-market/cannonfile.toml +++ b/markets/spot-market/cannonfile.toml @@ -13,7 +13,7 @@ defaultValue = "synthetix:<%= package.version %>" defaultValue = "main" [setting.salt] -defaultValue = 'snax' +defaultValue = "snax" [import.synthetix] source = "<%= settings.synthetixPackage %>" @@ -54,31 +54,19 @@ artifact = "contracts/Proxy.sol:Proxy" args = ["<%= contracts.CoreModule.address %>", "<%= settings.owner %>"] abiOf = ["CoreModule"] salt = "<%= settings.salt %>" -depends = ["contract.CoreModule"] # Core [router.SpotMarketRouter] contracts = [ - "CoreModule", - "SpotMarketFactoryModule", - "AtomicOrderModule", - "AsyncOrderModule", - "AsyncOrderSettlementModule", - "AsyncOrderConfigurationModule", - "WrapperModule", - "MarketConfigurationModule", - "FeatureFlagModule" -] -depends = [ - "contract.CoreModule", - "contract.SpotMarketFactoryModule", - "contract.AtomicOrderModule", - "contract.AsyncOrderModule", - "contract.AsyncOrderSettlementModule", - "contract.AsyncOrderConfigurationModule", - "contract.WrapperModule", - "contract.MarketConfigurationModule", - "contract.FeatureFlagModule", + "CoreModule", + "SpotMarketFactoryModule", + "AtomicOrderModule", + "AsyncOrderModule", + "AsyncOrderSettlementModule", + "AsyncOrderConfigurationModule", + "WrapperModule", + "MarketConfigurationModule", + "FeatureFlagModule" ] [invoke.upgradeSpotMarketProxy] @@ -89,48 +77,35 @@ args = ["<%= contracts.SpotMarketRouter.address %>"] factory.SpotMarketProxy.abiOf = ["SpotMarketRouter"] factory.SpotMarketProxy.event = "Upgraded" factory.SpotMarketProxy.arg = 0 -depends = ["contract.InitialSpotMarketProxy", "router.SpotMarketRouter"] # create synth router [router.SynthRouter] -contracts = [ - "CoreModule", - "SynthTokenModule" -] -depends = [ - "contract.CoreModule", - "contract.SynthTokenModule" -] +contracts = ["CoreModule", "SynthTokenModule"] [invoke.setSynthetixSystem] target = ["SpotMarketProxy"] fromCall.func = "owner" func = "setSynthetix" -args = [ - "<%= imports.synthetix.contracts.CoreProxy.address %>" -] -depends = ["invoke.upgradeSpotMarketProxy", "import.synthetix"] +args = ["<%= imports.synthetix.contracts.CoreProxy.address %>"] [invoke.setSynthImplementation] target = ["SpotMarketProxy"] fromCall.func = "owner" func = "setSynthImplementation" -args = [ - "<%= contracts.SynthRouter.address %>" -] -depends = ["invoke.upgradeSpotMarketProxy", "router.SynthRouter"] +args = ["<%= contracts.SynthRouter.address %>"] # add pool owner to feature flag allow list [invoke.addSpotMarketToFeatureFlag] target = ["synthetix.CoreProxy"] func = "addToFeatureFlagAllowlist" fromCall.func = "owner" -args = ["<%= formatBytes32String('registerMarket') %>", "<%= contracts.SpotMarketProxy.address %>"] -depends = ['invoke.setSynthetixSystem'] +args = [ + "<%= formatBytes32String('registerMarket') %>", + "<%= contracts.SpotMarketProxy.address %>" +] [invoke.addCreateSynthToFeatureFlag] target = ["SpotMarketProxy"] func = "addToFeatureFlagAllowlist" fromCall.func = "owner" args = ["<%= formatBytes32String('createSynth') %>", "<%= settings.owner %>"] -depends = ["invoke.upgradeSpotMarketProxy"] diff --git a/markets/spot-market/contracts/interfaces/ISpotMarketFactoryModule.sol b/markets/spot-market/contracts/interfaces/ISpotMarketFactoryModule.sol index 4c48cfeae6..1f0d7196aa 100644 --- a/markets/spot-market/contracts/interfaces/ISpotMarketFactoryModule.sol +++ b/markets/spot-market/contracts/interfaces/ISpotMarketFactoryModule.sol @@ -34,8 +34,9 @@ interface ISpotMarketFactoryModule is IMarket { /** * @notice Gets fired when the synth is registered as a market. * @param synthMarketId Id of the synth market that was created + * @param synthTokenAddress address of the newly created synth token */ - event SynthRegistered(uint256 indexed synthMarketId); + event SynthRegistered(uint256 indexed synthMarketId, address synthTokenAddress); /** * @notice Gets fired when the synth's implementation is updated on the corresponding proxy. * @param proxy the synth proxy servicing the latest implementation @@ -176,6 +177,13 @@ interface ISpotMarketFactoryModule is IMarket { */ function renounceMarketNomination(uint128 synthMarketId) external; + /** + * @notice Allows the market owner to renounce his ownership. + * @dev Reverts if the caller is not the owner. + * @param synthMarketId synth market id value + */ + function renounceMarketOwnership(uint128 synthMarketId) external; + /** * @notice Returns market owner. * @param synthMarketId synth market id value diff --git a/markets/spot-market/contracts/modules/SpotMarketFactoryModule.sol b/markets/spot-market/contracts/modules/SpotMarketFactoryModule.sol index 2f4a0c95f5..69b8b5a55e 100644 --- a/markets/spot-market/contracts/modules/SpotMarketFactoryModule.sol +++ b/markets/spot-market/contracts/modules/SpotMarketFactoryModule.sol @@ -88,7 +88,7 @@ contract SpotMarketFactoryModule is ISpotMarketFactoryModule, AssociatedSystemsM // default collateral leverage to 1 MarketConfiguration.load(synthMarketId).collateralLeverage = DecimalMath.UNIT; - emit SynthRegistered(synthMarketId); + emit SynthRegistered(synthMarketId, address(SynthUtil.getToken(synthMarketId))); } /** @@ -235,6 +235,18 @@ contract SpotMarketFactoryModule is ISpotMarketFactoryModule, AssociatedSystemsM return spotMarketFactory.marketOwners[synthMarketId]; } + /** + * @inheritdoc ISpotMarketFactoryModule + */ + function renounceMarketOwnership(uint128 synthMarketId) external override { + SpotMarketFactory.Data storage spotMarketFactory = SpotMarketFactory.load(); + spotMarketFactory.onlyMarketOwner(synthMarketId); + + address currentOwner = spotMarketFactory.marketOwners[synthMarketId]; + spotMarketFactory.marketOwners[synthMarketId] = address(0); + emit MarketOwnerChanged(synthMarketId, currentOwner, address(0)); + } + /** * @dev See {IERC165-supportsInterface}. */ diff --git a/markets/spot-market/hardhat.config.ts b/markets/spot-market/hardhat.config.ts index 20d62bd165..c4c8ca8e4b 100644 --- a/markets/spot-market/hardhat.config.ts +++ b/markets/spot-market/hardhat.config.ts @@ -26,7 +26,7 @@ const config = { }, }, mocha: { - timeout: 200_000, + timeout: 30_000, }, }; diff --git a/markets/spot-market/package.json b/markets/spot-market/package.json index f07db15c5f..d0912be840 100644 --- a/markets/spot-market/package.json +++ b/markets/spot-market/package.json @@ -4,20 +4,20 @@ "description": "Spot Market implementation", "scripts": { "build": "yarn build:contracts", - "build:contracts": "rm -rf contracts/generated && hardhat storage:verify && hardhat cannon:build", - "build-testable": "hardhat cannon:build cannonfile.test.toml", + "build:contracts": "rm -rf contracts/generated && hardhat storage:verify && CANNON_REGISTRY_PRIORITY=local hardhat cannon:build", + "build-testable": "CANNON_REGISTRY_PRIORITY=local hardhat cannon:build cannonfile.test.toml", "check:storage": "git diff --exit-code storage.dump.sol", "start": "yarn build && yarn cannon-build", "clean": "hardhat clean", "cannon-build": "hardhat cannon:build", - "test": "hardhat test", + "test": "CANNON_REGISTRY_PRIORITY=local hardhat test", "test:fork": "hardhat test test-fork/AsyncOrdersModule.e2e.test.ts", "coverage": "hardhat test", "coverage1": "hardhat coverage --network hardhat", "compile-contracts": "hardhat compile", - "publish-contracts": "yarn build && cannon publish synthetix-spot-market:$(node -p 'require(`./package.json`).version') --quiet", + "publish-contracts": "cannon publish synthetix-spot-market:$(node -p 'require(`./package.json`).version') --chain-id 13370 --quiet --tags $(node -p '/^\\d+\\.\\d+\\.\\d+$/.test(require(`./package.json`).version) ? `latest` : `dev`')", + "postpack": "yarn build && yarn publish-contracts", "size-contracts": "hardhat compile && hardhat size-contracts", - "postpack": "yarn publish-contracts", "docgen": "hardhat docgen" }, "keywords": [], @@ -31,16 +31,16 @@ "@synthetixio/docgen": "workspace:*", "@synthetixio/main": "workspace:*", "@synthetixio/oracle-manager": "workspace:*", - "@synthetixio/router": "^3.1.3", + "@synthetixio/router": "^3.3.0", "@synthetixio/wei": "2.74.4", "@types/node-fetch": "2.6.4", - "@usecannon/cli": "^2.5.1", + "@usecannon/cli": "^2.7.1", "ethers": "^5.7.2", - "hardhat": "2.15.0", + "hardhat": "2.17.2", "node-fetch": "2.6.9", "solidity-docgen": "0.6.0-beta.35", "ts-node": "10.9.1", - "typescript": "4.9.3" + "typescript": "^4.9.3" }, - "gitHead": "af79d976af56150c628a885cc94a94f5bcc2c862" + "gitHead": "ba5a9730df248cd1999b5a6fd1bf67b307b95eec" } diff --git a/markets/spot-market/subgraph/base-goerli-competition/generated/SpotMarketProxy/SpotMarketProxy.ts b/markets/spot-market/subgraph/base-goerli-competition/generated/SpotMarketProxy/SpotMarketProxy.ts new file mode 100644 index 0000000000..f68dd163dd --- /dev/null +++ b/markets/spot-market/subgraph/base-goerli-competition/generated/SpotMarketProxy/SpotMarketProxy.ts @@ -0,0 +1,5173 @@ +// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. + +import { + ethereum, + JSONValue, + TypedMap, + Entity, + Bytes, + Address, + BigInt, +} from '@graphprotocol/graph-ts'; + +export class OwnerChanged extends ethereum.Event { + get params(): OwnerChanged__Params { + return new OwnerChanged__Params(this); + } +} + +export class OwnerChanged__Params { + _event: OwnerChanged; + + constructor(event: OwnerChanged) { + this._event = event; + } + + get oldOwner(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get newOwner(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class OwnerNominated extends ethereum.Event { + get params(): OwnerNominated__Params { + return new OwnerNominated__Params(this); + } +} + +export class OwnerNominated__Params { + _event: OwnerNominated; + + constructor(event: OwnerNominated) { + this._event = event; + } + + get newOwner(): Address { + return this._event.parameters[0].value.toAddress(); + } +} + +export class Upgraded extends ethereum.Event { + get params(): Upgraded__Params { + return new Upgraded__Params(this); + } +} + +export class Upgraded__Params { + _event: Upgraded; + + constructor(event: Upgraded) { + this._event = event; + } + + get self(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get implementation(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class AssociatedSystemSet extends ethereum.Event { + get params(): AssociatedSystemSet__Params { + return new AssociatedSystemSet__Params(this); + } +} + +export class AssociatedSystemSet__Params { + _event: AssociatedSystemSet; + + constructor(event: AssociatedSystemSet) { + this._event = event; + } + + get kind(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get id(): Bytes { + return this._event.parameters[1].value.toBytes(); + } + + get proxy(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get impl(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class DecayRateUpdated extends ethereum.Event { + get params(): DecayRateUpdated__Params { + return new DecayRateUpdated__Params(this); + } +} + +export class DecayRateUpdated__Params { + _event: DecayRateUpdated; + + constructor(event: DecayRateUpdated) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get rate(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class MarketNominationRenounced extends ethereum.Event { + get params(): MarketNominationRenounced__Params { + return new MarketNominationRenounced__Params(this); + } +} + +export class MarketNominationRenounced__Params { + _event: MarketNominationRenounced; + + constructor(event: MarketNominationRenounced) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get nominee(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class MarketOwnerChanged extends ethereum.Event { + get params(): MarketOwnerChanged__Params { + return new MarketOwnerChanged__Params(this); + } +} + +export class MarketOwnerChanged__Params { + _event: MarketOwnerChanged; + + constructor(event: MarketOwnerChanged) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get oldOwner(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get newOwner(): Address { + return this._event.parameters[2].value.toAddress(); + } +} + +export class MarketOwnerNominated extends ethereum.Event { + get params(): MarketOwnerNominated__Params { + return new MarketOwnerNominated__Params(this); + } +} + +export class MarketOwnerNominated__Params { + _event: MarketOwnerNominated; + + constructor(event: MarketOwnerNominated) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get newOwner(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class SynthImplementationSet extends ethereum.Event { + get params(): SynthImplementationSet__Params { + return new SynthImplementationSet__Params(this); + } +} + +export class SynthImplementationSet__Params { + _event: SynthImplementationSet; + + constructor(event: SynthImplementationSet) { + this._event = event; + } + + get synthImplementation(): Address { + return this._event.parameters[0].value.toAddress(); + } +} + +export class SynthImplementationUpgraded extends ethereum.Event { + get params(): SynthImplementationUpgraded__Params { + return new SynthImplementationUpgraded__Params(this); + } +} + +export class SynthImplementationUpgraded__Params { + _event: SynthImplementationUpgraded; + + constructor(event: SynthImplementationUpgraded) { + this._event = event; + } + + get synthMarketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get proxy(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get implementation(): Address { + return this._event.parameters[2].value.toAddress(); + } +} + +export class SynthPriceDataUpdated extends ethereum.Event { + get params(): SynthPriceDataUpdated__Params { + return new SynthPriceDataUpdated__Params(this); + } +} + +export class SynthPriceDataUpdated__Params { + _event: SynthPriceDataUpdated; + + constructor(event: SynthPriceDataUpdated) { + this._event = event; + } + + get synthMarketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get buyFeedId(): Bytes { + return this._event.parameters[1].value.toBytes(); + } + + get sellFeedId(): Bytes { + return this._event.parameters[2].value.toBytes(); + } +} + +export class SynthRegistered extends ethereum.Event { + get params(): SynthRegistered__Params { + return new SynthRegistered__Params(this); + } +} + +export class SynthRegistered__Params { + _event: SynthRegistered; + + constructor(event: SynthRegistered) { + this._event = event; + } + + get synthMarketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get synthTokenAddress(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class SynthetixSystemSet extends ethereum.Event { + get params(): SynthetixSystemSet__Params { + return new SynthetixSystemSet__Params(this); + } +} + +export class SynthetixSystemSet__Params { + _event: SynthetixSystemSet; + + constructor(event: SynthetixSystemSet) { + this._event = event; + } + + get synthetix(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get usdTokenAddress(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get oracleManager(): Address { + return this._event.parameters[2].value.toAddress(); + } +} + +export class SynthBought extends ethereum.Event { + get params(): SynthBought__Params { + return new SynthBought__Params(this); + } +} + +export class SynthBought__Params { + _event: SynthBought; + + constructor(event: SynthBought) { + this._event = event; + } + + get synthMarketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get synthReturned(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get fees(): SynthBoughtFeesStruct { + return changetype(this._event.parameters[2].value.toTuple()); + } + + get collectedFees(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get referrer(): Address { + return this._event.parameters[4].value.toAddress(); + } + + get price(): BigInt { + return this._event.parameters[5].value.toBigInt(); + } +} + +export class SynthBoughtFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class SynthSold extends ethereum.Event { + get params(): SynthSold__Params { + return new SynthSold__Params(this); + } +} + +export class SynthSold__Params { + _event: SynthSold; + + constructor(event: SynthSold) { + this._event = event; + } + + get synthMarketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get amountReturned(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get fees(): SynthSoldFeesStruct { + return changetype(this._event.parameters[2].value.toTuple()); + } + + get collectedFees(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get referrer(): Address { + return this._event.parameters[4].value.toAddress(); + } + + get price(): BigInt { + return this._event.parameters[5].value.toBigInt(); + } +} + +export class SynthSoldFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class OrderCancelled extends ethereum.Event { + get params(): OrderCancelled__Params { + return new OrderCancelled__Params(this); + } +} + +export class OrderCancelled__Params { + _event: OrderCancelled; + + constructor(event: OrderCancelled) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get asyncOrderId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get asyncOrderClaim(): OrderCancelledAsyncOrderClaimStruct { + return changetype( + this._event.parameters[2].value.toTuple() + ); + } + + get sender(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class OrderCancelledAsyncOrderClaimStruct extends ethereum.Tuple { + get id(): BigInt { + return this[0].toBigInt(); + } + + get owner(): Address { + return this[1].toAddress(); + } + + get orderType(): i32 { + return this[2].toI32(); + } + + get amountEscrowed(): BigInt { + return this[3].toBigInt(); + } + + get settlementStrategyId(): BigInt { + return this[4].toBigInt(); + } + + get settlementTime(): BigInt { + return this[5].toBigInt(); + } + + get minimumSettlementAmount(): BigInt { + return this[6].toBigInt(); + } + + get settledAt(): BigInt { + return this[7].toBigInt(); + } + + get referrer(): Address { + return this[8].toAddress(); + } +} + +export class OrderCommitted extends ethereum.Event { + get params(): OrderCommitted__Params { + return new OrderCommitted__Params(this); + } +} + +export class OrderCommitted__Params { + _event: OrderCommitted; + + constructor(event: OrderCommitted) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get orderType(): i32 { + return this._event.parameters[1].value.toI32(); + } + + get amountProvided(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get asyncOrderId(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[4].value.toAddress(); + } + + get referrer(): Address { + return this._event.parameters[5].value.toAddress(); + } +} + +export class OrderSettled extends ethereum.Event { + get params(): OrderSettled__Params { + return new OrderSettled__Params(this); + } +} + +export class OrderSettled__Params { + _event: OrderSettled; + + constructor(event: OrderSettled) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get asyncOrderId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get finalOrderAmount(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get fees(): OrderSettledFeesStruct { + return changetype(this._event.parameters[3].value.toTuple()); + } + + get collectedFees(): BigInt { + return this._event.parameters[4].value.toBigInt(); + } + + get settler(): Address { + return this._event.parameters[5].value.toAddress(); + } + + get price(): BigInt { + return this._event.parameters[6].value.toBigInt(); + } + + get orderType(): i32 { + return this._event.parameters[7].value.toI32(); + } +} + +export class OrderSettledFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class SettlementStrategyAdded extends ethereum.Event { + get params(): SettlementStrategyAdded__Params { + return new SettlementStrategyAdded__Params(this); + } +} + +export class SettlementStrategyAdded__Params { + _event: SettlementStrategyAdded; + + constructor(event: SettlementStrategyAdded) { + this._event = event; + } + + get synthMarketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get strategyId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class SettlementStrategyUpdated extends ethereum.Event { + get params(): SettlementStrategyUpdated__Params { + return new SettlementStrategyUpdated__Params(this); + } +} + +export class SettlementStrategyUpdated__Params { + _event: SettlementStrategyUpdated; + + constructor(event: SettlementStrategyUpdated) { + this._event = event; + } + + get synthMarketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get strategyId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get enabled(): boolean { + return this._event.parameters[2].value.toBoolean(); + } +} + +export class SynthUnwrapped extends ethereum.Event { + get params(): SynthUnwrapped__Params { + return new SynthUnwrapped__Params(this); + } +} + +export class SynthUnwrapped__Params { + _event: SynthUnwrapped; + + constructor(event: SynthUnwrapped) { + this._event = event; + } + + get synthMarketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get amountUnwrapped(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get fees(): SynthUnwrappedFeesStruct { + return changetype(this._event.parameters[2].value.toTuple()); + } + + get feesCollected(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } +} + +export class SynthUnwrappedFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class SynthWrapped extends ethereum.Event { + get params(): SynthWrapped__Params { + return new SynthWrapped__Params(this); + } +} + +export class SynthWrapped__Params { + _event: SynthWrapped; + + constructor(event: SynthWrapped) { + this._event = event; + } + + get synthMarketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get amountWrapped(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get fees(): SynthWrappedFeesStruct { + return changetype(this._event.parameters[2].value.toTuple()); + } + + get feesCollected(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } +} + +export class SynthWrappedFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class WrapperSet extends ethereum.Event { + get params(): WrapperSet__Params { + return new WrapperSet__Params(this); + } +} + +export class WrapperSet__Params { + _event: WrapperSet; + + constructor(event: WrapperSet) { + this._event = event; + } + + get synthMarketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get wrapCollateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get maxWrappableAmount(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +export class AsyncFixedFeeSet extends ethereum.Event { + get params(): AsyncFixedFeeSet__Params { + return new AsyncFixedFeeSet__Params(this); + } +} + +export class AsyncFixedFeeSet__Params { + _event: AsyncFixedFeeSet; + + constructor(event: AsyncFixedFeeSet) { + this._event = event; + } + + get synthMarketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get asyncFixedFee(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class AtomicFixedFeeSet extends ethereum.Event { + get params(): AtomicFixedFeeSet__Params { + return new AtomicFixedFeeSet__Params(this); + } +} + +export class AtomicFixedFeeSet__Params { + _event: AtomicFixedFeeSet; + + constructor(event: AtomicFixedFeeSet) { + this._event = event; + } + + get synthMarketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get atomicFixedFee(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class CollateralLeverageSet extends ethereum.Event { + get params(): CollateralLeverageSet__Params { + return new CollateralLeverageSet__Params(this); + } +} + +export class CollateralLeverageSet__Params { + _event: CollateralLeverageSet; + + constructor(event: CollateralLeverageSet) { + this._event = event; + } + + get synthMarketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralLeverage(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class FeeCollectorSet extends ethereum.Event { + get params(): FeeCollectorSet__Params { + return new FeeCollectorSet__Params(this); + } +} + +export class FeeCollectorSet__Params { + _event: FeeCollectorSet; + + constructor(event: FeeCollectorSet) { + this._event = event; + } + + get synthMarketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get feeCollector(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class MarketSkewScaleSet extends ethereum.Event { + get params(): MarketSkewScaleSet__Params { + return new MarketSkewScaleSet__Params(this); + } +} + +export class MarketSkewScaleSet__Params { + _event: MarketSkewScaleSet; + + constructor(event: MarketSkewScaleSet) { + this._event = event; + } + + get synthMarketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get skewScale(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class MarketUtilizationFeesSet extends ethereum.Event { + get params(): MarketUtilizationFeesSet__Params { + return new MarketUtilizationFeesSet__Params(this); + } +} + +export class MarketUtilizationFeesSet__Params { + _event: MarketUtilizationFeesSet; + + constructor(event: MarketUtilizationFeesSet) { + this._event = event; + } + + get synthMarketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get utilizationFeeRate(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class ReferrerShareUpdated extends ethereum.Event { + get params(): ReferrerShareUpdated__Params { + return new ReferrerShareUpdated__Params(this); + } +} + +export class ReferrerShareUpdated__Params { + _event: ReferrerShareUpdated; + + constructor(event: ReferrerShareUpdated) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get referrer(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get sharePercentage(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +export class TransactorFixedFeeSet extends ethereum.Event { + get params(): TransactorFixedFeeSet__Params { + return new TransactorFixedFeeSet__Params(this); + } +} + +export class TransactorFixedFeeSet__Params { + _event: TransactorFixedFeeSet; + + constructor(event: TransactorFixedFeeSet) { + this._event = event; + } + + get synthMarketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get transactor(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get fixedFeeAmount(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +export class WrapperFeesSet extends ethereum.Event { + get params(): WrapperFeesSet__Params { + return new WrapperFeesSet__Params(this); + } +} + +export class WrapperFeesSet__Params { + _event: WrapperFeesSet; + + constructor(event: WrapperFeesSet) { + this._event = event; + } + + get synthMarketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get wrapFee(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get unwrapFee(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } +} + +export class FeatureFlagAllowAllSet extends ethereum.Event { + get params(): FeatureFlagAllowAllSet__Params { + return new FeatureFlagAllowAllSet__Params(this); + } +} + +export class FeatureFlagAllowAllSet__Params { + _event: FeatureFlagAllowAllSet; + + constructor(event: FeatureFlagAllowAllSet) { + this._event = event; + } + + get feature(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get allowAll(): boolean { + return this._event.parameters[1].value.toBoolean(); + } +} + +export class FeatureFlagAllowlistAdded extends ethereum.Event { + get params(): FeatureFlagAllowlistAdded__Params { + return new FeatureFlagAllowlistAdded__Params(this); + } +} + +export class FeatureFlagAllowlistAdded__Params { + _event: FeatureFlagAllowlistAdded; + + constructor(event: FeatureFlagAllowlistAdded) { + this._event = event; + } + + get feature(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get account(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class FeatureFlagAllowlistRemoved extends ethereum.Event { + get params(): FeatureFlagAllowlistRemoved__Params { + return new FeatureFlagAllowlistRemoved__Params(this); + } +} + +export class FeatureFlagAllowlistRemoved__Params { + _event: FeatureFlagAllowlistRemoved; + + constructor(event: FeatureFlagAllowlistRemoved) { + this._event = event; + } + + get feature(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get account(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class FeatureFlagDeniersReset extends ethereum.Event { + get params(): FeatureFlagDeniersReset__Params { + return new FeatureFlagDeniersReset__Params(this); + } +} + +export class FeatureFlagDeniersReset__Params { + _event: FeatureFlagDeniersReset; + + constructor(event: FeatureFlagDeniersReset) { + this._event = event; + } + + get feature(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get deniers(): Array
{ + return this._event.parameters[1].value.toAddressArray(); + } +} + +export class FeatureFlagDenyAllSet extends ethereum.Event { + get params(): FeatureFlagDenyAllSet__Params { + return new FeatureFlagDenyAllSet__Params(this); + } +} + +export class FeatureFlagDenyAllSet__Params { + _event: FeatureFlagDenyAllSet; + + constructor(event: FeatureFlagDenyAllSet) { + this._event = event; + } + + get feature(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get denyAll(): boolean { + return this._event.parameters[1].value.toBoolean(); + } +} + +export class SpotMarketProxy__getAssociatedSystemResult { + value0: Address; + value1: Bytes; + + constructor(value0: Address, value1: Bytes) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromAddress(this.value0)); + map.set('value1', ethereum.Value.fromFixedBytes(this.value1)); + return map; + } + + getAddr(): Address { + return this.value0; + } + + getKind(): Bytes { + return this.value1; + } +} + +export class SpotMarketProxy__buyResultFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class SpotMarketProxy__buyResult { + value0: BigInt; + value1: SpotMarketProxy__buyResultFeesStruct; + + constructor(value0: BigInt, value1: SpotMarketProxy__buyResultFeesStruct) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromTuple(this.value1)); + return map; + } + + getSynthAmount(): BigInt { + return this.value0; + } + + getFees(): SpotMarketProxy__buyResultFeesStruct { + return this.value1; + } +} + +export class SpotMarketProxy__buyExactInResultFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class SpotMarketProxy__buyExactInResult { + value0: BigInt; + value1: SpotMarketProxy__buyExactInResultFeesStruct; + + constructor(value0: BigInt, value1: SpotMarketProxy__buyExactInResultFeesStruct) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromTuple(this.value1)); + return map; + } + + getSynthAmount(): BigInt { + return this.value0; + } + + getFees(): SpotMarketProxy__buyExactInResultFeesStruct { + return this.value1; + } +} + +export class SpotMarketProxy__buyExactOutResultFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class SpotMarketProxy__buyExactOutResult { + value0: BigInt; + value1: SpotMarketProxy__buyExactOutResultFeesStruct; + + constructor(value0: BigInt, value1: SpotMarketProxy__buyExactOutResultFeesStruct) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromTuple(this.value1)); + return map; + } + + getUsdAmountCharged(): BigInt { + return this.value0; + } + + getFees(): SpotMarketProxy__buyExactOutResultFeesStruct { + return this.value1; + } +} + +export class SpotMarketProxy__quoteBuyExactInResultFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class SpotMarketProxy__quoteBuyExactInResult { + value0: BigInt; + value1: SpotMarketProxy__quoteBuyExactInResultFeesStruct; + + constructor(value0: BigInt, value1: SpotMarketProxy__quoteBuyExactInResultFeesStruct) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromTuple(this.value1)); + return map; + } + + getSynthAmount(): BigInt { + return this.value0; + } + + getFees(): SpotMarketProxy__quoteBuyExactInResultFeesStruct { + return this.value1; + } +} + +export class SpotMarketProxy__quoteBuyExactOutResultFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class SpotMarketProxy__quoteBuyExactOutResult { + value0: BigInt; + value1: SpotMarketProxy__quoteBuyExactOutResultFeesStruct; + + constructor(value0: BigInt, value1: SpotMarketProxy__quoteBuyExactOutResultFeesStruct) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromTuple(this.value1)); + return map; + } + + getUsdAmountCharged(): BigInt { + return this.value0; + } + + getFees(): SpotMarketProxy__quoteBuyExactOutResultFeesStruct { + return this.value1; + } +} + +export class SpotMarketProxy__quoteSellExactInResultFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class SpotMarketProxy__quoteSellExactInResult { + value0: BigInt; + value1: SpotMarketProxy__quoteSellExactInResultFeesStruct; + + constructor(value0: BigInt, value1: SpotMarketProxy__quoteSellExactInResultFeesStruct) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromTuple(this.value1)); + return map; + } + + getReturnAmount(): BigInt { + return this.value0; + } + + getFees(): SpotMarketProxy__quoteSellExactInResultFeesStruct { + return this.value1; + } +} + +export class SpotMarketProxy__quoteSellExactOutResultFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class SpotMarketProxy__quoteSellExactOutResult { + value0: BigInt; + value1: SpotMarketProxy__quoteSellExactOutResultFeesStruct; + + constructor(value0: BigInt, value1: SpotMarketProxy__quoteSellExactOutResultFeesStruct) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromTuple(this.value1)); + return map; + } + + getSynthToBurn(): BigInt { + return this.value0; + } + + getFees(): SpotMarketProxy__quoteSellExactOutResultFeesStruct { + return this.value1; + } +} + +export class SpotMarketProxy__sellResultFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class SpotMarketProxy__sellResult { + value0: BigInt; + value1: SpotMarketProxy__sellResultFeesStruct; + + constructor(value0: BigInt, value1: SpotMarketProxy__sellResultFeesStruct) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromTuple(this.value1)); + return map; + } + + getUsdAmountReceived(): BigInt { + return this.value0; + } + + getFees(): SpotMarketProxy__sellResultFeesStruct { + return this.value1; + } +} + +export class SpotMarketProxy__sellExactInResultFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class SpotMarketProxy__sellExactInResult { + value0: BigInt; + value1: SpotMarketProxy__sellExactInResultFeesStruct; + + constructor(value0: BigInt, value1: SpotMarketProxy__sellExactInResultFeesStruct) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromTuple(this.value1)); + return map; + } + + getReturnAmount(): BigInt { + return this.value0; + } + + getFees(): SpotMarketProxy__sellExactInResultFeesStruct { + return this.value1; + } +} + +export class SpotMarketProxy__sellExactOutResultFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class SpotMarketProxy__sellExactOutResult { + value0: BigInt; + value1: SpotMarketProxy__sellExactOutResultFeesStruct; + + constructor(value0: BigInt, value1: SpotMarketProxy__sellExactOutResultFeesStruct) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromTuple(this.value1)); + return map; + } + + getSynthToBurn(): BigInt { + return this.value0; + } + + getFees(): SpotMarketProxy__sellExactOutResultFeesStruct { + return this.value1; + } +} + +export class SpotMarketProxy__commitOrderResultAsyncOrderClaimStruct extends ethereum.Tuple { + get id(): BigInt { + return this[0].toBigInt(); + } + + get owner(): Address { + return this[1].toAddress(); + } + + get orderType(): i32 { + return this[2].toI32(); + } + + get amountEscrowed(): BigInt { + return this[3].toBigInt(); + } + + get settlementStrategyId(): BigInt { + return this[4].toBigInt(); + } + + get settlementTime(): BigInt { + return this[5].toBigInt(); + } + + get minimumSettlementAmount(): BigInt { + return this[6].toBigInt(); + } + + get settledAt(): BigInt { + return this[7].toBigInt(); + } + + get referrer(): Address { + return this[8].toAddress(); + } +} + +export class SpotMarketProxy__getAsyncOrderClaimResultAsyncOrderClaimStruct extends ethereum.Tuple { + get id(): BigInt { + return this[0].toBigInt(); + } + + get owner(): Address { + return this[1].toAddress(); + } + + get orderType(): i32 { + return this[2].toI32(); + } + + get amountEscrowed(): BigInt { + return this[3].toBigInt(); + } + + get settlementStrategyId(): BigInt { + return this[4].toBigInt(); + } + + get settlementTime(): BigInt { + return this[5].toBigInt(); + } + + get minimumSettlementAmount(): BigInt { + return this[6].toBigInt(); + } + + get settledAt(): BigInt { + return this[7].toBigInt(); + } + + get referrer(): Address { + return this[8].toAddress(); + } +} + +export class SpotMarketProxy__settleOrderResultFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class SpotMarketProxy__settleOrderResult { + value0: BigInt; + value1: SpotMarketProxy__settleOrderResultFeesStruct; + + constructor(value0: BigInt, value1: SpotMarketProxy__settleOrderResultFeesStruct) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromTuple(this.value1)); + return map; + } + + getFinalOrderAmount(): BigInt { + return this.value0; + } + + getFees(): SpotMarketProxy__settleOrderResultFeesStruct { + return this.value1; + } +} + +export class SpotMarketProxy__addSettlementStrategyInputStrategyStruct extends ethereum.Tuple { + get strategyType(): i32 { + return this[0].toI32(); + } + + get settlementDelay(): BigInt { + return this[1].toBigInt(); + } + + get settlementWindowDuration(): BigInt { + return this[2].toBigInt(); + } + + get priceVerificationContract(): Address { + return this[3].toAddress(); + } + + get feedId(): Bytes { + return this[4].toBytes(); + } + + get url(): string { + return this[5].toString(); + } + + get settlementReward(): BigInt { + return this[6].toBigInt(); + } + + get minimumUsdExchangeAmount(): BigInt { + return this[7].toBigInt(); + } + + get maxRoundingLoss(): BigInt { + return this[8].toBigInt(); + } + + get disabled(): boolean { + return this[9].toBoolean(); + } +} + +export class SpotMarketProxy__getSettlementStrategyResultSettlementStrategyStruct extends ethereum.Tuple { + get strategyType(): i32 { + return this[0].toI32(); + } + + get settlementDelay(): BigInt { + return this[1].toBigInt(); + } + + get settlementWindowDuration(): BigInt { + return this[2].toBigInt(); + } + + get priceVerificationContract(): Address { + return this[3].toAddress(); + } + + get feedId(): Bytes { + return this[4].toBytes(); + } + + get url(): string { + return this[5].toString(); + } + + get settlementReward(): BigInt { + return this[6].toBigInt(); + } + + get minimumUsdExchangeAmount(): BigInt { + return this[7].toBigInt(); + } + + get maxRoundingLoss(): BigInt { + return this[8].toBigInt(); + } + + get disabled(): boolean { + return this[9].toBoolean(); + } +} + +export class SpotMarketProxy__unwrapResultFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class SpotMarketProxy__unwrapResult { + value0: BigInt; + value1: SpotMarketProxy__unwrapResultFeesStruct; + + constructor(value0: BigInt, value1: SpotMarketProxy__unwrapResultFeesStruct) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromTuple(this.value1)); + return map; + } + + getReturnCollateralAmount(): BigInt { + return this.value0; + } + + getFees(): SpotMarketProxy__unwrapResultFeesStruct { + return this.value1; + } +} + +export class SpotMarketProxy__wrapResultFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class SpotMarketProxy__wrapResult { + value0: BigInt; + value1: SpotMarketProxy__wrapResultFeesStruct; + + constructor(value0: BigInt, value1: SpotMarketProxy__wrapResultFeesStruct) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromTuple(this.value1)); + return map; + } + + getAmountToMint(): BigInt { + return this.value0; + } + + getFees(): SpotMarketProxy__wrapResultFeesStruct { + return this.value1; + } +} + +export class SpotMarketProxy__getMarketFeesResult { + value0: BigInt; + value1: BigInt; + value2: BigInt; + value3: BigInt; + + constructor(value0: BigInt, value1: BigInt, value2: BigInt, value3: BigInt) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + this.value3 = value3; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + map.set('value2', ethereum.Value.fromSignedBigInt(this.value2)); + map.set('value3', ethereum.Value.fromSignedBigInt(this.value3)); + return map; + } + + getAtomicFixedFee(): BigInt { + return this.value0; + } + + getAsyncFixedFee(): BigInt { + return this.value1; + } + + getWrapFee(): BigInt { + return this.value2; + } + + getUnwrapFee(): BigInt { + return this.value3; + } +} + +export class SpotMarketProxy extends ethereum.SmartContract { + static bind(address: Address): SpotMarketProxy { + return new SpotMarketProxy('SpotMarketProxy', address); + } + + getImplementation(): Address { + let result = super.call('getImplementation', 'getImplementation():(address)', []); + + return result[0].toAddress(); + } + + try_getImplementation(): ethereum.CallResult
{ + let result = super.tryCall('getImplementation', 'getImplementation():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + nominatedOwner(): Address { + let result = super.call('nominatedOwner', 'nominatedOwner():(address)', []); + + return result[0].toAddress(); + } + + try_nominatedOwner(): ethereum.CallResult
{ + let result = super.tryCall('nominatedOwner', 'nominatedOwner():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + owner(): Address { + let result = super.call('owner', 'owner():(address)', []); + + return result[0].toAddress(); + } + + try_owner(): ethereum.CallResult
{ + let result = super.tryCall('owner', 'owner():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + createSynth(tokenName: string, tokenSymbol: string, synthOwner: Address): BigInt { + let result = super.call('createSynth', 'createSynth(string,string,address):(uint128)', [ + ethereum.Value.fromString(tokenName), + ethereum.Value.fromString(tokenSymbol), + ethereum.Value.fromAddress(synthOwner), + ]); + + return result[0].toBigInt(); + } + + try_createSynth( + tokenName: string, + tokenSymbol: string, + synthOwner: Address + ): ethereum.CallResult { + let result = super.tryCall('createSynth', 'createSynth(string,string,address):(uint128)', [ + ethereum.Value.fromString(tokenName), + ethereum.Value.fromString(tokenSymbol), + ethereum.Value.fromAddress(synthOwner), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getAssociatedSystem(id: Bytes): SpotMarketProxy__getAssociatedSystemResult { + let result = super.call( + 'getAssociatedSystem', + 'getAssociatedSystem(bytes32):(address,bytes32)', + [ethereum.Value.fromFixedBytes(id)] + ); + + return new SpotMarketProxy__getAssociatedSystemResult( + result[0].toAddress(), + result[1].toBytes() + ); + } + + try_getAssociatedSystem( + id: Bytes + ): ethereum.CallResult { + let result = super.tryCall( + 'getAssociatedSystem', + 'getAssociatedSystem(bytes32):(address,bytes32)', + [ethereum.Value.fromFixedBytes(id)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new SpotMarketProxy__getAssociatedSystemResult(value[0].toAddress(), value[1].toBytes()) + ); + } + + getMarketOwner(synthMarketId: BigInt): Address { + let result = super.call('getMarketOwner', 'getMarketOwner(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(synthMarketId), + ]); + + return result[0].toAddress(); + } + + try_getMarketOwner(synthMarketId: BigInt): ethereum.CallResult
{ + let result = super.tryCall('getMarketOwner', 'getMarketOwner(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(synthMarketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + getSynth(marketId: BigInt): Address { + let result = super.call('getSynth', 'getSynth(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toAddress(); + } + + try_getSynth(marketId: BigInt): ethereum.CallResult
{ + let result = super.tryCall('getSynth', 'getSynth(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + getSynthImpl(marketId: BigInt): Address { + let result = super.call('getSynthImpl', 'getSynthImpl(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toAddress(); + } + + try_getSynthImpl(marketId: BigInt): ethereum.CallResult
{ + let result = super.tryCall('getSynthImpl', 'getSynthImpl(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + minimumCredit(marketId: BigInt): BigInt { + let result = super.call('minimumCredit', 'minimumCredit(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBigInt(); + } + + try_minimumCredit(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('minimumCredit', 'minimumCredit(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + name(marketId: BigInt): string { + let result = super.call('name', 'name(uint128):(string)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toString(); + } + + try_name(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('name', 'name(uint128):(string)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toString()); + } + + reportedDebt(marketId: BigInt): BigInt { + let result = super.call('reportedDebt', 'reportedDebt(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBigInt(); + } + + try_reportedDebt(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('reportedDebt', 'reportedDebt(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + supportsInterface(interfaceId: Bytes): boolean { + let result = super.call('supportsInterface', 'supportsInterface(bytes4):(bool)', [ + ethereum.Value.fromFixedBytes(interfaceId), + ]); + + return result[0].toBoolean(); + } + + try_supportsInterface(interfaceId: Bytes): ethereum.CallResult { + let result = super.tryCall('supportsInterface', 'supportsInterface(bytes4):(bool)', [ + ethereum.Value.fromFixedBytes(interfaceId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + buy( + marketId: BigInt, + usdAmount: BigInt, + minAmountReceived: BigInt, + referrer: Address + ): SpotMarketProxy__buyResult { + let result = super.call( + 'buy', + 'buy(uint128,uint256,uint256,address):(uint256,(uint256,uint256,int256,int256))', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromUnsignedBigInt(usdAmount), + ethereum.Value.fromUnsignedBigInt(minAmountReceived), + ethereum.Value.fromAddress(referrer), + ] + ); + + return new SpotMarketProxy__buyResult( + result[0].toBigInt(), + changetype(result[1].toTuple()) + ); + } + + try_buy( + marketId: BigInt, + usdAmount: BigInt, + minAmountReceived: BigInt, + referrer: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'buy', + 'buy(uint128,uint256,uint256,address):(uint256,(uint256,uint256,int256,int256))', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromUnsignedBigInt(usdAmount), + ethereum.Value.fromUnsignedBigInt(minAmountReceived), + ethereum.Value.fromAddress(referrer), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new SpotMarketProxy__buyResult( + value[0].toBigInt(), + changetype(value[1].toTuple()) + ) + ); + } + + buyExactIn( + marketId: BigInt, + usdAmount: BigInt, + minAmountReceived: BigInt, + referrer: Address + ): SpotMarketProxy__buyExactInResult { + let result = super.call( + 'buyExactIn', + 'buyExactIn(uint128,uint256,uint256,address):(uint256,(uint256,uint256,int256,int256))', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromUnsignedBigInt(usdAmount), + ethereum.Value.fromUnsignedBigInt(minAmountReceived), + ethereum.Value.fromAddress(referrer), + ] + ); + + return new SpotMarketProxy__buyExactInResult( + result[0].toBigInt(), + changetype(result[1].toTuple()) + ); + } + + try_buyExactIn( + marketId: BigInt, + usdAmount: BigInt, + minAmountReceived: BigInt, + referrer: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'buyExactIn', + 'buyExactIn(uint128,uint256,uint256,address):(uint256,(uint256,uint256,int256,int256))', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromUnsignedBigInt(usdAmount), + ethereum.Value.fromUnsignedBigInt(minAmountReceived), + ethereum.Value.fromAddress(referrer), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new SpotMarketProxy__buyExactInResult( + value[0].toBigInt(), + changetype(value[1].toTuple()) + ) + ); + } + + buyExactOut( + marketId: BigInt, + synthAmount: BigInt, + maxUsdAmount: BigInt, + referrer: Address + ): SpotMarketProxy__buyExactOutResult { + let result = super.call( + 'buyExactOut', + 'buyExactOut(uint128,uint256,uint256,address):(uint256,(uint256,uint256,int256,int256))', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromUnsignedBigInt(synthAmount), + ethereum.Value.fromUnsignedBigInt(maxUsdAmount), + ethereum.Value.fromAddress(referrer), + ] + ); + + return new SpotMarketProxy__buyExactOutResult( + result[0].toBigInt(), + changetype(result[1].toTuple()) + ); + } + + try_buyExactOut( + marketId: BigInt, + synthAmount: BigInt, + maxUsdAmount: BigInt, + referrer: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'buyExactOut', + 'buyExactOut(uint128,uint256,uint256,address):(uint256,(uint256,uint256,int256,int256))', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromUnsignedBigInt(synthAmount), + ethereum.Value.fromUnsignedBigInt(maxUsdAmount), + ethereum.Value.fromAddress(referrer), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new SpotMarketProxy__buyExactOutResult( + value[0].toBigInt(), + changetype(value[1].toTuple()) + ) + ); + } + + quoteBuyExactIn(marketId: BigInt, usdAmount: BigInt): SpotMarketProxy__quoteBuyExactInResult { + let result = super.call( + 'quoteBuyExactIn', + 'quoteBuyExactIn(uint128,uint256):(uint256,(uint256,uint256,int256,int256))', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(usdAmount)] + ); + + return new SpotMarketProxy__quoteBuyExactInResult( + result[0].toBigInt(), + changetype(result[1].toTuple()) + ); + } + + try_quoteBuyExactIn( + marketId: BigInt, + usdAmount: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'quoteBuyExactIn', + 'quoteBuyExactIn(uint128,uint256):(uint256,(uint256,uint256,int256,int256))', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(usdAmount)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new SpotMarketProxy__quoteBuyExactInResult( + value[0].toBigInt(), + changetype(value[1].toTuple()) + ) + ); + } + + quoteBuyExactOut(marketId: BigInt, synthAmount: BigInt): SpotMarketProxy__quoteBuyExactOutResult { + let result = super.call( + 'quoteBuyExactOut', + 'quoteBuyExactOut(uint128,uint256):(uint256,(uint256,uint256,int256,int256))', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(synthAmount)] + ); + + return new SpotMarketProxy__quoteBuyExactOutResult( + result[0].toBigInt(), + changetype(result[1].toTuple()) + ); + } + + try_quoteBuyExactOut( + marketId: BigInt, + synthAmount: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'quoteBuyExactOut', + 'quoteBuyExactOut(uint128,uint256):(uint256,(uint256,uint256,int256,int256))', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(synthAmount)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new SpotMarketProxy__quoteBuyExactOutResult( + value[0].toBigInt(), + changetype(value[1].toTuple()) + ) + ); + } + + quoteSellExactIn(marketId: BigInt, synthAmount: BigInt): SpotMarketProxy__quoteSellExactInResult { + let result = super.call( + 'quoteSellExactIn', + 'quoteSellExactIn(uint128,uint256):(uint256,(uint256,uint256,int256,int256))', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(synthAmount)] + ); + + return new SpotMarketProxy__quoteSellExactInResult( + result[0].toBigInt(), + changetype(result[1].toTuple()) + ); + } + + try_quoteSellExactIn( + marketId: BigInt, + synthAmount: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'quoteSellExactIn', + 'quoteSellExactIn(uint128,uint256):(uint256,(uint256,uint256,int256,int256))', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(synthAmount)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new SpotMarketProxy__quoteSellExactInResult( + value[0].toBigInt(), + changetype(value[1].toTuple()) + ) + ); + } + + quoteSellExactOut(marketId: BigInt, usdAmount: BigInt): SpotMarketProxy__quoteSellExactOutResult { + let result = super.call( + 'quoteSellExactOut', + 'quoteSellExactOut(uint128,uint256):(uint256,(uint256,uint256,int256,int256))', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(usdAmount)] + ); + + return new SpotMarketProxy__quoteSellExactOutResult( + result[0].toBigInt(), + changetype(result[1].toTuple()) + ); + } + + try_quoteSellExactOut( + marketId: BigInt, + usdAmount: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'quoteSellExactOut', + 'quoteSellExactOut(uint128,uint256):(uint256,(uint256,uint256,int256,int256))', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(usdAmount)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new SpotMarketProxy__quoteSellExactOutResult( + value[0].toBigInt(), + changetype(value[1].toTuple()) + ) + ); + } + + sell( + marketId: BigInt, + synthAmount: BigInt, + minUsdAmount: BigInt, + referrer: Address + ): SpotMarketProxy__sellResult { + let result = super.call( + 'sell', + 'sell(uint128,uint256,uint256,address):(uint256,(uint256,uint256,int256,int256))', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromUnsignedBigInt(synthAmount), + ethereum.Value.fromUnsignedBigInt(minUsdAmount), + ethereum.Value.fromAddress(referrer), + ] + ); + + return new SpotMarketProxy__sellResult( + result[0].toBigInt(), + changetype(result[1].toTuple()) + ); + } + + try_sell( + marketId: BigInt, + synthAmount: BigInt, + minUsdAmount: BigInt, + referrer: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'sell', + 'sell(uint128,uint256,uint256,address):(uint256,(uint256,uint256,int256,int256))', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromUnsignedBigInt(synthAmount), + ethereum.Value.fromUnsignedBigInt(minUsdAmount), + ethereum.Value.fromAddress(referrer), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new SpotMarketProxy__sellResult( + value[0].toBigInt(), + changetype(value[1].toTuple()) + ) + ); + } + + sellExactIn( + marketId: BigInt, + synthAmount: BigInt, + minAmountReceived: BigInt, + referrer: Address + ): SpotMarketProxy__sellExactInResult { + let result = super.call( + 'sellExactIn', + 'sellExactIn(uint128,uint256,uint256,address):(uint256,(uint256,uint256,int256,int256))', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromUnsignedBigInt(synthAmount), + ethereum.Value.fromUnsignedBigInt(minAmountReceived), + ethereum.Value.fromAddress(referrer), + ] + ); + + return new SpotMarketProxy__sellExactInResult( + result[0].toBigInt(), + changetype(result[1].toTuple()) + ); + } + + try_sellExactIn( + marketId: BigInt, + synthAmount: BigInt, + minAmountReceived: BigInt, + referrer: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'sellExactIn', + 'sellExactIn(uint128,uint256,uint256,address):(uint256,(uint256,uint256,int256,int256))', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromUnsignedBigInt(synthAmount), + ethereum.Value.fromUnsignedBigInt(minAmountReceived), + ethereum.Value.fromAddress(referrer), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new SpotMarketProxy__sellExactInResult( + value[0].toBigInt(), + changetype(value[1].toTuple()) + ) + ); + } + + sellExactOut( + marketId: BigInt, + usdAmount: BigInt, + maxSynthAmount: BigInt, + referrer: Address + ): SpotMarketProxy__sellExactOutResult { + let result = super.call( + 'sellExactOut', + 'sellExactOut(uint128,uint256,uint256,address):(uint256,(uint256,uint256,int256,int256))', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromUnsignedBigInt(usdAmount), + ethereum.Value.fromUnsignedBigInt(maxSynthAmount), + ethereum.Value.fromAddress(referrer), + ] + ); + + return new SpotMarketProxy__sellExactOutResult( + result[0].toBigInt(), + changetype(result[1].toTuple()) + ); + } + + try_sellExactOut( + marketId: BigInt, + usdAmount: BigInt, + maxSynthAmount: BigInt, + referrer: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'sellExactOut', + 'sellExactOut(uint128,uint256,uint256,address):(uint256,(uint256,uint256,int256,int256))', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromUnsignedBigInt(usdAmount), + ethereum.Value.fromUnsignedBigInt(maxSynthAmount), + ethereum.Value.fromAddress(referrer), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new SpotMarketProxy__sellExactOutResult( + value[0].toBigInt(), + changetype(value[1].toTuple()) + ) + ); + } + + commitOrder( + marketId: BigInt, + orderType: i32, + amountProvided: BigInt, + settlementStrategyId: BigInt, + minimumSettlementAmount: BigInt, + referrer: Address + ): SpotMarketProxy__commitOrderResultAsyncOrderClaimStruct { + let result = super.call( + 'commitOrder', + 'commitOrder(uint128,uint8,uint256,uint256,uint256,address):((uint128,address,uint8,uint256,uint256,uint256,uint256,uint256,address))', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromUnsignedBigInt(BigInt.fromI32(orderType)), + ethereum.Value.fromUnsignedBigInt(amountProvided), + ethereum.Value.fromUnsignedBigInt(settlementStrategyId), + ethereum.Value.fromUnsignedBigInt(minimumSettlementAmount), + ethereum.Value.fromAddress(referrer), + ] + ); + + return changetype(result[0].toTuple()); + } + + try_commitOrder( + marketId: BigInt, + orderType: i32, + amountProvided: BigInt, + settlementStrategyId: BigInt, + minimumSettlementAmount: BigInt, + referrer: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'commitOrder', + 'commitOrder(uint128,uint8,uint256,uint256,uint256,address):((uint128,address,uint8,uint256,uint256,uint256,uint256,uint256,address))', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromUnsignedBigInt(BigInt.fromI32(orderType)), + ethereum.Value.fromUnsignedBigInt(amountProvided), + ethereum.Value.fromUnsignedBigInt(settlementStrategyId), + ethereum.Value.fromUnsignedBigInt(minimumSettlementAmount), + ethereum.Value.fromAddress(referrer), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + changetype(value[0].toTuple()) + ); + } + + getAsyncOrderClaim( + marketId: BigInt, + asyncOrderId: BigInt + ): SpotMarketProxy__getAsyncOrderClaimResultAsyncOrderClaimStruct { + let result = super.call( + 'getAsyncOrderClaim', + 'getAsyncOrderClaim(uint128,uint128):((uint128,address,uint8,uint256,uint256,uint256,uint256,uint256,address))', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(asyncOrderId)] + ); + + return changetype( + result[0].toTuple() + ); + } + + try_getAsyncOrderClaim( + marketId: BigInt, + asyncOrderId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'getAsyncOrderClaim', + 'getAsyncOrderClaim(uint128,uint128):((uint128,address,uint8,uint256,uint256,uint256,uint256,uint256,address))', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(asyncOrderId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + changetype(value[0].toTuple()) + ); + } + + PRECISION(): BigInt { + let result = super.call('PRECISION', 'PRECISION():(int256)', []); + + return result[0].toBigInt(); + } + + try_PRECISION(): ethereum.CallResult { + let result = super.tryCall('PRECISION', 'PRECISION():(int256)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + settleOrder(marketId: BigInt, asyncOrderId: BigInt): SpotMarketProxy__settleOrderResult { + let result = super.call( + 'settleOrder', + 'settleOrder(uint128,uint128):(uint256,(uint256,uint256,int256,int256))', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(asyncOrderId)] + ); + + return new SpotMarketProxy__settleOrderResult( + result[0].toBigInt(), + changetype(result[1].toTuple()) + ); + } + + try_settleOrder( + marketId: BigInt, + asyncOrderId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'settleOrder', + 'settleOrder(uint128,uint128):(uint256,(uint256,uint256,int256,int256))', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(asyncOrderId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new SpotMarketProxy__settleOrderResult( + value[0].toBigInt(), + changetype(value[1].toTuple()) + ) + ); + } + + addSettlementStrategy( + marketId: BigInt, + strategy: SpotMarketProxy__addSettlementStrategyInputStrategyStruct + ): BigInt { + let result = super.call( + 'addSettlementStrategy', + 'addSettlementStrategy(uint128,(uint8,uint256,uint256,address,bytes32,string,uint256,uint256,uint256,bool)):(uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromTuple(strategy)] + ); + + return result[0].toBigInt(); + } + + try_addSettlementStrategy( + marketId: BigInt, + strategy: SpotMarketProxy__addSettlementStrategyInputStrategyStruct + ): ethereum.CallResult { + let result = super.tryCall( + 'addSettlementStrategy', + 'addSettlementStrategy(uint128,(uint8,uint256,uint256,address,bytes32,string,uint256,uint256,uint256,bool)):(uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromTuple(strategy)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getSettlementStrategy( + marketId: BigInt, + strategyId: BigInt + ): SpotMarketProxy__getSettlementStrategyResultSettlementStrategyStruct { + let result = super.call( + 'getSettlementStrategy', + 'getSettlementStrategy(uint128,uint256):((uint8,uint256,uint256,address,bytes32,string,uint256,uint256,uint256,bool))', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(strategyId)] + ); + + return changetype( + result[0].toTuple() + ); + } + + try_getSettlementStrategy( + marketId: BigInt, + strategyId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'getSettlementStrategy', + 'getSettlementStrategy(uint128,uint256):((uint8,uint256,uint256,address,bytes32,string,uint256,uint256,uint256,bool))', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(strategyId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + changetype( + value[0].toTuple() + ) + ); + } + + unwrap( + marketId: BigInt, + unwrapAmount: BigInt, + minAmountReceived: BigInt + ): SpotMarketProxy__unwrapResult { + let result = super.call( + 'unwrap', + 'unwrap(uint128,uint256,uint256):(uint256,(uint256,uint256,int256,int256))', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromUnsignedBigInt(unwrapAmount), + ethereum.Value.fromUnsignedBigInt(minAmountReceived), + ] + ); + + return new SpotMarketProxy__unwrapResult( + result[0].toBigInt(), + changetype(result[1].toTuple()) + ); + } + + try_unwrap( + marketId: BigInt, + unwrapAmount: BigInt, + minAmountReceived: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'unwrap', + 'unwrap(uint128,uint256,uint256):(uint256,(uint256,uint256,int256,int256))', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromUnsignedBigInt(unwrapAmount), + ethereum.Value.fromUnsignedBigInt(minAmountReceived), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new SpotMarketProxy__unwrapResult( + value[0].toBigInt(), + changetype(value[1].toTuple()) + ) + ); + } + + wrap( + marketId: BigInt, + wrapAmount: BigInt, + minAmountReceived: BigInt + ): SpotMarketProxy__wrapResult { + let result = super.call( + 'wrap', + 'wrap(uint128,uint256,uint256):(uint256,(uint256,uint256,int256,int256))', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromUnsignedBigInt(wrapAmount), + ethereum.Value.fromUnsignedBigInt(minAmountReceived), + ] + ); + + return new SpotMarketProxy__wrapResult( + result[0].toBigInt(), + changetype(result[1].toTuple()) + ); + } + + try_wrap( + marketId: BigInt, + wrapAmount: BigInt, + minAmountReceived: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'wrap', + 'wrap(uint128,uint256,uint256):(uint256,(uint256,uint256,int256,int256))', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromUnsignedBigInt(wrapAmount), + ethereum.Value.fromUnsignedBigInt(minAmountReceived), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new SpotMarketProxy__wrapResult( + value[0].toBigInt(), + changetype(value[1].toTuple()) + ) + ); + } + + getCollateralLeverage(synthMarketId: BigInt): BigInt { + let result = super.call('getCollateralLeverage', 'getCollateralLeverage(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(synthMarketId), + ]); + + return result[0].toBigInt(); + } + + try_getCollateralLeverage(synthMarketId: BigInt): ethereum.CallResult { + let result = super.tryCall( + 'getCollateralLeverage', + 'getCollateralLeverage(uint128):(uint256)', + [ethereum.Value.fromUnsignedBigInt(synthMarketId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getCustomTransactorFees(synthMarketId: BigInt, transactor: Address): BigInt { + let result = super.call( + 'getCustomTransactorFees', + 'getCustomTransactorFees(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(synthMarketId), ethereum.Value.fromAddress(transactor)] + ); + + return result[0].toBigInt(); + } + + try_getCustomTransactorFees( + synthMarketId: BigInt, + transactor: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getCustomTransactorFees', + 'getCustomTransactorFees(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(synthMarketId), ethereum.Value.fromAddress(transactor)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getFeeCollector(synthMarketId: BigInt): Address { + let result = super.call('getFeeCollector', 'getFeeCollector(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(synthMarketId), + ]); + + return result[0].toAddress(); + } + + try_getFeeCollector(synthMarketId: BigInt): ethereum.CallResult
{ + let result = super.tryCall('getFeeCollector', 'getFeeCollector(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(synthMarketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + getMarketFees(synthMarketId: BigInt): SpotMarketProxy__getMarketFeesResult { + let result = super.call( + 'getMarketFees', + 'getMarketFees(uint128):(uint256,uint256,int256,int256)', + [ethereum.Value.fromUnsignedBigInt(synthMarketId)] + ); + + return new SpotMarketProxy__getMarketFeesResult( + result[0].toBigInt(), + result[1].toBigInt(), + result[2].toBigInt(), + result[3].toBigInt() + ); + } + + try_getMarketFees( + synthMarketId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'getMarketFees', + 'getMarketFees(uint128):(uint256,uint256,int256,int256)', + [ethereum.Value.fromUnsignedBigInt(synthMarketId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new SpotMarketProxy__getMarketFeesResult( + value[0].toBigInt(), + value[1].toBigInt(), + value[2].toBigInt(), + value[3].toBigInt() + ) + ); + } + + getMarketSkewScale(synthMarketId: BigInt): BigInt { + let result = super.call('getMarketSkewScale', 'getMarketSkewScale(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(synthMarketId), + ]); + + return result[0].toBigInt(); + } + + try_getMarketSkewScale(synthMarketId: BigInt): ethereum.CallResult { + let result = super.tryCall('getMarketSkewScale', 'getMarketSkewScale(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(synthMarketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getMarketUtilizationFees(synthMarketId: BigInt): BigInt { + let result = super.call( + 'getMarketUtilizationFees', + 'getMarketUtilizationFees(uint128):(uint256)', + [ethereum.Value.fromUnsignedBigInt(synthMarketId)] + ); + + return result[0].toBigInt(); + } + + try_getMarketUtilizationFees(synthMarketId: BigInt): ethereum.CallResult { + let result = super.tryCall( + 'getMarketUtilizationFees', + 'getMarketUtilizationFees(uint128):(uint256)', + [ethereum.Value.fromUnsignedBigInt(synthMarketId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getReferrerShare(synthMarketId: BigInt, referrer: Address): BigInt { + let result = super.call('getReferrerShare', 'getReferrerShare(uint128,address):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(synthMarketId), + ethereum.Value.fromAddress(referrer), + ]); + + return result[0].toBigInt(); + } + + try_getReferrerShare(synthMarketId: BigInt, referrer: Address): ethereum.CallResult { + let result = super.tryCall('getReferrerShare', 'getReferrerShare(uint128,address):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(synthMarketId), + ethereum.Value.fromAddress(referrer), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getDeniers(feature: Bytes): Array
{ + let result = super.call('getDeniers', 'getDeniers(bytes32):(address[])', [ + ethereum.Value.fromFixedBytes(feature), + ]); + + return result[0].toAddressArray(); + } + + try_getDeniers(feature: Bytes): ethereum.CallResult> { + let result = super.tryCall('getDeniers', 'getDeniers(bytes32):(address[])', [ + ethereum.Value.fromFixedBytes(feature), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddressArray()); + } + + getFeatureFlagAllowAll(feature: Bytes): boolean { + let result = super.call('getFeatureFlagAllowAll', 'getFeatureFlagAllowAll(bytes32):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ]); + + return result[0].toBoolean(); + } + + try_getFeatureFlagAllowAll(feature: Bytes): ethereum.CallResult { + let result = super.tryCall('getFeatureFlagAllowAll', 'getFeatureFlagAllowAll(bytes32):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + getFeatureFlagAllowlist(feature: Bytes): Array
{ + let result = super.call( + 'getFeatureFlagAllowlist', + 'getFeatureFlagAllowlist(bytes32):(address[])', + [ethereum.Value.fromFixedBytes(feature)] + ); + + return result[0].toAddressArray(); + } + + try_getFeatureFlagAllowlist(feature: Bytes): ethereum.CallResult> { + let result = super.tryCall( + 'getFeatureFlagAllowlist', + 'getFeatureFlagAllowlist(bytes32):(address[])', + [ethereum.Value.fromFixedBytes(feature)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddressArray()); + } + + getFeatureFlagDenyAll(feature: Bytes): boolean { + let result = super.call('getFeatureFlagDenyAll', 'getFeatureFlagDenyAll(bytes32):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ]); + + return result[0].toBoolean(); + } + + try_getFeatureFlagDenyAll(feature: Bytes): ethereum.CallResult { + let result = super.tryCall('getFeatureFlagDenyAll', 'getFeatureFlagDenyAll(bytes32):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + isFeatureAllowed(feature: Bytes, account: Address): boolean { + let result = super.call('isFeatureAllowed', 'isFeatureAllowed(bytes32,address):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ethereum.Value.fromAddress(account), + ]); + + return result[0].toBoolean(); + } + + try_isFeatureAllowed(feature: Bytes, account: Address): ethereum.CallResult { + let result = super.tryCall('isFeatureAllowed', 'isFeatureAllowed(bytes32,address):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ethereum.Value.fromAddress(account), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } +} + +export class MulticallCall extends ethereum.Call { + get inputs(): MulticallCall__Inputs { + return new MulticallCall__Inputs(this); + } + + get outputs(): MulticallCall__Outputs { + return new MulticallCall__Outputs(this); + } +} + +export class MulticallCall__Inputs { + _call: MulticallCall; + + constructor(call: MulticallCall) { + this._call = call; + } + + get data(): Array { + return this._call.inputValues[0].value.toBytesArray(); + } +} + +export class MulticallCall__Outputs { + _call: MulticallCall; + + constructor(call: MulticallCall) { + this._call = call; + } + + get results(): Array { + return this._call.outputValues[0].value.toBytesArray(); + } +} + +export class AcceptOwnershipCall extends ethereum.Call { + get inputs(): AcceptOwnershipCall__Inputs { + return new AcceptOwnershipCall__Inputs(this); + } + + get outputs(): AcceptOwnershipCall__Outputs { + return new AcceptOwnershipCall__Outputs(this); + } +} + +export class AcceptOwnershipCall__Inputs { + _call: AcceptOwnershipCall; + + constructor(call: AcceptOwnershipCall) { + this._call = call; + } +} + +export class AcceptOwnershipCall__Outputs { + _call: AcceptOwnershipCall; + + constructor(call: AcceptOwnershipCall) { + this._call = call; + } +} + +export class NominateNewOwnerCall extends ethereum.Call { + get inputs(): NominateNewOwnerCall__Inputs { + return new NominateNewOwnerCall__Inputs(this); + } + + get outputs(): NominateNewOwnerCall__Outputs { + return new NominateNewOwnerCall__Outputs(this); + } +} + +export class NominateNewOwnerCall__Inputs { + _call: NominateNewOwnerCall; + + constructor(call: NominateNewOwnerCall) { + this._call = call; + } + + get newNominatedOwner(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class NominateNewOwnerCall__Outputs { + _call: NominateNewOwnerCall; + + constructor(call: NominateNewOwnerCall) { + this._call = call; + } +} + +export class RenounceNominationCall extends ethereum.Call { + get inputs(): RenounceNominationCall__Inputs { + return new RenounceNominationCall__Inputs(this); + } + + get outputs(): RenounceNominationCall__Outputs { + return new RenounceNominationCall__Outputs(this); + } +} + +export class RenounceNominationCall__Inputs { + _call: RenounceNominationCall; + + constructor(call: RenounceNominationCall) { + this._call = call; + } +} + +export class RenounceNominationCall__Outputs { + _call: RenounceNominationCall; + + constructor(call: RenounceNominationCall) { + this._call = call; + } +} + +export class SimulateUpgradeToCall extends ethereum.Call { + get inputs(): SimulateUpgradeToCall__Inputs { + return new SimulateUpgradeToCall__Inputs(this); + } + + get outputs(): SimulateUpgradeToCall__Outputs { + return new SimulateUpgradeToCall__Outputs(this); + } +} + +export class SimulateUpgradeToCall__Inputs { + _call: SimulateUpgradeToCall; + + constructor(call: SimulateUpgradeToCall) { + this._call = call; + } + + get newImplementation(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class SimulateUpgradeToCall__Outputs { + _call: SimulateUpgradeToCall; + + constructor(call: SimulateUpgradeToCall) { + this._call = call; + } +} + +export class UpgradeToCall extends ethereum.Call { + get inputs(): UpgradeToCall__Inputs { + return new UpgradeToCall__Inputs(this); + } + + get outputs(): UpgradeToCall__Outputs { + return new UpgradeToCall__Outputs(this); + } +} + +export class UpgradeToCall__Inputs { + _call: UpgradeToCall; + + constructor(call: UpgradeToCall) { + this._call = call; + } + + get newImplementation(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class UpgradeToCall__Outputs { + _call: UpgradeToCall; + + constructor(call: UpgradeToCall) { + this._call = call; + } +} + +export class AcceptMarketOwnershipCall extends ethereum.Call { + get inputs(): AcceptMarketOwnershipCall__Inputs { + return new AcceptMarketOwnershipCall__Inputs(this); + } + + get outputs(): AcceptMarketOwnershipCall__Outputs { + return new AcceptMarketOwnershipCall__Outputs(this); + } +} + +export class AcceptMarketOwnershipCall__Inputs { + _call: AcceptMarketOwnershipCall; + + constructor(call: AcceptMarketOwnershipCall) { + this._call = call; + } + + get synthMarketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class AcceptMarketOwnershipCall__Outputs { + _call: AcceptMarketOwnershipCall; + + constructor(call: AcceptMarketOwnershipCall) { + this._call = call; + } +} + +export class CreateSynthCall extends ethereum.Call { + get inputs(): CreateSynthCall__Inputs { + return new CreateSynthCall__Inputs(this); + } + + get outputs(): CreateSynthCall__Outputs { + return new CreateSynthCall__Outputs(this); + } +} + +export class CreateSynthCall__Inputs { + _call: CreateSynthCall; + + constructor(call: CreateSynthCall) { + this._call = call; + } + + get tokenName(): string { + return this._call.inputValues[0].value.toString(); + } + + get tokenSymbol(): string { + return this._call.inputValues[1].value.toString(); + } + + get synthOwner(): Address { + return this._call.inputValues[2].value.toAddress(); + } +} + +export class CreateSynthCall__Outputs { + _call: CreateSynthCall; + + constructor(call: CreateSynthCall) { + this._call = call; + } + + get synthMarketId(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class InitOrUpgradeNftCall extends ethereum.Call { + get inputs(): InitOrUpgradeNftCall__Inputs { + return new InitOrUpgradeNftCall__Inputs(this); + } + + get outputs(): InitOrUpgradeNftCall__Outputs { + return new InitOrUpgradeNftCall__Outputs(this); + } +} + +export class InitOrUpgradeNftCall__Inputs { + _call: InitOrUpgradeNftCall; + + constructor(call: InitOrUpgradeNftCall) { + this._call = call; + } + + get id(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get name(): string { + return this._call.inputValues[1].value.toString(); + } + + get symbol(): string { + return this._call.inputValues[2].value.toString(); + } + + get uri(): string { + return this._call.inputValues[3].value.toString(); + } + + get impl(): Address { + return this._call.inputValues[4].value.toAddress(); + } +} + +export class InitOrUpgradeNftCall__Outputs { + _call: InitOrUpgradeNftCall; + + constructor(call: InitOrUpgradeNftCall) { + this._call = call; + } +} + +export class InitOrUpgradeTokenCall extends ethereum.Call { + get inputs(): InitOrUpgradeTokenCall__Inputs { + return new InitOrUpgradeTokenCall__Inputs(this); + } + + get outputs(): InitOrUpgradeTokenCall__Outputs { + return new InitOrUpgradeTokenCall__Outputs(this); + } +} + +export class InitOrUpgradeTokenCall__Inputs { + _call: InitOrUpgradeTokenCall; + + constructor(call: InitOrUpgradeTokenCall) { + this._call = call; + } + + get id(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get name(): string { + return this._call.inputValues[1].value.toString(); + } + + get symbol(): string { + return this._call.inputValues[2].value.toString(); + } + + get decimals(): i32 { + return this._call.inputValues[3].value.toI32(); + } + + get impl(): Address { + return this._call.inputValues[4].value.toAddress(); + } +} + +export class InitOrUpgradeTokenCall__Outputs { + _call: InitOrUpgradeTokenCall; + + constructor(call: InitOrUpgradeTokenCall) { + this._call = call; + } +} + +export class NominateMarketOwnerCall extends ethereum.Call { + get inputs(): NominateMarketOwnerCall__Inputs { + return new NominateMarketOwnerCall__Inputs(this); + } + + get outputs(): NominateMarketOwnerCall__Outputs { + return new NominateMarketOwnerCall__Outputs(this); + } +} + +export class NominateMarketOwnerCall__Inputs { + _call: NominateMarketOwnerCall; + + constructor(call: NominateMarketOwnerCall) { + this._call = call; + } + + get synthMarketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get newNominatedOwner(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class NominateMarketOwnerCall__Outputs { + _call: NominateMarketOwnerCall; + + constructor(call: NominateMarketOwnerCall) { + this._call = call; + } +} + +export class RegisterUnmanagedSystemCall extends ethereum.Call { + get inputs(): RegisterUnmanagedSystemCall__Inputs { + return new RegisterUnmanagedSystemCall__Inputs(this); + } + + get outputs(): RegisterUnmanagedSystemCall__Outputs { + return new RegisterUnmanagedSystemCall__Outputs(this); + } +} + +export class RegisterUnmanagedSystemCall__Inputs { + _call: RegisterUnmanagedSystemCall; + + constructor(call: RegisterUnmanagedSystemCall) { + this._call = call; + } + + get id(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get endpoint(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class RegisterUnmanagedSystemCall__Outputs { + _call: RegisterUnmanagedSystemCall; + + constructor(call: RegisterUnmanagedSystemCall) { + this._call = call; + } +} + +export class RenounceMarketNominationCall extends ethereum.Call { + get inputs(): RenounceMarketNominationCall__Inputs { + return new RenounceMarketNominationCall__Inputs(this); + } + + get outputs(): RenounceMarketNominationCall__Outputs { + return new RenounceMarketNominationCall__Outputs(this); + } +} + +export class RenounceMarketNominationCall__Inputs { + _call: RenounceMarketNominationCall; + + constructor(call: RenounceMarketNominationCall) { + this._call = call; + } + + get synthMarketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class RenounceMarketNominationCall__Outputs { + _call: RenounceMarketNominationCall; + + constructor(call: RenounceMarketNominationCall) { + this._call = call; + } +} + +export class RenounceMarketOwnershipCall extends ethereum.Call { + get inputs(): RenounceMarketOwnershipCall__Inputs { + return new RenounceMarketOwnershipCall__Inputs(this); + } + + get outputs(): RenounceMarketOwnershipCall__Outputs { + return new RenounceMarketOwnershipCall__Outputs(this); + } +} + +export class RenounceMarketOwnershipCall__Inputs { + _call: RenounceMarketOwnershipCall; + + constructor(call: RenounceMarketOwnershipCall) { + this._call = call; + } + + get synthMarketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class RenounceMarketOwnershipCall__Outputs { + _call: RenounceMarketOwnershipCall; + + constructor(call: RenounceMarketOwnershipCall) { + this._call = call; + } +} + +export class SetDecayRateCall extends ethereum.Call { + get inputs(): SetDecayRateCall__Inputs { + return new SetDecayRateCall__Inputs(this); + } + + get outputs(): SetDecayRateCall__Outputs { + return new SetDecayRateCall__Outputs(this); + } +} + +export class SetDecayRateCall__Inputs { + _call: SetDecayRateCall; + + constructor(call: SetDecayRateCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get rate(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class SetDecayRateCall__Outputs { + _call: SetDecayRateCall; + + constructor(call: SetDecayRateCall) { + this._call = call; + } +} + +export class SetSynthImplementationCall extends ethereum.Call { + get inputs(): SetSynthImplementationCall__Inputs { + return new SetSynthImplementationCall__Inputs(this); + } + + get outputs(): SetSynthImplementationCall__Outputs { + return new SetSynthImplementationCall__Outputs(this); + } +} + +export class SetSynthImplementationCall__Inputs { + _call: SetSynthImplementationCall; + + constructor(call: SetSynthImplementationCall) { + this._call = call; + } + + get synthImplementation(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class SetSynthImplementationCall__Outputs { + _call: SetSynthImplementationCall; + + constructor(call: SetSynthImplementationCall) { + this._call = call; + } +} + +export class SetSynthetixCall extends ethereum.Call { + get inputs(): SetSynthetixCall__Inputs { + return new SetSynthetixCall__Inputs(this); + } + + get outputs(): SetSynthetixCall__Outputs { + return new SetSynthetixCall__Outputs(this); + } +} + +export class SetSynthetixCall__Inputs { + _call: SetSynthetixCall; + + constructor(call: SetSynthetixCall) { + this._call = call; + } + + get synthetix(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class SetSynthetixCall__Outputs { + _call: SetSynthetixCall; + + constructor(call: SetSynthetixCall) { + this._call = call; + } +} + +export class UpdatePriceDataCall extends ethereum.Call { + get inputs(): UpdatePriceDataCall__Inputs { + return new UpdatePriceDataCall__Inputs(this); + } + + get outputs(): UpdatePriceDataCall__Outputs { + return new UpdatePriceDataCall__Outputs(this); + } +} + +export class UpdatePriceDataCall__Inputs { + _call: UpdatePriceDataCall; + + constructor(call: UpdatePriceDataCall) { + this._call = call; + } + + get synthMarketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get buyFeedId(): Bytes { + return this._call.inputValues[1].value.toBytes(); + } + + get sellFeedId(): Bytes { + return this._call.inputValues[2].value.toBytes(); + } +} + +export class UpdatePriceDataCall__Outputs { + _call: UpdatePriceDataCall; + + constructor(call: UpdatePriceDataCall) { + this._call = call; + } +} + +export class UpgradeSynthImplCall extends ethereum.Call { + get inputs(): UpgradeSynthImplCall__Inputs { + return new UpgradeSynthImplCall__Inputs(this); + } + + get outputs(): UpgradeSynthImplCall__Outputs { + return new UpgradeSynthImplCall__Outputs(this); + } +} + +export class UpgradeSynthImplCall__Inputs { + _call: UpgradeSynthImplCall; + + constructor(call: UpgradeSynthImplCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class UpgradeSynthImplCall__Outputs { + _call: UpgradeSynthImplCall; + + constructor(call: UpgradeSynthImplCall) { + this._call = call; + } +} + +export class BuyCall extends ethereum.Call { + get inputs(): BuyCall__Inputs { + return new BuyCall__Inputs(this); + } + + get outputs(): BuyCall__Outputs { + return new BuyCall__Outputs(this); + } +} + +export class BuyCall__Inputs { + _call: BuyCall; + + constructor(call: BuyCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get usdAmount(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get minAmountReceived(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get referrer(): Address { + return this._call.inputValues[3].value.toAddress(); + } +} + +export class BuyCall__Outputs { + _call: BuyCall; + + constructor(call: BuyCall) { + this._call = call; + } + + get synthAmount(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } + + get fees(): BuyCallFeesStruct { + return changetype(this._call.outputValues[1].value.toTuple()); + } +} + +export class BuyCallFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class BuyExactInCall extends ethereum.Call { + get inputs(): BuyExactInCall__Inputs { + return new BuyExactInCall__Inputs(this); + } + + get outputs(): BuyExactInCall__Outputs { + return new BuyExactInCall__Outputs(this); + } +} + +export class BuyExactInCall__Inputs { + _call: BuyExactInCall; + + constructor(call: BuyExactInCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get usdAmount(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get minAmountReceived(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get referrer(): Address { + return this._call.inputValues[3].value.toAddress(); + } +} + +export class BuyExactInCall__Outputs { + _call: BuyExactInCall; + + constructor(call: BuyExactInCall) { + this._call = call; + } + + get synthAmount(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } + + get fees(): BuyExactInCallFeesStruct { + return changetype(this._call.outputValues[1].value.toTuple()); + } +} + +export class BuyExactInCallFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class BuyExactOutCall extends ethereum.Call { + get inputs(): BuyExactOutCall__Inputs { + return new BuyExactOutCall__Inputs(this); + } + + get outputs(): BuyExactOutCall__Outputs { + return new BuyExactOutCall__Outputs(this); + } +} + +export class BuyExactOutCall__Inputs { + _call: BuyExactOutCall; + + constructor(call: BuyExactOutCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get synthAmount(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get maxUsdAmount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get referrer(): Address { + return this._call.inputValues[3].value.toAddress(); + } +} + +export class BuyExactOutCall__Outputs { + _call: BuyExactOutCall; + + constructor(call: BuyExactOutCall) { + this._call = call; + } + + get usdAmountCharged(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } + + get fees(): BuyExactOutCallFeesStruct { + return changetype(this._call.outputValues[1].value.toTuple()); + } +} + +export class BuyExactOutCallFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class SellCall extends ethereum.Call { + get inputs(): SellCall__Inputs { + return new SellCall__Inputs(this); + } + + get outputs(): SellCall__Outputs { + return new SellCall__Outputs(this); + } +} + +export class SellCall__Inputs { + _call: SellCall; + + constructor(call: SellCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get synthAmount(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get minUsdAmount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get referrer(): Address { + return this._call.inputValues[3].value.toAddress(); + } +} + +export class SellCall__Outputs { + _call: SellCall; + + constructor(call: SellCall) { + this._call = call; + } + + get usdAmountReceived(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } + + get fees(): SellCallFeesStruct { + return changetype(this._call.outputValues[1].value.toTuple()); + } +} + +export class SellCallFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class SellExactInCall extends ethereum.Call { + get inputs(): SellExactInCall__Inputs { + return new SellExactInCall__Inputs(this); + } + + get outputs(): SellExactInCall__Outputs { + return new SellExactInCall__Outputs(this); + } +} + +export class SellExactInCall__Inputs { + _call: SellExactInCall; + + constructor(call: SellExactInCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get synthAmount(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get minAmountReceived(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get referrer(): Address { + return this._call.inputValues[3].value.toAddress(); + } +} + +export class SellExactInCall__Outputs { + _call: SellExactInCall; + + constructor(call: SellExactInCall) { + this._call = call; + } + + get returnAmount(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } + + get fees(): SellExactInCallFeesStruct { + return changetype(this._call.outputValues[1].value.toTuple()); + } +} + +export class SellExactInCallFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class SellExactOutCall extends ethereum.Call { + get inputs(): SellExactOutCall__Inputs { + return new SellExactOutCall__Inputs(this); + } + + get outputs(): SellExactOutCall__Outputs { + return new SellExactOutCall__Outputs(this); + } +} + +export class SellExactOutCall__Inputs { + _call: SellExactOutCall; + + constructor(call: SellExactOutCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get usdAmount(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get maxSynthAmount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get referrer(): Address { + return this._call.inputValues[3].value.toAddress(); + } +} + +export class SellExactOutCall__Outputs { + _call: SellExactOutCall; + + constructor(call: SellExactOutCall) { + this._call = call; + } + + get synthToBurn(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } + + get fees(): SellExactOutCallFeesStruct { + return changetype(this._call.outputValues[1].value.toTuple()); + } +} + +export class SellExactOutCallFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class CancelOrderCall extends ethereum.Call { + get inputs(): CancelOrderCall__Inputs { + return new CancelOrderCall__Inputs(this); + } + + get outputs(): CancelOrderCall__Outputs { + return new CancelOrderCall__Outputs(this); + } +} + +export class CancelOrderCall__Inputs { + _call: CancelOrderCall; + + constructor(call: CancelOrderCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get asyncOrderId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class CancelOrderCall__Outputs { + _call: CancelOrderCall; + + constructor(call: CancelOrderCall) { + this._call = call; + } +} + +export class CommitOrderCall extends ethereum.Call { + get inputs(): CommitOrderCall__Inputs { + return new CommitOrderCall__Inputs(this); + } + + get outputs(): CommitOrderCall__Outputs { + return new CommitOrderCall__Outputs(this); + } +} + +export class CommitOrderCall__Inputs { + _call: CommitOrderCall; + + constructor(call: CommitOrderCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get orderType(): i32 { + return this._call.inputValues[1].value.toI32(); + } + + get amountProvided(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get settlementStrategyId(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } + + get minimumSettlementAmount(): BigInt { + return this._call.inputValues[4].value.toBigInt(); + } + + get referrer(): Address { + return this._call.inputValues[5].value.toAddress(); + } +} + +export class CommitOrderCall__Outputs { + _call: CommitOrderCall; + + constructor(call: CommitOrderCall) { + this._call = call; + } + + get asyncOrderClaim(): CommitOrderCallAsyncOrderClaimStruct { + return changetype( + this._call.outputValues[0].value.toTuple() + ); + } +} + +export class CommitOrderCallAsyncOrderClaimStruct extends ethereum.Tuple { + get id(): BigInt { + return this[0].toBigInt(); + } + + get owner(): Address { + return this[1].toAddress(); + } + + get orderType(): i32 { + return this[2].toI32(); + } + + get amountEscrowed(): BigInt { + return this[3].toBigInt(); + } + + get settlementStrategyId(): BigInt { + return this[4].toBigInt(); + } + + get settlementTime(): BigInt { + return this[5].toBigInt(); + } + + get minimumSettlementAmount(): BigInt { + return this[6].toBigInt(); + } + + get settledAt(): BigInt { + return this[7].toBigInt(); + } + + get referrer(): Address { + return this[8].toAddress(); + } +} + +export class SettleOrderCall extends ethereum.Call { + get inputs(): SettleOrderCall__Inputs { + return new SettleOrderCall__Inputs(this); + } + + get outputs(): SettleOrderCall__Outputs { + return new SettleOrderCall__Outputs(this); + } +} + +export class SettleOrderCall__Inputs { + _call: SettleOrderCall; + + constructor(call: SettleOrderCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get asyncOrderId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class SettleOrderCall__Outputs { + _call: SettleOrderCall; + + constructor(call: SettleOrderCall) { + this._call = call; + } + + get finalOrderAmount(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } + + get fees(): SettleOrderCallFeesStruct { + return changetype(this._call.outputValues[1].value.toTuple()); + } +} + +export class SettleOrderCallFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class SettlePythOrderCall extends ethereum.Call { + get inputs(): SettlePythOrderCall__Inputs { + return new SettlePythOrderCall__Inputs(this); + } + + get outputs(): SettlePythOrderCall__Outputs { + return new SettlePythOrderCall__Outputs(this); + } +} + +export class SettlePythOrderCall__Inputs { + _call: SettlePythOrderCall; + + constructor(call: SettlePythOrderCall) { + this._call = call; + } + + get result(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get extraData(): Bytes { + return this._call.inputValues[1].value.toBytes(); + } +} + +export class SettlePythOrderCall__Outputs { + _call: SettlePythOrderCall; + + constructor(call: SettlePythOrderCall) { + this._call = call; + } + + get finalOrderAmount(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } + + get fees(): SettlePythOrderCallFeesStruct { + return changetype(this._call.outputValues[1].value.toTuple()); + } +} + +export class SettlePythOrderCallFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class AddSettlementStrategyCall extends ethereum.Call { + get inputs(): AddSettlementStrategyCall__Inputs { + return new AddSettlementStrategyCall__Inputs(this); + } + + get outputs(): AddSettlementStrategyCall__Outputs { + return new AddSettlementStrategyCall__Outputs(this); + } +} + +export class AddSettlementStrategyCall__Inputs { + _call: AddSettlementStrategyCall; + + constructor(call: AddSettlementStrategyCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get strategy(): AddSettlementStrategyCallStrategyStruct { + return changetype( + this._call.inputValues[1].value.toTuple() + ); + } +} + +export class AddSettlementStrategyCall__Outputs { + _call: AddSettlementStrategyCall; + + constructor(call: AddSettlementStrategyCall) { + this._call = call; + } + + get strategyId(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class AddSettlementStrategyCallStrategyStruct extends ethereum.Tuple { + get strategyType(): i32 { + return this[0].toI32(); + } + + get settlementDelay(): BigInt { + return this[1].toBigInt(); + } + + get settlementWindowDuration(): BigInt { + return this[2].toBigInt(); + } + + get priceVerificationContract(): Address { + return this[3].toAddress(); + } + + get feedId(): Bytes { + return this[4].toBytes(); + } + + get url(): string { + return this[5].toString(); + } + + get settlementReward(): BigInt { + return this[6].toBigInt(); + } + + get minimumUsdExchangeAmount(): BigInt { + return this[7].toBigInt(); + } + + get maxRoundingLoss(): BigInt { + return this[8].toBigInt(); + } + + get disabled(): boolean { + return this[9].toBoolean(); + } +} + +export class SetSettlementStrategyEnabledCall extends ethereum.Call { + get inputs(): SetSettlementStrategyEnabledCall__Inputs { + return new SetSettlementStrategyEnabledCall__Inputs(this); + } + + get outputs(): SetSettlementStrategyEnabledCall__Outputs { + return new SetSettlementStrategyEnabledCall__Outputs(this); + } +} + +export class SetSettlementStrategyEnabledCall__Inputs { + _call: SetSettlementStrategyEnabledCall; + + constructor(call: SetSettlementStrategyEnabledCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get strategyId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get enabled(): boolean { + return this._call.inputValues[2].value.toBoolean(); + } +} + +export class SetSettlementStrategyEnabledCall__Outputs { + _call: SetSettlementStrategyEnabledCall; + + constructor(call: SetSettlementStrategyEnabledCall) { + this._call = call; + } +} + +export class SetWrapperCall extends ethereum.Call { + get inputs(): SetWrapperCall__Inputs { + return new SetWrapperCall__Inputs(this); + } + + get outputs(): SetWrapperCall__Outputs { + return new SetWrapperCall__Outputs(this); + } +} + +export class SetWrapperCall__Inputs { + _call: SetWrapperCall; + + constructor(call: SetWrapperCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get wrapCollateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get maxWrappableAmount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class SetWrapperCall__Outputs { + _call: SetWrapperCall; + + constructor(call: SetWrapperCall) { + this._call = call; + } +} + +export class UnwrapCall extends ethereum.Call { + get inputs(): UnwrapCall__Inputs { + return new UnwrapCall__Inputs(this); + } + + get outputs(): UnwrapCall__Outputs { + return new UnwrapCall__Outputs(this); + } +} + +export class UnwrapCall__Inputs { + _call: UnwrapCall; + + constructor(call: UnwrapCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get unwrapAmount(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get minAmountReceived(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class UnwrapCall__Outputs { + _call: UnwrapCall; + + constructor(call: UnwrapCall) { + this._call = call; + } + + get returnCollateralAmount(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } + + get fees(): UnwrapCallFeesStruct { + return changetype(this._call.outputValues[1].value.toTuple()); + } +} + +export class UnwrapCallFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class WrapCall extends ethereum.Call { + get inputs(): WrapCall__Inputs { + return new WrapCall__Inputs(this); + } + + get outputs(): WrapCall__Outputs { + return new WrapCall__Outputs(this); + } +} + +export class WrapCall__Inputs { + _call: WrapCall; + + constructor(call: WrapCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get wrapAmount(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get minAmountReceived(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class WrapCall__Outputs { + _call: WrapCall; + + constructor(call: WrapCall) { + this._call = call; + } + + get amountToMint(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } + + get fees(): WrapCallFeesStruct { + return changetype(this._call.outputValues[1].value.toTuple()); + } +} + +export class WrapCallFeesStruct extends ethereum.Tuple { + get fixedFees(): BigInt { + return this[0].toBigInt(); + } + + get utilizationFees(): BigInt { + return this[1].toBigInt(); + } + + get skewFees(): BigInt { + return this[2].toBigInt(); + } + + get wrapperFees(): BigInt { + return this[3].toBigInt(); + } +} + +export class SetAsyncFixedFeeCall extends ethereum.Call { + get inputs(): SetAsyncFixedFeeCall__Inputs { + return new SetAsyncFixedFeeCall__Inputs(this); + } + + get outputs(): SetAsyncFixedFeeCall__Outputs { + return new SetAsyncFixedFeeCall__Outputs(this); + } +} + +export class SetAsyncFixedFeeCall__Inputs { + _call: SetAsyncFixedFeeCall; + + constructor(call: SetAsyncFixedFeeCall) { + this._call = call; + } + + get synthMarketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get asyncFixedFee(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class SetAsyncFixedFeeCall__Outputs { + _call: SetAsyncFixedFeeCall; + + constructor(call: SetAsyncFixedFeeCall) { + this._call = call; + } +} + +export class SetAtomicFixedFeeCall extends ethereum.Call { + get inputs(): SetAtomicFixedFeeCall__Inputs { + return new SetAtomicFixedFeeCall__Inputs(this); + } + + get outputs(): SetAtomicFixedFeeCall__Outputs { + return new SetAtomicFixedFeeCall__Outputs(this); + } +} + +export class SetAtomicFixedFeeCall__Inputs { + _call: SetAtomicFixedFeeCall; + + constructor(call: SetAtomicFixedFeeCall) { + this._call = call; + } + + get synthMarketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get atomicFixedFee(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class SetAtomicFixedFeeCall__Outputs { + _call: SetAtomicFixedFeeCall; + + constructor(call: SetAtomicFixedFeeCall) { + this._call = call; + } +} + +export class SetCollateralLeverageCall extends ethereum.Call { + get inputs(): SetCollateralLeverageCall__Inputs { + return new SetCollateralLeverageCall__Inputs(this); + } + + get outputs(): SetCollateralLeverageCall__Outputs { + return new SetCollateralLeverageCall__Outputs(this); + } +} + +export class SetCollateralLeverageCall__Inputs { + _call: SetCollateralLeverageCall; + + constructor(call: SetCollateralLeverageCall) { + this._call = call; + } + + get synthMarketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralLeverage(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class SetCollateralLeverageCall__Outputs { + _call: SetCollateralLeverageCall; + + constructor(call: SetCollateralLeverageCall) { + this._call = call; + } +} + +export class SetCustomTransactorFeesCall extends ethereum.Call { + get inputs(): SetCustomTransactorFeesCall__Inputs { + return new SetCustomTransactorFeesCall__Inputs(this); + } + + get outputs(): SetCustomTransactorFeesCall__Outputs { + return new SetCustomTransactorFeesCall__Outputs(this); + } +} + +export class SetCustomTransactorFeesCall__Inputs { + _call: SetCustomTransactorFeesCall; + + constructor(call: SetCustomTransactorFeesCall) { + this._call = call; + } + + get synthMarketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get transactor(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get fixedFeeAmount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class SetCustomTransactorFeesCall__Outputs { + _call: SetCustomTransactorFeesCall; + + constructor(call: SetCustomTransactorFeesCall) { + this._call = call; + } +} + +export class SetFeeCollectorCall extends ethereum.Call { + get inputs(): SetFeeCollectorCall__Inputs { + return new SetFeeCollectorCall__Inputs(this); + } + + get outputs(): SetFeeCollectorCall__Outputs { + return new SetFeeCollectorCall__Outputs(this); + } +} + +export class SetFeeCollectorCall__Inputs { + _call: SetFeeCollectorCall; + + constructor(call: SetFeeCollectorCall) { + this._call = call; + } + + get synthMarketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get feeCollector(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class SetFeeCollectorCall__Outputs { + _call: SetFeeCollectorCall; + + constructor(call: SetFeeCollectorCall) { + this._call = call; + } +} + +export class SetMarketSkewScaleCall extends ethereum.Call { + get inputs(): SetMarketSkewScaleCall__Inputs { + return new SetMarketSkewScaleCall__Inputs(this); + } + + get outputs(): SetMarketSkewScaleCall__Outputs { + return new SetMarketSkewScaleCall__Outputs(this); + } +} + +export class SetMarketSkewScaleCall__Inputs { + _call: SetMarketSkewScaleCall; + + constructor(call: SetMarketSkewScaleCall) { + this._call = call; + } + + get synthMarketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get skewScale(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class SetMarketSkewScaleCall__Outputs { + _call: SetMarketSkewScaleCall; + + constructor(call: SetMarketSkewScaleCall) { + this._call = call; + } +} + +export class SetMarketUtilizationFeesCall extends ethereum.Call { + get inputs(): SetMarketUtilizationFeesCall__Inputs { + return new SetMarketUtilizationFeesCall__Inputs(this); + } + + get outputs(): SetMarketUtilizationFeesCall__Outputs { + return new SetMarketUtilizationFeesCall__Outputs(this); + } +} + +export class SetMarketUtilizationFeesCall__Inputs { + _call: SetMarketUtilizationFeesCall; + + constructor(call: SetMarketUtilizationFeesCall) { + this._call = call; + } + + get synthMarketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get utilizationFeeRate(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class SetMarketUtilizationFeesCall__Outputs { + _call: SetMarketUtilizationFeesCall; + + constructor(call: SetMarketUtilizationFeesCall) { + this._call = call; + } +} + +export class SetWrapperFeesCall extends ethereum.Call { + get inputs(): SetWrapperFeesCall__Inputs { + return new SetWrapperFeesCall__Inputs(this); + } + + get outputs(): SetWrapperFeesCall__Outputs { + return new SetWrapperFeesCall__Outputs(this); + } +} + +export class SetWrapperFeesCall__Inputs { + _call: SetWrapperFeesCall; + + constructor(call: SetWrapperFeesCall) { + this._call = call; + } + + get synthMarketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get wrapFee(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get unwrapFee(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class SetWrapperFeesCall__Outputs { + _call: SetWrapperFeesCall; + + constructor(call: SetWrapperFeesCall) { + this._call = call; + } +} + +export class UpdateReferrerShareCall extends ethereum.Call { + get inputs(): UpdateReferrerShareCall__Inputs { + return new UpdateReferrerShareCall__Inputs(this); + } + + get outputs(): UpdateReferrerShareCall__Outputs { + return new UpdateReferrerShareCall__Outputs(this); + } +} + +export class UpdateReferrerShareCall__Inputs { + _call: UpdateReferrerShareCall; + + constructor(call: UpdateReferrerShareCall) { + this._call = call; + } + + get synthMarketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get referrer(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get sharePercentage(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class UpdateReferrerShareCall__Outputs { + _call: UpdateReferrerShareCall; + + constructor(call: UpdateReferrerShareCall) { + this._call = call; + } +} + +export class AddToFeatureFlagAllowlistCall extends ethereum.Call { + get inputs(): AddToFeatureFlagAllowlistCall__Inputs { + return new AddToFeatureFlagAllowlistCall__Inputs(this); + } + + get outputs(): AddToFeatureFlagAllowlistCall__Outputs { + return new AddToFeatureFlagAllowlistCall__Outputs(this); + } +} + +export class AddToFeatureFlagAllowlistCall__Inputs { + _call: AddToFeatureFlagAllowlistCall; + + constructor(call: AddToFeatureFlagAllowlistCall) { + this._call = call; + } + + get feature(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get account(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class AddToFeatureFlagAllowlistCall__Outputs { + _call: AddToFeatureFlagAllowlistCall; + + constructor(call: AddToFeatureFlagAllowlistCall) { + this._call = call; + } +} + +export class RemoveFromFeatureFlagAllowlistCall extends ethereum.Call { + get inputs(): RemoveFromFeatureFlagAllowlistCall__Inputs { + return new RemoveFromFeatureFlagAllowlistCall__Inputs(this); + } + + get outputs(): RemoveFromFeatureFlagAllowlistCall__Outputs { + return new RemoveFromFeatureFlagAllowlistCall__Outputs(this); + } +} + +export class RemoveFromFeatureFlagAllowlistCall__Inputs { + _call: RemoveFromFeatureFlagAllowlistCall; + + constructor(call: RemoveFromFeatureFlagAllowlistCall) { + this._call = call; + } + + get feature(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get account(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class RemoveFromFeatureFlagAllowlistCall__Outputs { + _call: RemoveFromFeatureFlagAllowlistCall; + + constructor(call: RemoveFromFeatureFlagAllowlistCall) { + this._call = call; + } +} + +export class SetDeniersCall extends ethereum.Call { + get inputs(): SetDeniersCall__Inputs { + return new SetDeniersCall__Inputs(this); + } + + get outputs(): SetDeniersCall__Outputs { + return new SetDeniersCall__Outputs(this); + } +} + +export class SetDeniersCall__Inputs { + _call: SetDeniersCall; + + constructor(call: SetDeniersCall) { + this._call = call; + } + + get feature(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get deniers(): Array
{ + return this._call.inputValues[1].value.toAddressArray(); + } +} + +export class SetDeniersCall__Outputs { + _call: SetDeniersCall; + + constructor(call: SetDeniersCall) { + this._call = call; + } +} + +export class SetFeatureFlagAllowAllCall extends ethereum.Call { + get inputs(): SetFeatureFlagAllowAllCall__Inputs { + return new SetFeatureFlagAllowAllCall__Inputs(this); + } + + get outputs(): SetFeatureFlagAllowAllCall__Outputs { + return new SetFeatureFlagAllowAllCall__Outputs(this); + } +} + +export class SetFeatureFlagAllowAllCall__Inputs { + _call: SetFeatureFlagAllowAllCall; + + constructor(call: SetFeatureFlagAllowAllCall) { + this._call = call; + } + + get feature(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get allowAll(): boolean { + return this._call.inputValues[1].value.toBoolean(); + } +} + +export class SetFeatureFlagAllowAllCall__Outputs { + _call: SetFeatureFlagAllowAllCall; + + constructor(call: SetFeatureFlagAllowAllCall) { + this._call = call; + } +} + +export class SetFeatureFlagDenyAllCall extends ethereum.Call { + get inputs(): SetFeatureFlagDenyAllCall__Inputs { + return new SetFeatureFlagDenyAllCall__Inputs(this); + } + + get outputs(): SetFeatureFlagDenyAllCall__Outputs { + return new SetFeatureFlagDenyAllCall__Outputs(this); + } +} + +export class SetFeatureFlagDenyAllCall__Inputs { + _call: SetFeatureFlagDenyAllCall; + + constructor(call: SetFeatureFlagDenyAllCall) { + this._call = call; + } + + get feature(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get denyAll(): boolean { + return this._call.inputValues[1].value.toBoolean(); + } +} + +export class SetFeatureFlagDenyAllCall__Outputs { + _call: SetFeatureFlagDenyAllCall; + + constructor(call: SetFeatureFlagDenyAllCall) { + this._call = call; + } +} diff --git a/markets/spot-market/subgraph/base-goerli-competition/generated/schema.ts b/markets/spot-market/subgraph/base-goerli-competition/generated/schema.ts new file mode 100644 index 0000000000..529f472518 --- /dev/null +++ b/markets/spot-market/subgraph/base-goerli-competition/generated/schema.ts @@ -0,0 +1,984 @@ +// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. + +import { + TypedMap, + Entity, + Value, + ValueKind, + store, + Bytes, + BigInt, + BigDecimal, +} from '@graphprotocol/graph-ts'; + +export class Wrapper extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save Wrapper entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type Wrapper must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('Wrapper', id.toString(), this); + } + } + + static loadInBlock(id: string): Wrapper | null { + return changetype(store.get_in_block('Wrapper', id)); + } + + static load(id: string): Wrapper | null { + return changetype(store.get('Wrapper', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get marketId(): BigInt { + let value = this.get('marketId'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set marketId(value: BigInt) { + this.set('marketId', Value.fromBigInt(value)); + } + + get maxWrappableAmount(): BigInt { + let value = this.get('maxWrappableAmount'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set maxWrappableAmount(value: BigInt) { + this.set('maxWrappableAmount', Value.fromBigInt(value)); + } + + get wrapCollateralType(): string { + let value = this.get('wrapCollateralType'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set wrapCollateralType(value: string) { + this.set('wrapCollateralType', Value.fromString(value)); + } +} + +export class SettlementStrategy extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save SettlementStrategy entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type SettlementStrategy must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('SettlementStrategy', id.toString(), this); + } + } + + static loadInBlock(id: string): SettlementStrategy | null { + return changetype(store.get_in_block('SettlementStrategy', id)); + } + + static load(id: string): SettlementStrategy | null { + return changetype(store.get('SettlementStrategy', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get marketId(): BigInt { + let value = this.get('marketId'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set marketId(value: BigInt) { + this.set('marketId', Value.fromBigInt(value)); + } + + get settlementStrategyId(): BigInt { + let value = this.get('settlementStrategyId'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set settlementStrategyId(value: BigInt) { + this.set('settlementStrategyId', Value.fromBigInt(value)); + } + + get disabled(): boolean { + let value = this.get('disabled'); + if (!value || value.kind == ValueKind.NULL) { + return false; + } else { + return value.toBoolean(); + } + } + + set disabled(value: boolean) { + this.set('disabled', Value.fromBoolean(value)); + } + + get strategyType(): i32 { + let value = this.get('strategyType'); + if (!value || value.kind == ValueKind.NULL) { + return 0; + } else { + return value.toI32(); + } + } + + set strategyType(value: i32) { + this.set('strategyType', Value.fromI32(value)); + } + + get settlementDelay(): BigInt | null { + let value = this.get('settlementDelay'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set settlementDelay(value: BigInt | null) { + if (!value) { + this.unset('settlementDelay'); + } else { + this.set('settlementDelay', Value.fromBigInt(value)); + } + } + + get settlementWindowDuration(): BigInt | null { + let value = this.get('settlementWindowDuration'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set settlementWindowDuration(value: BigInt | null) { + if (!value) { + this.unset('settlementWindowDuration'); + } else { + this.set('settlementWindowDuration', Value.fromBigInt(value)); + } + } + + get priceVerificationContract(): string | null { + let value = this.get('priceVerificationContract'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set priceVerificationContract(value: string | null) { + if (!value) { + this.unset('priceVerificationContract'); + } else { + this.set('priceVerificationContract', Value.fromString(value)); + } + } + + get feedId(): Bytes | null { + let value = this.get('feedId'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBytes(); + } + } + + set feedId(value: Bytes | null) { + if (!value) { + this.unset('feedId'); + } else { + this.set('feedId', Value.fromBytes(value)); + } + } + + get url(): string | null { + let value = this.get('url'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set url(value: string | null) { + if (!value) { + this.unset('url'); + } else { + this.set('url', Value.fromString(value)); + } + } + + get settlementReward(): BigInt | null { + let value = this.get('settlementReward'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set settlementReward(value: BigInt | null) { + if (!value) { + this.unset('settlementReward'); + } else { + this.set('settlementReward', Value.fromBigInt(value)); + } + } + + get priceDeviationTolerance(): BigInt | null { + let value = this.get('priceDeviationTolerance'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set priceDeviationTolerance(value: BigInt | null) { + if (!value) { + this.unset('priceDeviationTolerance'); + } else { + this.set('priceDeviationTolerance', Value.fromBigInt(value)); + } + } + + get minimumUsdExchangeAmount(): BigInt | null { + let value = this.get('minimumUsdExchangeAmount'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set minimumUsdExchangeAmount(value: BigInt | null) { + if (!value) { + this.unset('minimumUsdExchangeAmount'); + } else { + this.set('minimumUsdExchangeAmount', Value.fromBigInt(value)); + } + } + + get maxRoundingLoss(): BigInt | null { + let value = this.get('maxRoundingLoss'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set maxRoundingLoss(value: BigInt | null) { + if (!value) { + this.unset('maxRoundingLoss'); + } else { + this.set('maxRoundingLoss', Value.fromBigInt(value)); + } + } +} + +export class Order extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save Order entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type Order must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('Order', id.toString(), this); + } + } + + static loadInBlock(id: string): Order | null { + return changetype(store.get_in_block('Order', id)); + } + + static load(id: string): Order | null { + return changetype(store.get('Order', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get marketId(): BigInt | null { + let value = this.get('marketId'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set marketId(value: BigInt | null) { + if (!value) { + this.unset('marketId'); + } else { + this.set('marketId', Value.fromBigInt(value)); + } + } + + get amountProvided(): BigInt | null { + let value = this.get('amountProvided'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set amountProvided(value: BigInt | null) { + if (!value) { + this.unset('amountProvided'); + } else { + this.set('amountProvided', Value.fromBigInt(value)); + } + } + + get asyncOrderId(): BigInt | null { + let value = this.get('asyncOrderId'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set asyncOrderId(value: BigInt | null) { + if (!value) { + this.unset('asyncOrderId'); + } else { + this.set('asyncOrderId', Value.fromBigInt(value)); + } + } + + get orderType(): i32 { + let value = this.get('orderType'); + if (!value || value.kind == ValueKind.NULL) { + return 0; + } else { + return value.toI32(); + } + } + + set orderType(value: i32) { + this.set('orderType', Value.fromI32(value)); + } + + get referrer(): string | null { + let value = this.get('referrer'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set referrer(value: string | null) { + if (!value) { + this.unset('referrer'); + } else { + this.set('referrer', Value.fromString(value)); + } + } + + get finalOrderAmount(): BigInt | null { + let value = this.get('finalOrderAmount'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set finalOrderAmount(value: BigInt | null) { + if (!value) { + this.unset('finalOrderAmount'); + } else { + this.set('finalOrderAmount', Value.fromBigInt(value)); + } + } + + get collectedFees(): BigInt | null { + let value = this.get('collectedFees'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set collectedFees(value: BigInt | null) { + if (!value) { + this.unset('collectedFees'); + } else { + this.set('collectedFees', Value.fromBigInt(value)); + } + } + + get settler(): string | null { + let value = this.get('settler'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set settler(value: string | null) { + if (!value) { + this.unset('settler'); + } else { + this.set('settler', Value.fromString(value)); + } + } + + get fixedFees(): BigInt | null { + let value = this.get('fixedFees'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set fixedFees(value: BigInt | null) { + if (!value) { + this.unset('fixedFees'); + } else { + this.set('fixedFees', Value.fromBigInt(value)); + } + } + + get skewFees(): BigInt | null { + let value = this.get('skewFees'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set skewFees(value: BigInt | null) { + if (!value) { + this.unset('skewFees'); + } else { + this.set('skewFees', Value.fromBigInt(value)); + } + } + + get utilizationFees(): BigInt | null { + let value = this.get('utilizationFees'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set utilizationFees(value: BigInt | null) { + if (!value) { + this.unset('utilizationFees'); + } else { + this.set('utilizationFees', Value.fromBigInt(value)); + } + } + + get wrapperFees(): BigInt | null { + let value = this.get('wrapperFees'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set wrapperFees(value: BigInt | null) { + if (!value) { + this.unset('wrapperFees'); + } else { + this.set('wrapperFees', Value.fromBigInt(value)); + } + } + + get status(): string | null { + let value = this.get('status'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set status(value: string | null) { + if (!value) { + this.unset('status'); + } else { + this.set('status', Value.fromString(value)); + } + } + + get owner(): string | null { + let value = this.get('owner'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set owner(value: string | null) { + if (!value) { + this.unset('owner'); + } else { + this.set('owner', Value.fromString(value)); + } + } + + get amountEscrowed(): BigInt | null { + let value = this.get('amountEscrowed'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set amountEscrowed(value: BigInt | null) { + if (!value) { + this.unset('amountEscrowed'); + } else { + this.set('amountEscrowed', Value.fromBigInt(value)); + } + } + + get settlementStrategyId(): BigInt | null { + let value = this.get('settlementStrategyId'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set settlementStrategyId(value: BigInt | null) { + if (!value) { + this.unset('settlementStrategyId'); + } else { + this.set('settlementStrategyId', Value.fromBigInt(value)); + } + } + + get settlementTime(): BigInt | null { + let value = this.get('settlementTime'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set settlementTime(value: BigInt | null) { + if (!value) { + this.unset('settlementTime'); + } else { + this.set('settlementTime', Value.fromBigInt(value)); + } + } + + get minimumSettlementAmount(): BigInt | null { + let value = this.get('minimumSettlementAmount'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set minimumSettlementAmount(value: BigInt | null) { + if (!value) { + this.unset('minimumSettlementAmount'); + } else { + this.set('minimumSettlementAmount', Value.fromBigInt(value)); + } + } + + get settledAt(): BigInt | null { + let value = this.get('settledAt'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set settledAt(value: BigInt | null) { + if (!value) { + this.unset('settledAt'); + } else { + this.set('settledAt', Value.fromBigInt(value)); + } + } + + get price(): BigInt | null { + let value = this.get('price'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set price(value: BigInt | null) { + if (!value) { + this.unset('price'); + } else { + this.set('price', Value.fromBigInt(value)); + } + } + + get block(): BigInt { + let value = this.get('block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set block(value: BigInt) { + this.set('block', Value.fromBigInt(value)); + } + + get timestamp(): BigInt { + let value = this.get('timestamp'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set timestamp(value: BigInt) { + this.set('timestamp', Value.fromBigInt(value)); + } +} + +export class MarketInfo extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save MarketInfo entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type MarketInfo must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('MarketInfo', id.toString(), this); + } + } + + static loadInBlock(id: string): MarketInfo | null { + return changetype(store.get_in_block('MarketInfo', id)); + } + + static load(id: string): MarketInfo | null { + return changetype(store.get('MarketInfo', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get marketId(): BigInt { + let value = this.get('marketId'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set marketId(value: BigInt) { + this.set('marketId', Value.fromBigInt(value)); + } + + get buyFeedId(): Bytes | null { + let value = this.get('buyFeedId'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBytes(); + } + } + + set buyFeedId(value: Bytes | null) { + if (!value) { + this.unset('buyFeedId'); + } else { + this.set('buyFeedId', Value.fromBytes(value)); + } + } + + get sellFeedId(): Bytes | null { + let value = this.get('sellFeedId'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBytes(); + } + } + + set sellFeedId(value: Bytes | null) { + if (!value) { + this.unset('sellFeedId'); + } else { + this.set('sellFeedId', Value.fromBytes(value)); + } + } +} + +export class WrappSynth extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save WrappSynth entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type WrappSynth must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('WrappSynth', id.toString(), this); + } + } + + static loadInBlock(id: string): WrappSynth | null { + return changetype(store.get_in_block('WrappSynth', id)); + } + + static load(id: string): WrappSynth | null { + return changetype(store.get('WrappSynth', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get marketId(): BigInt | null { + let value = this.get('marketId'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set marketId(value: BigInt | null) { + if (!value) { + this.unset('marketId'); + } else { + this.set('marketId', Value.fromBigInt(value)); + } + } + + get amount(): BigInt | null { + let value = this.get('amount'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set amount(value: BigInt | null) { + if (!value) { + this.unset('amount'); + } else { + this.set('amount', Value.fromBigInt(value)); + } + } + + get collectedFees(): BigInt | null { + let value = this.get('collectedFees'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set collectedFees(value: BigInt | null) { + if (!value) { + this.unset('collectedFees'); + } else { + this.set('collectedFees', Value.fromBigInt(value)); + } + } + + get wrapperFees(): BigInt | null { + let value = this.get('wrapperFees'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set wrapperFees(value: BigInt | null) { + if (!value) { + this.unset('wrapperFees'); + } else { + this.set('wrapperFees', Value.fromBigInt(value)); + } + } + + get type(): string | null { + let value = this.get('type'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set type(value: string | null) { + if (!value) { + this.unset('type'); + } else { + this.set('type', Value.fromString(value)); + } + } + + get block(): BigInt | null { + let value = this.get('block'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set block(value: BigInt | null) { + if (!value) { + this.unset('block'); + } else { + this.set('block', Value.fromBigInt(value)); + } + } + + get timestamp(): BigInt | null { + let value = this.get('timestamp'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set timestamp(value: BigInt | null) { + if (!value) { + this.unset('timestamp'); + } else { + this.set('timestamp', Value.fromBigInt(value)); + } + } +} diff --git a/markets/spot-market/subgraph/base-goerli-competition/index.ts b/markets/spot-market/subgraph/base-goerli-competition/index.ts new file mode 100644 index 0000000000..0c9458d93c --- /dev/null +++ b/markets/spot-market/subgraph/base-goerli-competition/index.ts @@ -0,0 +1,9 @@ +export * from '../optimism-mainnet/handleOrderCancelled'; +export * from '../optimism-mainnet/handleOrderCommitted'; +export * from '../optimism-mainnet/handleOrderSettled'; +export * from '../optimism-mainnet/handleSettlementStrategyAdded'; +export * from '../optimism-mainnet/handleSettlementStrategyUpdated'; +export * from '../optimism-mainnet/handleSynthPriceDataUpdated'; +export * from '../optimism-mainnet/handleSynthUnWrapped'; +export * from '../optimism-mainnet/handleSynthWrapped'; +export * from '../optimism-mainnet/handleWrapperSet'; diff --git a/markets/spot-market/subgraph/base-goerli-competition/schema.graphql b/markets/spot-market/subgraph/base-goerli-competition/schema.graphql new file mode 100644 index 0000000000..14b2a5f993 --- /dev/null +++ b/markets/spot-market/subgraph/base-goerli-competition/schema.graphql @@ -0,0 +1,67 @@ +type Wrapper @entity { + id: ID! + marketId: BigInt! + maxWrappableAmount: BigInt! + wrapCollateralType: String! +} + +type SettlementStrategy @entity { + id: ID! + marketId: BigInt! + settlementStrategyId: BigInt! + disabled: Boolean! + strategyType: Int + settlementDelay: BigInt + settlementWindowDuration: BigInt + priceVerificationContract: String + feedId: Bytes + url: String + settlementReward: BigInt + priceDeviationTolerance: BigInt + minimumUsdExchangeAmount: BigInt + maxRoundingLoss: BigInt +} + +type Order @entity { + id: ID! + marketId: BigInt + amountProvided: BigInt + asyncOrderId: BigInt + orderType: Int + referrer: String + finalOrderAmount: BigInt + collectedFees: BigInt + settler: String + fixedFees: BigInt + skewFees: BigInt + utilizationFees: BigInt + wrapperFees: BigInt + status: String + owner: String + amountEscrowed: BigInt + settlementStrategyId: BigInt + settlementTime: BigInt + minimumSettlementAmount: BigInt + settledAt: BigInt + price: BigInt + block: BigInt! + timestamp: BigInt! +} + +type MarketInfo @entity { + id: ID! + marketId: BigInt! + buyFeedId: Bytes + sellFeedId: Bytes +} + +type WrappSynth @entity { + id: ID! + marketId: BigInt + amount: BigInt + collectedFees: BigInt + wrapperFees: BigInt + type: String + block: BigInt + timestamp: BigInt +} diff --git a/markets/spot-market/subgraph/codegen.sh b/markets/spot-market/subgraph/codegen.sh new file mode 100755 index 0000000000..3cffc226aa --- /dev/null +++ b/markets/spot-market/subgraph/codegen.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +codegen() { + namespace=$1 + chainId=$2 + cannonPackage=$3 + cannonPreset=$4 + + echo + echo + echo + echo '>' cannon inspect "$cannonPackage" --preset $cannonPreset --chain-id "$chainId" --write-deployments "./$namespace/deployments" + yarn cannon inspect "$cannonPackage" --preset $cannonPreset --chain-id "$chainId" --write-deployments "./$namespace/deployments" + + echo + echo + echo + echo '>' graph codegen "subgraph.$namespace.yaml" --output-dir "$namespace/generated" + yarn graph codegen "subgraph.$namespace.yaml" --output-dir "$namespace/generated" + yarn prettier --write "$namespace/generated" + + echo + echo + echo + echo '>' graph build "subgraph.$namespace.yaml" --output-dir "./build/$namespace" + yarn graph build "subgraph.$namespace.yaml" --output-dir "./build/$namespace" + yarn prettier --write "subgraph.$namespace.yaml" +} + + +releaseVersion=$(yarn workspace '@synthetixio/spot-market' node -p 'require(`./package.json`).version') + +#codegen mainnet 1 "synthetix-spot-market:$releaseVersion" main +#codegen goerli 5 "synthetix-spot-market:$releaseVersion" main +codegen optimism-mainnet 10 "synthetix-spot-market:$releaseVersion" main +codegen optimism-goerli 420 "synthetix-spot-market:$releaseVersion" main +#codegen base-goerli 84531 "synthetix-spot-market:$releaseVersion" main +codegen base-goerli-competition 84531 "synthetix-spot-market:latest" competition diff --git a/markets/spot-market/subgraph/optimism-goerli/generated/SpotMarketProxy/SpotMarketProxy.ts b/markets/spot-market/subgraph/optimism-goerli/generated/SpotMarketProxy/SpotMarketProxy.ts index 992c61f615..79c6e341d3 100644 --- a/markets/spot-market/subgraph/optimism-goerli/generated/SpotMarketProxy/SpotMarketProxy.ts +++ b/markets/spot-market/subgraph/optimism-goerli/generated/SpotMarketProxy/SpotMarketProxy.ts @@ -280,6 +280,10 @@ export class SynthRegistered__Params { get synthMarketId(): BigInt { return this._event.parameters[0].value.toBigInt(); } + + get synthTokenAddress(): Address { + return this._event.parameters[1].value.toAddress(); + } } export class SynthetixSystemSet extends ethereum.Event { @@ -3520,6 +3524,36 @@ export class RenounceMarketNominationCall__Outputs { } } +export class RenounceMarketOwnershipCall extends ethereum.Call { + get inputs(): RenounceMarketOwnershipCall__Inputs { + return new RenounceMarketOwnershipCall__Inputs(this); + } + + get outputs(): RenounceMarketOwnershipCall__Outputs { + return new RenounceMarketOwnershipCall__Outputs(this); + } +} + +export class RenounceMarketOwnershipCall__Inputs { + _call: RenounceMarketOwnershipCall; + + constructor(call: RenounceMarketOwnershipCall) { + this._call = call; + } + + get synthMarketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class RenounceMarketOwnershipCall__Outputs { + _call: RenounceMarketOwnershipCall; + + constructor(call: RenounceMarketOwnershipCall) { + this._call = call; + } +} + export class SetDecayRateCall extends ethereum.Call { get inputs(): SetDecayRateCall__Inputs { return new SetDecayRateCall__Inputs(this); diff --git a/markets/spot-market/subgraph/optimism-mainnet/generated/SpotMarketProxy/SpotMarketProxy.ts b/markets/spot-market/subgraph/optimism-mainnet/generated/SpotMarketProxy/SpotMarketProxy.ts index 5af1ecd11c..79c6e341d3 100644 --- a/markets/spot-market/subgraph/optimism-mainnet/generated/SpotMarketProxy/SpotMarketProxy.ts +++ b/markets/spot-market/subgraph/optimism-mainnet/generated/SpotMarketProxy/SpotMarketProxy.ts @@ -280,6 +280,10 @@ export class SynthRegistered__Params { get synthMarketId(): BigInt { return this._event.parameters[0].value.toBigInt(); } + + get synthTokenAddress(): Address { + return this._event.parameters[1].value.toAddress(); + } } export class SynthetixSystemSet extends ethereum.Event { @@ -568,6 +572,10 @@ export class OrderSettled__Params { get price(): BigInt { return this._event.parameters[6].value.toBigInt(); } + + get orderType(): i32 { + return this._event.parameters[7].value.toI32(); + } } export class OrderSettledFeesStruct extends ethereum.Tuple { @@ -3516,6 +3524,36 @@ export class RenounceMarketNominationCall__Outputs { } } +export class RenounceMarketOwnershipCall extends ethereum.Call { + get inputs(): RenounceMarketOwnershipCall__Inputs { + return new RenounceMarketOwnershipCall__Inputs(this); + } + + get outputs(): RenounceMarketOwnershipCall__Outputs { + return new RenounceMarketOwnershipCall__Outputs(this); + } +} + +export class RenounceMarketOwnershipCall__Inputs { + _call: RenounceMarketOwnershipCall; + + constructor(call: RenounceMarketOwnershipCall) { + this._call = call; + } + + get synthMarketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class RenounceMarketOwnershipCall__Outputs { + _call: RenounceMarketOwnershipCall; + + constructor(call: RenounceMarketOwnershipCall) { + this._call = call; + } +} + export class SetDecayRateCall extends ethereum.Call { get inputs(): SetDecayRateCall__Inputs { return new SetDecayRateCall__Inputs(this); diff --git a/markets/spot-market/subgraph/package.json b/markets/spot-market/subgraph/package.json index a894c00687..973bcc4fdc 100644 --- a/markets/spot-market/subgraph/package.json +++ b/markets/spot-market/subgraph/package.json @@ -4,21 +4,16 @@ "private": true, "version": "1.0.0", "scripts": { - "subgraphgen": "yarn subgraph:deployments && yarn subgraph:codegen && yarn subgraph:build", - "subgraph:deployments": "yarn deployments:optimism-mainnet && yarn deployments:optimism-goerli", - "subgraph:codegen": "yarn codegen:optimism-mainnet && yarn codegen:optimism-goerli", - "subgraph:build": "yarn build:optimism-mainnet && yarn build:optimism-goerli", + "cannon": "cannon", + "prettier": "prettier", + "graph": "graph", + "subgraphgen": "./codegen.sh", "auth": "graph auth --product hosted-service $V3_GRAPH_KEY", - "deployments:optimism-mainnet": "cannon inspect synthetix-spot-market:latest --chain-id 10 --write-deployments ./optimism-mainnet/deployments", - "codegen:optimism-mainnet": "node ./codegen optimism-mainnet && graph codegen subgraph.optimism-mainnet.yaml --output-dir=optimism-mainnet/generated && prettier --write optimism-mainnet/generated", - "build:optimism-mainnet": "graph build subgraph.optimism-mainnet.yaml --output-dir ./build/optimism-mainnet --network optimism", - "deploy:optimism-mainnet": "graph deploy snx-v3/spot-market-optimism-mainnet subgraph.optimism-mainnet.yaml --output-dir ./build/optimism-mainnet --network optimism --product hosted-service", - "deployments:optimism-goerli": "cannon inspect synthetix-spot-market:latest --chain-id 420 --write-deployments ./optimism-goerli/deployments", - "codegen:optimism-goerli": "node ./codegen optimism-goerli && graph codegen subgraph.optimism-goerli.yaml --output-dir=optimism-goerli/generated && prettier --write optimism-goerli/generated", - "build:optimism-goerli": "graph build subgraph.optimism-goerli.yaml --output-dir ./build/optimism-goerli --network optimism-goerli", - "deploy:optimism-goerli": "graph deploy snx-v3/spot-market-optimism-goerli subgraph.optimism-goerli.yaml --output-dir ./build/optimism-goerli --network optimism-goerli --product hosted-service", - "test": "echo 'SKIP: No tests' || graph test", - "coverage": "echo 'SKIP: No tests'", + "deploy:optimism-mainnet": "graph deploy spot-market-optimism-mainnet subgraph.optimism-mainnet.yaml --output-dir ./build/optimism-mainnet --network optimism --version-label v0.0.1 --node https://app.satsuma.xyz/api/subgraphs/deploy --deploy-key $SATSUMA_KEY --ipfs https://ipfs.satsuma.xyz", + "deploy:optimism-goerli": "graph deploy spot-market-optimism-goerli subgraph.optimism-goerli.yaml --output-dir ./build/optimism-goerli --network optimism-goerli --version-label v0.0.1 --node https://app.satsuma.xyz/api/subgraphs/deploy --deploy-key $SATSUMA_KEY --ipfs https://ipfs.satsuma.xyz", + "deploy:base-goerli-competition": "graph deploy spot-market-base-testnet subgraph.base-goerli-competition.yaml --output-dir ./build/base-goerli-competition --network base-testnet --version-label v0.0.1 --node https://app.satsuma.xyz/api/subgraphs/deploy --deploy-key $SATSUMA_KEY --ipfs https://ipfs.satsuma.xyz", + "test": "graph test", + "coverage": "yarn deployments:optimism-mainnet && yarn codegen:optimism-mainnet && git diff --exit-code && yarn test --coverage", "create-local": "graph create --node http://localhost:8020/ snx-v3/spot-market-optimism-goerli", "remove-local": "graph remove --node http://localhost:8020/ snx-v3/spot-market-optimism-goerli", "deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 snx-v3/spot-market-optimism-goerli" @@ -26,8 +21,9 @@ "devDependencies": { "@graphprotocol/graph-cli": "^0.50.1", "@graphprotocol/graph-ts": "^0.30.0", - "@usecannon/cli": "^2.5.1", + "@usecannon/cli": "^2.7.1", "ethers": "^5.7.2", - "prettier": "^2.8.8" + "matchstick-as": "^0.5.2", + "prettier": "^3.0.3" } } diff --git a/markets/spot-market/subgraph/startBlock.js b/markets/spot-market/subgraph/startBlock.js new file mode 100755 index 0000000000..a0403fc1ac --- /dev/null +++ b/markets/spot-market/subgraph/startBlock.js @@ -0,0 +1,43 @@ +#!/usr/bin/env node + +const ethers = require('ethers'); + +async function getStartBlock({ namespace, networkName }) { + const provider = new ethers.providers.JsonRpcProvider( + `https://${networkName}.infura.io/v3/${process.env.INFURA_KEY}` + ); + const address = require(`./${namespace}/deployments/SpotMarketProxy.json`).address; + const deployTx = require(`./${namespace}/deployments/InitialSpotMarketProxy.json`).deployTxnHash; + const tx = await provider.getTransactionReceipt(deployTx); + return { namespace, networkName, address, startBlock: tx.blockNumber }; +} +exports.findDeploymentBlock = getStartBlock; + +async function findAll() { + const data = await Promise.all([ + // getStartBlock({ namespace: 'mainnet', networkName: 'mainnet' }), + // getStartBlock({ namespace: 'goerli', networkName: 'goerli' }), + getStartBlock({ namespace: 'optimism-mainnet', networkName: 'optimism-mainnet' }), + getStartBlock({ namespace: 'optimism-goerli', networkName: 'optimism-goerli' }), + // getStartBlock({ namespace: 'base-goerli', networkName: 'base-goerli' }), + getStartBlock({ namespace: 'base-goerli-competition', networkName: 'base-goerli' }), + ]); + + return Object.fromEntries( + data.map(({ namespace, address, startBlock }) => [ + namespace, + { SpotMarketProxy: { address, startBlock } }, + ]) + ); +} + +if (require.main === module) { + const [namespace, networkName] = process.argv.slice(2); + if (namespace && networkName) { + getStartBlock({ namespace, networkName }).then(({ address, startBlock }) => + console.log({ SpotMarketProxy: { address, startBlock } }) + ); + } else { + findAll().then((data) => console.log(data)); + } +} diff --git a/markets/spot-market/subgraph/subgraph.base-goerli-competition.yaml b/markets/spot-market/subgraph/subgraph.base-goerli-competition.yaml new file mode 100644 index 0000000000..27e273f2f0 --- /dev/null +++ b/markets/spot-market/subgraph/subgraph.base-goerli-competition.yaml @@ -0,0 +1,52 @@ +specVersion: 0.0.4 +schema: + file: ./base-goerli-competition/schema.graphql +dataSources: + - kind: ethereum + network: base-testnet + name: SpotMarketProxy + source: + abi: SpotMarketProxy + address: "0x17633A63083dbd4941891F87Bdf31B896e91e2B9" + startBlock: 9243672 + mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + file: ./base-goerli-competition/index.ts + abis: + - name: SpotMarketProxy + file: ./base-goerli-competition/deployments/SpotMarketProxy.json + entities: + - Wrapper + - Order + - MarketInfo + - SettlementStrategy + - SynthWrapped + eventHandlers: + - event: OrderSettled(indexed uint128,indexed + uint128,uint256,(uint256,uint256,int256,int256),uint256,indexed + address,uint256,uint8) + handler: handleOrderSettled + - event: SynthWrapped(indexed + uint256,uint256,(uint256,uint256,int256,int256),uint256) + handler: handleSynthWrapped + - event: SynthUnwrapped(indexed + uint256,uint256,(uint256,uint256,int256,int256),uint256) + handler: handleSynthUnWrapped + - event: + OrderCommitted(indexed uint128,indexed uint8,uint256,uint128,indexed + address,address) + handler: handleOrderCommitted + - event: OrderCancelled(indexed uint128,indexed + uint128,(uint128,address,uint8,uint256,uint256,uint256,uint256,uint256,address),indexed + address) + handler: handleOrderCancelled + - event: WrapperSet(indexed uint256,indexed address,uint256) + handler: handleWrapperSet + - event: SettlementStrategyAdded(indexed uint128,indexed uint256) + handler: handleSettlementStrategyAdded + - event: SettlementStrategyUpdated(indexed uint128,indexed uint256,bool) + handler: handleSettlementStrategyUpdated + - event: SynthPriceDataUpdated(indexed uint256,indexed bytes32,indexed bytes32) + handler: handleSynthPriceDataUpdated diff --git a/markets/spot-market/subgraph/subgraph.optimism-goerli.yaml b/markets/spot-market/subgraph/subgraph.optimism-goerli.yaml index 2f6c06a815..81ba3f8b90 100644 --- a/markets/spot-market/subgraph/subgraph.optimism-goerli.yaml +++ b/markets/spot-market/subgraph/subgraph.optimism-goerli.yaml @@ -34,7 +34,8 @@ dataSources: - event: SynthUnwrapped(indexed uint256,uint256,(uint256,uint256,int256,int256),uint256) handler: handleSynthUnWrapped - - event: OrderCommitted(indexed uint128,indexed uint8,uint256,uint128,indexed + - event: + OrderCommitted(indexed uint128,indexed uint8,uint256,uint128,indexed address,address) handler: handleOrderCommitted - event: OrderCancelled(indexed uint128,indexed diff --git a/markets/spot-market/subgraph/subgraph.optimism-mainnet.yaml b/markets/spot-market/subgraph/subgraph.optimism-mainnet.yaml index 8d9abb4bea..1a0af61a61 100644 --- a/markets/spot-market/subgraph/subgraph.optimism-mainnet.yaml +++ b/markets/spot-market/subgraph/subgraph.optimism-mainnet.yaml @@ -26,7 +26,7 @@ dataSources: eventHandlers: - event: OrderSettled(indexed uint128,indexed uint128,uint256,(uint256,uint256,int256,int256),uint256,indexed - address,uint256) + address,uint256,uint8) handler: handleOrderSettled - event: SynthWrapped(indexed uint256,uint256,(uint256,uint256,int256,int256),uint256) @@ -34,7 +34,8 @@ dataSources: - event: SynthUnwrapped(indexed uint256,uint256,(uint256,uint256,int256,int256),uint256) handler: handleSynthUnWrapped - - event: OrderCommitted(indexed uint128,indexed uint8,uint256,uint128,indexed + - event: + OrderCommitted(indexed uint128,indexed uint8,uint256,uint128,indexed address,address) handler: handleOrderCommitted - event: OrderCancelled(indexed uint128,indexed diff --git a/markets/spot-market/subgraph/tests/SpotMarketProxy.test.ts b/markets/spot-market/subgraph/tests/SpotMarketProxy.test.ts new file mode 100644 index 0000000000..4b549bcb4c --- /dev/null +++ b/markets/spot-market/subgraph/tests/SpotMarketProxy.test.ts @@ -0,0 +1,31 @@ +import { afterEach, beforeEach, clearStore, describe, logStore, test } from 'matchstick-as'; + +import handleOrderCancelled from './handleOrderCancelled'; +import handleOrderCommitted from './handleOrderCommitted'; +import handleOrderSettled from './handleOrderSettled'; +import handleSettlementStrategyAdded from './handleSettlementStrategyAdded'; +import handleSettlementStrategyUpdated from './handleSettlementStrategyUpdated'; +import handleSynthPriceDataUpdated from './handleSynthPriceDataUpdated'; +import handleSynthUnWrapped from './handleSynthUnWrapped'; +import handleSynthWrapped from './handleSynthWrapped'; +import handleWrapperSet from './handleWrapperSet'; + +describe('PerpsMarketProxy', () => { + beforeEach(() => { + clearStore(); + }); + + afterEach(() => { + logStore(); + }); + + test('handleOrderCancelled', handleOrderCancelled); + test('handleOrderCommitted', handleOrderCommitted); + test('handleOrderSettled', handleOrderSettled); + test('handleSettlementStrategyAdded', handleSettlementStrategyAdded); + test('handleSettlementStrategyUpdated', handleSettlementStrategyUpdated); + test('handleSynthPriceDataUpdated', handleSynthPriceDataUpdated); + test('handleSynthUnWrapped', handleSynthUnWrapped); + test('handleSynthWrapped', handleSynthWrapped); + test('handleWrapperSet', handleWrapperSet); +}); diff --git a/markets/spot-market/subgraph/tests/event-factories/createOrderCancelledEvent.ts b/markets/spot-market/subgraph/tests/event-factories/createOrderCancelledEvent.ts new file mode 100644 index 0000000000..496ac8e075 --- /dev/null +++ b/markets/spot-market/subgraph/tests/event-factories/createOrderCancelledEvent.ts @@ -0,0 +1,62 @@ +import { Address, BigInt, ethereum } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { + OrderCancelled as OrderCancelledEvent, + OrderCancelledAsyncOrderClaimStruct, +} from '../../optimism-mainnet/generated/SpotMarketProxy/SpotMarketProxy'; + +export function createOrderCancelledEvent( + id: i32, + asyncOrderId: i64, + // asyncOrderClaim tuple + claimId: i64, + owner: string, + orderType: i32, + amountEscrowed: i64, + settlementStrategyId: i64, + settlementTime: i64, + minimumSettlementAmount: i64, + settledAt: i64, + referrer: string, + // end of asyncOrderClaim tuple + sender: string, + timestamp: i64, + blockNumber: i64, + logIndex: i64 +): OrderCancelledEvent { + const event = newTypedMockEvent(); + + event.parameters = []; + event.parameters.push(new ethereum.EventParam('marketId', ethereum.Value.fromI32(id))); + event.parameters.push( + new ethereum.EventParam( + 'asyncOrderId', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(asyncOrderId)) + ) + ); + + const asyncOrderClaim = changetype([ + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(claimId)), + ethereum.Value.fromAddress(Address.fromString(owner)), + ethereum.Value.fromI32(orderType), + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(amountEscrowed)), + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(settlementStrategyId)), + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(settlementTime)), + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(minimumSettlementAmount)), + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(settledAt)), + ethereum.Value.fromAddress(Address.fromString(referrer)), + ]); + event.parameters.push( + new ethereum.EventParam('asyncOrderClaim', ethereum.Value.fromTuple(asyncOrderClaim)) + ); + + event.parameters.push( + new ethereum.EventParam('sender', ethereum.Value.fromAddress(Address.fromString(sender))) + ); + + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + event.logIndex = BigInt.fromI64(logIndex); + + return event; +} diff --git a/markets/spot-market/subgraph/tests/event-factories/createOrderCommittedEvent.ts b/markets/spot-market/subgraph/tests/event-factories/createOrderCommittedEvent.ts new file mode 100644 index 0000000000..6358784853 --- /dev/null +++ b/markets/spot-market/subgraph/tests/event-factories/createOrderCommittedEvent.ts @@ -0,0 +1,45 @@ +import { Address, BigInt, ethereum } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { OrderCommitted as OrderCommittedEvent } from '../../optimism-mainnet/generated/SpotMarketProxy/SpotMarketProxy'; + +export function createOrderCommittedEvent( + id: i32, + orderType: i32, + amountProvided: i64, + asyncOrderId: i64, + sender: string, + referrer: string, + timestamp: i64, + blockNumber: i64, + logIndex: i64 +): OrderCommittedEvent { + const event = newTypedMockEvent(); + + event.parameters = []; + event.parameters.push(new ethereum.EventParam('marketId', ethereum.Value.fromI32(id))); + event.parameters.push(new ethereum.EventParam('orderType', ethereum.Value.fromI32(orderType))); + event.parameters.push( + new ethereum.EventParam( + 'amountProvided', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(amountProvided)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'asyncOrderId', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(asyncOrderId)) + ) + ); + event.parameters.push( + new ethereum.EventParam('sender', ethereum.Value.fromAddress(Address.fromString(sender))) + ); + event.parameters.push( + new ethereum.EventParam('referrer', ethereum.Value.fromAddress(Address.fromString(referrer))) + ); + + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + event.logIndex = BigInt.fromI64(logIndex); + + return event; +} diff --git a/markets/spot-market/subgraph/tests/event-factories/createOrderSettledEvent.ts b/markets/spot-market/subgraph/tests/event-factories/createOrderSettledEvent.ts new file mode 100644 index 0000000000..698b961dce --- /dev/null +++ b/markets/spot-market/subgraph/tests/event-factories/createOrderSettledEvent.ts @@ -0,0 +1,68 @@ +import { Address, BigInt, ethereum } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { + OrderSettled as OrderSettledEvent, + OrderSettledFeesStruct, +} from '../../optimism-mainnet/generated/SpotMarketProxy/SpotMarketProxy'; + +export function createOrderSettledEvent( + id: i32, + asyncOrderId: i64, + finalOrderAmount: i64, + // fees tuple + fixedFees: i64, + utilizationFees: i64, + skewFees: i64, + wrapperFees: i64, + // end of fees tuple + collectedFees: i64, + settler: string, + price: i64, + timestamp: i64, + blockNumber: i64, + logIndex: i64 +): OrderSettledEvent { + const event = newTypedMockEvent(); + + event.parameters = []; + event.parameters.push(new ethereum.EventParam('marketId', ethereum.Value.fromI32(id))); + event.parameters.push( + new ethereum.EventParam( + 'asyncOrderId', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(asyncOrderId)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'finalOrderAmount', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(finalOrderAmount)) + ) + ); + + const fees = changetype([ + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(fixedFees)), + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(utilizationFees)), + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(skewFees)), + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(wrapperFees)), + ]); + event.parameters.push(new ethereum.EventParam('fees', ethereum.Value.fromTuple(fees))); + + event.parameters.push( + new ethereum.EventParam( + 'collectedFees', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(collectedFees)) + ) + ); + event.parameters.push( + new ethereum.EventParam('settler', ethereum.Value.fromAddress(Address.fromString(settler))) + ); + event.parameters.push( + new ethereum.EventParam('price', ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(price))) + ); + + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + event.logIndex = BigInt.fromI64(logIndex); + + return event; +} diff --git a/markets/spot-market/subgraph/tests/event-factories/createSettlementStrategyAddedEvent.ts b/markets/spot-market/subgraph/tests/event-factories/createSettlementStrategyAddedEvent.ts new file mode 100644 index 0000000000..dab9b2129b --- /dev/null +++ b/markets/spot-market/subgraph/tests/event-factories/createSettlementStrategyAddedEvent.ts @@ -0,0 +1,28 @@ +import { BigInt, ethereum } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { SettlementStrategyAdded as SettlementStrategyAddedEvent } from '../../optimism-mainnet/generated/SpotMarketProxy/SpotMarketProxy'; + +export function createSettlementStrategyAddedEvent( + id: i32, + strategyId: i64, + timestamp: i64, + blockNumber: i64, + logIndex: i64 +): SettlementStrategyAddedEvent { + const event = newTypedMockEvent(); + + event.parameters = []; + event.parameters.push(new ethereum.EventParam('synthMarketId', ethereum.Value.fromI32(id))); + event.parameters.push( + new ethereum.EventParam( + 'strategyId', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(strategyId)) + ) + ); + + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + event.logIndex = BigInt.fromI64(logIndex); + + return event; +} diff --git a/markets/spot-market/subgraph/tests/event-factories/createSettlementStrategyUpdatedEvent.ts b/markets/spot-market/subgraph/tests/event-factories/createSettlementStrategyUpdatedEvent.ts new file mode 100644 index 0000000000..f28b59bc68 --- /dev/null +++ b/markets/spot-market/subgraph/tests/event-factories/createSettlementStrategyUpdatedEvent.ts @@ -0,0 +1,30 @@ +import { BigInt, ethereum } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { SettlementStrategyUpdated as SettlementStrategyUpdatedEvent } from '../../optimism-mainnet/generated/SpotMarketProxy/SpotMarketProxy'; + +export function createSettlementStrategyUpdatedEvent( + id: i32, + strategyId: i64, + enabled: boolean, + timestamp: i64, + blockNumber: i64, + logIndex: i64 +): SettlementStrategyUpdatedEvent { + const event = newTypedMockEvent(); + + event.parameters = []; + event.parameters.push(new ethereum.EventParam('synthMarketId', ethereum.Value.fromI32(id))); + event.parameters.push( + new ethereum.EventParam( + 'strategyId', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(strategyId)) + ) + ); + event.parameters.push(new ethereum.EventParam('enabled', ethereum.Value.fromBoolean(enabled))); + + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + event.logIndex = BigInt.fromI64(logIndex); + + return event; +} diff --git a/markets/spot-market/subgraph/tests/event-factories/createSynthPriceDataUpdatedEvent.ts b/markets/spot-market/subgraph/tests/event-factories/createSynthPriceDataUpdatedEvent.ts new file mode 100644 index 0000000000..a477846f89 --- /dev/null +++ b/markets/spot-market/subgraph/tests/event-factories/createSynthPriceDataUpdatedEvent.ts @@ -0,0 +1,29 @@ +import { BigInt, ethereum, Bytes } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { SynthPriceDataUpdated as SynthPriceDataUpdatedEvent } from '../../optimism-mainnet/generated/SpotMarketProxy/SpotMarketProxy'; + +export function createSynthPriceDataUpdatedEvent( + id: i32, + buyFeedId: string, + sellFeedId: string, + timestamp: i64, + blockNumber: i64, + logIndex: i64 +): SynthPriceDataUpdatedEvent { + const event = newTypedMockEvent(); + + event.parameters = []; + event.parameters.push(new ethereum.EventParam('synthMarketId', ethereum.Value.fromI32(id))); + event.parameters.push( + new ethereum.EventParam('buyFeedId', ethereum.Value.fromBytes(Bytes.fromHexString(buyFeedId))) + ); + event.parameters.push( + new ethereum.EventParam('sellFeedId', ethereum.Value.fromBytes(Bytes.fromHexString(sellFeedId))) + ); + + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + event.logIndex = BigInt.fromI64(logIndex); + + return event; +} diff --git a/markets/spot-market/subgraph/tests/event-factories/createSynthUnwrappedEvent.ts b/markets/spot-market/subgraph/tests/event-factories/createSynthUnwrappedEvent.ts new file mode 100644 index 0000000000..cc28012f48 --- /dev/null +++ b/markets/spot-market/subgraph/tests/event-factories/createSynthUnwrappedEvent.ts @@ -0,0 +1,52 @@ +import { BigInt, ethereum } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { + SynthUnwrapped as SynthUnWrappedEvent, + SynthUnwrappedFeesStruct, +} from '../../optimism-mainnet/generated/SpotMarketProxy/SpotMarketProxy'; + +export function createSynthUnWrappedEvent( + id: i32, + amountUnwrapped: i64, + // fees tuple + fixedFees: i64, + utilizationFees: i64, + skewFees: i64, + wrapperFees: i64, + // end of fees tuple + feesCollected: i64, + timestamp: i64, + blockNumber: i64, + logIndex: i64 +): SynthUnWrappedEvent { + const event = newTypedMockEvent(); + + event.parameters = []; + event.parameters.push(new ethereum.EventParam('synthMarketId', ethereum.Value.fromI32(id))); + event.parameters.push( + new ethereum.EventParam( + 'amountUnwrapped', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(amountUnwrapped)) + ) + ); + + const fees = changetype([ + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(fixedFees)), + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(utilizationFees)), + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(skewFees)), + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(wrapperFees)), + ]); + event.parameters.push(new ethereum.EventParam('fees', ethereum.Value.fromTuple(fees))); + + event.parameters.push( + new ethereum.EventParam( + 'feesCollected', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(feesCollected)) + ) + ); + + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + event.logIndex = BigInt.fromI64(logIndex); + return event; +} diff --git a/markets/spot-market/subgraph/tests/event-factories/createSynthWrappedEvent.ts b/markets/spot-market/subgraph/tests/event-factories/createSynthWrappedEvent.ts new file mode 100644 index 0000000000..d86d976ca1 --- /dev/null +++ b/markets/spot-market/subgraph/tests/event-factories/createSynthWrappedEvent.ts @@ -0,0 +1,52 @@ +import { BigInt, ethereum } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { + SynthWrapped as SynthWrappedEvent, + SynthWrappedFeesStruct, +} from '../../optimism-mainnet/generated/SpotMarketProxy/SpotMarketProxy'; + +export function createSynthWrappedEvent( + id: i32, + amountWrapped: i64, + // fees tuple + fixedFees: i64, + utilizationFees: i64, + skewFees: i64, + wrapperFees: i64, + // end of fees tuple + feesCollected: i64, + timestamp: i64, + blockNumber: i64, + logIndex: i64 +): SynthWrappedEvent { + const event = newTypedMockEvent(); + + event.parameters = []; + event.parameters.push(new ethereum.EventParam('synthMarketId', ethereum.Value.fromI32(id))); + event.parameters.push( + new ethereum.EventParam( + 'amountWrapped', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(amountWrapped)) + ) + ); + + const fees = changetype([ + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(fixedFees)), + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(utilizationFees)), + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(skewFees)), + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(wrapperFees)), + ]); + event.parameters.push(new ethereum.EventParam('fees', ethereum.Value.fromTuple(fees))); + + event.parameters.push( + new ethereum.EventParam( + 'feesCollected', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(feesCollected)) + ) + ); + + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + event.logIndex = BigInt.fromI64(logIndex); + return event; +} diff --git a/markets/spot-market/subgraph/tests/event-factories/createWrapperSetEvent.ts b/markets/spot-market/subgraph/tests/event-factories/createWrapperSetEvent.ts new file mode 100644 index 0000000000..3165273711 --- /dev/null +++ b/markets/spot-market/subgraph/tests/event-factories/createWrapperSetEvent.ts @@ -0,0 +1,30 @@ +import { Address, BigInt, ethereum } from '@graphprotocol/graph-ts'; +import { newTypedMockEvent } from 'matchstick-as'; +import { WrapperSet as WrapperSetEvent } from '../../optimism-mainnet/generated/SpotMarketProxy/SpotMarketProxy'; + +export function createWrapperSetEvent( + id: i32, + wrapCollateralType: string, + maxWrappableAmount: i64, + timestamp: i64, + blockNumber: i64 +): WrapperSetEvent { + const event = newTypedMockEvent(); + event.parameters = []; + event.parameters.push(new ethereum.EventParam('synthMarketId', ethereum.Value.fromI32(id))); + event.parameters.push( + new ethereum.EventParam( + 'wrapCollateralType', + ethereum.Value.fromAddress(Address.fromString(wrapCollateralType)) + ) + ); + event.parameters.push( + new ethereum.EventParam( + 'maxWrappableAmount', + ethereum.Value.fromUnsignedBigInt(BigInt.fromI64(maxWrappableAmount)) + ) + ); + event.block.timestamp = BigInt.fromI64(timestamp); + event.block.number = BigInt.fromI64(blockNumber); + return event; +} diff --git a/markets/spot-market/subgraph/tests/handleOrderCancelled.ts b/markets/spot-market/subgraph/tests/handleOrderCancelled.ts new file mode 100644 index 0000000000..4dcaae5f8a --- /dev/null +++ b/markets/spot-market/subgraph/tests/handleOrderCancelled.ts @@ -0,0 +1,6 @@ +import { assert, log } from 'matchstick-as'; + +export default function test(): void { + assert.entityCount('Order', 0); + log.error('NOT IMPLEMENTED', []); +} diff --git a/markets/spot-market/subgraph/tests/handleOrderCommitted.ts b/markets/spot-market/subgraph/tests/handleOrderCommitted.ts new file mode 100644 index 0000000000..4dcaae5f8a --- /dev/null +++ b/markets/spot-market/subgraph/tests/handleOrderCommitted.ts @@ -0,0 +1,6 @@ +import { assert, log } from 'matchstick-as'; + +export default function test(): void { + assert.entityCount('Order', 0); + log.error('NOT IMPLEMENTED', []); +} diff --git a/markets/spot-market/subgraph/tests/handleOrderSettled.ts b/markets/spot-market/subgraph/tests/handleOrderSettled.ts new file mode 100644 index 0000000000..4dcaae5f8a --- /dev/null +++ b/markets/spot-market/subgraph/tests/handleOrderSettled.ts @@ -0,0 +1,6 @@ +import { assert, log } from 'matchstick-as'; + +export default function test(): void { + assert.entityCount('Order', 0); + log.error('NOT IMPLEMENTED', []); +} diff --git a/markets/spot-market/subgraph/tests/handleSettlementStrategyAdded.ts b/markets/spot-market/subgraph/tests/handleSettlementStrategyAdded.ts new file mode 100644 index 0000000000..bd11b6cdf1 --- /dev/null +++ b/markets/spot-market/subgraph/tests/handleSettlementStrategyAdded.ts @@ -0,0 +1,6 @@ +import { assert, log } from 'matchstick-as'; + +export default function test(): void { + assert.entityCount('SettlementStrategy', 0); + log.error('NOT IMPLEMENTED', []); +} diff --git a/markets/spot-market/subgraph/tests/handleSettlementStrategyUpdated.ts b/markets/spot-market/subgraph/tests/handleSettlementStrategyUpdated.ts new file mode 100644 index 0000000000..bd11b6cdf1 --- /dev/null +++ b/markets/spot-market/subgraph/tests/handleSettlementStrategyUpdated.ts @@ -0,0 +1,6 @@ +import { assert, log } from 'matchstick-as'; + +export default function test(): void { + assert.entityCount('SettlementStrategy', 0); + log.error('NOT IMPLEMENTED', []); +} diff --git a/markets/spot-market/subgraph/tests/handleSynthPriceDataUpdated.ts b/markets/spot-market/subgraph/tests/handleSynthPriceDataUpdated.ts new file mode 100644 index 0000000000..72ed144249 --- /dev/null +++ b/markets/spot-market/subgraph/tests/handleSynthPriceDataUpdated.ts @@ -0,0 +1,35 @@ +import { assert, log } from 'matchstick-as'; +import { handleSynthPriceDataUpdated } from '../optimism-mainnet'; +import { createSynthPriceDataUpdatedEvent } from './event-factories/createSynthPriceDataUpdatedEvent'; + +export default function test(): void { + assert.entityCount('MarketInfo', 0); + + log.info('Should create a new MarketInfo for the event', []); + const buyFeedId1 = '0x4200000000000000000000000000000000000000'; + const sellfeedId1 = '0x6900000000000000000000000000000000000000'; + handleSynthPriceDataUpdated( + createSynthPriceDataUpdatedEvent(1, buyFeedId1, sellfeedId1, 10_000, 10, 1) + ); + + const id1 = '1'; + assert.entityCount('MarketInfo', 1); + assert.fieldEquals('MarketInfo', id1, 'id', id1); + assert.fieldEquals('MarketInfo', id1, 'marketId', '1'); + assert.fieldEquals('MarketInfo', id1, 'buyFeedId', buyFeedId1); + assert.fieldEquals('MarketInfo', id1, 'sellFeedId', sellfeedId1); + + log.info('Should update existing MarketInfo for the event', []); + const buyFeedId2 = '0x4200000000000000000000000000000000000069'; + const sellfeedId2 = '0x6900000000000000000000000000000000000069'; + handleSynthPriceDataUpdated( + createSynthPriceDataUpdatedEvent(1, buyFeedId2, sellfeedId2, 20_000, 20, 2) + ); + + const id2 = '1'; + assert.entityCount('MarketInfo', 1); + assert.fieldEquals('MarketInfo', id2, 'id', id2); + assert.fieldEquals('MarketInfo', id2, 'marketId', '1'); + assert.fieldEquals('MarketInfo', id2, 'buyFeedId', buyFeedId2); + assert.fieldEquals('MarketInfo', id2, 'sellFeedId', sellfeedId2); +} diff --git a/markets/spot-market/subgraph/tests/handleSynthUnWrapped.ts b/markets/spot-market/subgraph/tests/handleSynthUnWrapped.ts new file mode 100644 index 0000000000..3df7d2a85a --- /dev/null +++ b/markets/spot-market/subgraph/tests/handleSynthUnWrapped.ts @@ -0,0 +1,37 @@ +import { assert, log } from 'matchstick-as'; +import { handleSynthUnWrapped } from '../optimism-mainnet'; +import { createSynthUnWrappedEvent } from './event-factories/createSynthUnwrappedEvent'; + +const MOCK_EVENT_TXN = '0xa16081f360e3847006db660bae1c6d1b2e17ec2a'; + +export default function test(): void { + assert.entityCount('WrappSynth', 0); + + log.info('Should create a new record for the wrapped synth event', []); + handleSynthUnWrapped(createSynthUnWrappedEvent(69, 100, 1, 2, 3, 4, 420, 10_000, 10, 1)); + + const id1 = `${MOCK_EVENT_TXN}/1`; + assert.entityCount('WrappSynth', 1); + assert.fieldEquals('WrappSynth', id1, 'id', id1); + assert.fieldEquals('WrappSynth', id1, 'block', '10'); + assert.fieldEquals('WrappSynth', id1, 'timestamp', '10000'); + assert.fieldEquals('WrappSynth', id1, 'type', 'UnWrapped'); + assert.fieldEquals('WrappSynth', id1, 'marketId', '69'); + assert.fieldEquals('WrappSynth', id1, 'amount', '100'); + assert.fieldEquals('WrappSynth', id1, 'collectedFees', '420'); + assert.fieldEquals('WrappSynth', id1, 'wrapperFees', '4'); + + log.info('Should create another record for the same event', []); + handleSynthUnWrapped(createSynthUnWrappedEvent(69, 100, 1, 2, 3, 4, 420, 20_000, 20, 2)); + + const id2 = `${MOCK_EVENT_TXN}/2`; + assert.entityCount('WrappSynth', 2); + assert.fieldEquals('WrappSynth', id2, 'id', id2); + assert.fieldEquals('WrappSynth', id2, 'block', '20'); + assert.fieldEquals('WrappSynth', id2, 'timestamp', '20000'); + assert.fieldEquals('WrappSynth', id2, 'type', 'UnWrapped'); + assert.fieldEquals('WrappSynth', id2, 'marketId', '69'); + assert.fieldEquals('WrappSynth', id2, 'amount', '100'); + assert.fieldEquals('WrappSynth', id2, 'collectedFees', '420'); + assert.fieldEquals('WrappSynth', id2, 'wrapperFees', '4'); +} diff --git a/markets/spot-market/subgraph/tests/handleSynthWrapped.ts b/markets/spot-market/subgraph/tests/handleSynthWrapped.ts new file mode 100644 index 0000000000..3428405745 --- /dev/null +++ b/markets/spot-market/subgraph/tests/handleSynthWrapped.ts @@ -0,0 +1,37 @@ +import { assert, log } from 'matchstick-as'; +import { handleSynthWrapped } from '../optimism-mainnet'; +import { createSynthWrappedEvent } from './event-factories/createSynthWrappedEvent'; + +const MOCK_EVENT_TXN = '0xa16081f360e3847006db660bae1c6d1b2e17ec2a'; + +export default function test(): void { + assert.entityCount('WrappSynth', 0); + + log.info('Should create a new record for the wrapped synth event', []); + handleSynthWrapped(createSynthWrappedEvent(69, 100, 1, 2, 3, 4, 420, 10_000, 10, 1)); + + const id1 = `${MOCK_EVENT_TXN}/1`; + assert.entityCount('WrappSynth', 1); + assert.fieldEquals('WrappSynth', id1, 'id', id1); + assert.fieldEquals('WrappSynth', id1, 'block', '10'); + assert.fieldEquals('WrappSynth', id1, 'timestamp', '10000'); + assert.fieldEquals('WrappSynth', id1, 'type', 'Wrapped'); + assert.fieldEquals('WrappSynth', id1, 'marketId', '69'); + assert.fieldEquals('WrappSynth', id1, 'amount', '100'); + assert.fieldEquals('WrappSynth', id1, 'collectedFees', '420'); + assert.fieldEquals('WrappSynth', id1, 'wrapperFees', '4'); + + log.info('Should create another record for the same event', []); + handleSynthWrapped(createSynthWrappedEvent(69, 100, 1, 2, 3, 4, 420, 20_000, 20, 2)); + + const id2 = `${MOCK_EVENT_TXN}/2`; + assert.entityCount('WrappSynth', 2); + assert.fieldEquals('WrappSynth', id2, 'id', id2); + assert.fieldEquals('WrappSynth', id2, 'block', '20'); + assert.fieldEquals('WrappSynth', id2, 'timestamp', '20000'); + assert.fieldEquals('WrappSynth', id2, 'type', 'Wrapped'); + assert.fieldEquals('WrappSynth', id2, 'marketId', '69'); + assert.fieldEquals('WrappSynth', id2, 'amount', '100'); + assert.fieldEquals('WrappSynth', id2, 'collectedFees', '420'); + assert.fieldEquals('WrappSynth', id2, 'wrapperFees', '4'); +} diff --git a/markets/spot-market/subgraph/tests/handleWrapperSet.ts b/markets/spot-market/subgraph/tests/handleWrapperSet.ts new file mode 100644 index 0000000000..702bb0228c --- /dev/null +++ b/markets/spot-market/subgraph/tests/handleWrapperSet.ts @@ -0,0 +1,23 @@ +import { assert, log } from 'matchstick-as'; +import { handleWrapperSet } from '../optimism-mainnet'; +import { createWrapperSetEvent } from './event-factories/createWrapperSetEvent'; + +export default function test(): void { + assert.entityCount('Wrapper', 0); + + log.info('Should create a new record for the market', []); + const collateral1 = '0x4200000000000000000000000000000000000000'; + handleWrapperSet(createWrapperSetEvent(69, collateral1, 100500, 10_000, 10)); + assert.entityCount('Wrapper', 1); + assert.fieldEquals('Wrapper', '69', 'marketId', '69'); + assert.fieldEquals('Wrapper', '69', 'wrapCollateralType', collateral1); + assert.fieldEquals('Wrapper', '69', 'maxWrappableAmount', '100500'); + + log.info('Should update existing market', []); + const collateral2 = '0x6900000000000000000000000000000000000000'; + handleWrapperSet(createWrapperSetEvent(69, collateral2, 9999, 20_000, 20)); + assert.entityCount('Wrapper', 1); + assert.fieldEquals('Wrapper', '69', 'marketId', '69'); + assert.fieldEquals('Wrapper', '69', 'wrapCollateralType', collateral2); + assert.fieldEquals('Wrapper', '69', 'maxWrappableAmount', '9999'); +} diff --git a/markets/spot-market/test/SpotMarketFactory.test.ts b/markets/spot-market/test/SpotMarketFactory.test.ts index 42e4d59902..3c94925d81 100644 --- a/markets/spot-market/test/SpotMarketFactory.test.ts +++ b/markets/spot-market/test/SpotMarketFactory.test.ts @@ -1,4 +1,4 @@ -import { ethers as Ethers, ethers } from 'ethers'; +import { ethers as Ethers, constants, ethers } from 'ethers'; import { bn, bootstrapTraders, bootstrapWithSynth } from './bootstrap'; import assertRevert from '@synthetixio/core-utils/utils/assertions/assert-revert'; import assert from 'assert'; @@ -13,6 +13,7 @@ describe('SpotMarketFactory', () => { bootstrapWithSynth('Synthetic Ether', 'snxETH') ); // creates traders with USD + let registerTxn: ethers.providers.TransactionResponse, synthMarketId: ethers.BigNumber; let marketOwner: Ethers.Signer, user1: Ethers.Signer, newMarketOwner: Ethers.Signer; let synth: SynthRouter; @@ -37,18 +38,62 @@ describe('SpotMarketFactory', () => { }); }); + it('renounce market ownership by non-owner', async () => { + await assertRevert( + systems().SpotMarket.connect(user1).renounceMarketOwnership(marketId()), + 'OnlyMarketOwner' + ); + }); + + it('non owner tries to renounce market ownership', async () => { + await assertRevert( + systems().SpotMarket.connect(user1).renounceMarketOwnership(marketId()), + `OnlyMarketOwner(${await marketOwner.getAddress()}, ${await user1.getAddress()})` + ); + }); + + it('renounce market ownership by owner', async () => { + const tx = await systems() + .SpotMarket.connect(marketOwner) + .renounceMarketOwnership(marketId()); + await assertEvent( + tx, + `MarketOwnerChanged(${marketId()}, "${await marketOwner.getAddress()}", "${ + constants.AddressZero + }")`, + systems().SpotMarket + ); + + assert.deepEqual( + await systems().SpotMarket.getMarketOwner(marketId()), + constants.AddressZero + ); + }); + before('register synth', async () => { - await systems().SpotMarket.callStatic.createSynth( + synthMarketId = await systems().SpotMarket.callStatic.createSynth( + tokenName, + 'sBTC', + marketOwner.getAddress() + ); + registerTxn = await systems().SpotMarket.createSynth( tokenName, 'sBTC', marketOwner.getAddress() ); - await systems().SpotMarket.createSynth(tokenName, 'sBTC', marketOwner.getAddress()); }); it('check market name', async () => { assert.equal(await systems().SpotMarket.name(2), tokenName + ' Spot Market'); }); + + it('emits event', async () => { + await assertEvent( + registerTxn, + `SynthRegistered(2, "${await systems().SpotMarket.getSynth(synthMarketId)}")`, + systems().SpotMarket + ); + }); }); describe('upgrade synth', () => { @@ -113,7 +158,7 @@ describe('SpotMarketFactory', () => { }); }); - describe('transfering market ownership', () => { + describe('transferring market ownership', () => { it('nominateMarketOwner reverts if is not called by the market owner', async () => { await assertRevert( systems() diff --git a/markets/spot-market/test/bootstrap.ts b/markets/spot-market/test/bootstrap.ts index 6ed9a16edf..b0433ff120 100644 --- a/markets/spot-market/test/bootstrap.ts +++ b/markets/spot-market/test/bootstrap.ts @@ -1,19 +1,19 @@ import { snapshotCheckpoint } from '@synthetixio/core-utils/utils/mocha/snapshot'; -import { coreBootstrap } from '@synthetixio/router/dist/utils/tests'; import { bootstrapStakers, createStakedPool } from '@synthetixio/main/test/common'; -import { wei } from '@synthetixio/wei'; -import { BigNumber, ethers } from 'ethers'; -import { createOracleNode } from '@synthetixio/oracle-manager/test/common'; -import { FeeCollectorMock, SpotMarketProxy, SynthRouter } from './generated/typechain'; import { - USDProxy, + AccountProxy, CollateralMock, - USDRouter, CoreProxy, - AccountProxy, + USDProxy, + USDRouter, } from '@synthetixio/main/test/generated/typechain'; +import { createOracleNode } from '@synthetixio/oracle-manager/test/common'; import { Proxy as OracleManagerProxy } from '@synthetixio/oracle-manager/test/generated/typechain'; +import { coreBootstrap } from '@synthetixio/router/utils/tests'; +import { wei } from '@synthetixio/wei'; +import { BigNumber, ethers } from 'ethers'; import { AggregatorV3Mock, OracleVerifierMock } from '../typechain-types'; +import { FeeCollectorMock, SpotMarketProxy, SynthRouter } from './generated/typechain'; type Proxies = { ['synthetix.CoreProxy']: CoreProxy; diff --git a/package.json b/package.json index c36bf57735..5e191cdbf1 100644 --- a/package.json +++ b/package.json @@ -16,17 +16,18 @@ "scripts": { "clean": "yarn workspaces foreach --parallel --verbose run clean", "build-prerelease-dev": "git diff --exit-code && yarn lerna exec -- npm version prepatch --no-git-tag-version --no-workspaces-update && yarn && yarn build && git stash && yarn", - "build": "yarn workspaces foreach --topological-dev --verbose run build", - "test": "yarn workspaces foreach --parallel --verbose run test", + "build": "CANNON_REGISTRY_PRIORITY=local yarn workspaces foreach --topological-dev --verbose run build", + "test": "CANNON_REGISTRY_PRIORITY=local yarn workspaces foreach --parallel --verbose run test", "coverage": "yarn workspaces foreach --verbose run coverage", "lint:progress": "ESLINT_PROGRESS=true eslint --max-warnings=0 .", - "lint:js": "prettier --check '**/*.{t,j}s' && eslint --max-warnings=0 '**/*.{t,j}s'", - "lint:js:fix": "prettier --write '**/*.{t,j}s' && eslint --max-warnings=0 --fix '**/*.{t,j}s'", - "lint:sol": "prettier --check '(protocol|utils|markets)/**/*.sol' && solhint utils/*/contracts/**/*.sol protocol/*/contracts/**/*.sol markets/*/contracts/**/*.sol", - "lint:sol:fix": "prettier --write '(protocol|utils|markets)/**/*.sol' && solhint --fix utils/*/contracts/**/*.sol protocol/*/contracts/**/*.sol markets/*/contracts/**/*.sol", - "lint:quick": "pretty-quick --check --staged --pattern '**/*.(js|ts|sol)'", - "lint:fix": "yarn lint:js:fix && yarn lint:sol:fix", - "lint": "yarn lint:js && yarn lint:sol", + "lint:js": "eslint --max-warnings=0 .", + "lint:js:fix": "eslint --max-warnings=0 --fix .", + "lint:sol": "solhint utils/*/contracts/**/*.sol protocol/*/contracts/**/*.sol markets/*/contracts/**/*.sol", + "lint:sol:fix": "solhint --fix utils/*/contracts/**/*.sol protocol/*/contracts/**/*.sol markets/*/contracts/**/*.sol", + "pretty:fix": "prettier --write --ignore-unknown '**/*'", + "pretty": "prettier --check --ignore-unknown '**/*'", + "lint:fix": "yarn pretty:fix && yarn lint:js:fix && yarn lint:sol:fix", + "lint": "yarn pretty && yarn lint:js && yarn lint:sol", "deps": "deps", "deps:fix": "deps --fix", "deps:mismatched": "deps-mismatched", @@ -39,39 +40,59 @@ "prepublishOnly": "node ./prepublishOnly.js", "docgen:contracts": "yarn workspaces foreach --verbose run docgen && yarn workspace @synthetixio/docgen run docgen:contracts", "docgen:abis": "yarn workspace @synthetixio/docgen run docgen:abis", - "subgraphgen": "yarn workspaces foreach --verbose run subgraphgen" + "subgraphgen": "yarn workspaces foreach --verbose run subgraphgen", + "check-staged": "lint-staged" }, "devDependencies": { "@ethersproject/abi": "^5.7.0", - "@ethersproject/providers": "^5.0.0", + "@ethersproject/providers": "^5.7.2", "@lerna-lite/cli": "1.17.0", "@lerna-lite/exec": "1.17.0", "@nomiclabs/hardhat-ethers": "^2.2.3", "@synthetixio/deps": "workspace:*", - "@types/mocha": "10.0.1", - "@types/node": "18.11.10", - "@typescript-eslint/eslint-plugin": "5.45.0", - "@typescript-eslint/parser": "5.45.0", - "@usecannon/cli": "^2.5.1", - "eslint": "8.29.0", - "eslint-config-prettier": "8.5.0", - "eslint-plugin-no-only-tests": "3.1.0", - "mocha": "10.2.0", - "mocha-junit-reporter": "2.2.1", - "pre-commit": "1.2.2", - "prettier": "^2.8.8", - "prettier-plugin-solidity": "1.0.0", - "pretty-quick": "3.1.3", - "solhint": "3.3.7", - "solhint-plugin-numcast": "1.0.0", - "typescript": "4.9.3" + "@types/mocha": "^10.0.1", + "@types/node": "^18.16.0", + "@typescript-eslint/eslint-plugin": "^5.45.0", + "@typescript-eslint/parser": "^5.45.0", + "@usecannon/cli": "^2.7.1", + "eslint": "^8.29.0", + "eslint-plugin-no-only-tests": "^3.1.0", + "lint-staged": "^14.0.1", + "mocha": "^10.2.0", + "mocha-junit-reporter": "^2.2.1", + "pre-commit": "^1.2.2", + "prettier": "^3.0.3", + "prettier-plugin-solidity": "^1.1.3", + "prettier-plugin-toml": "^1.0.0", + "solhint": "^3.3.7", + "solhint-plugin-numcast": "^1.0.0", + "typescript": "^4.9.3" }, "resolutions": { "hardhat-gas-reporter/eth-gas-reporter": "git://github.com/dbeal-eth/eth-gas-reporter.git#fix-catch-errors" }, "pre-commit": [ - "lint:quick" + "check-staged" ], + "lint-staged": { + "*.js": [ + "prettier --check", + "eslint --max-warnings=0" + ], + "*.ts": [ + "prettier --check", + "eslint --max-warnings=0" + ], + "*.sol": [ + "prettier --check", + "solhint" + ], + "*.toml": "prettier --check", + "*.yml": "prettier --check", + "*.yaml": "prettier --check", + "*.json": "prettier --check", + "*.md": "prettier --check" + }, "workspaces": [ "utils/**", "protocol/**", diff --git a/protocol/governance/cannonfile.toml b/protocol/governance/cannonfile.toml index b9afc08615..bb36846806 100644 --- a/protocol/governance/cannonfile.toml +++ b/protocol/governance/cannonfile.toml @@ -37,8 +37,6 @@ salt = "<%= settings.salt %>" abiOf = ["InitialModuleBundle"] create2 = true -depends = ["contract.InitialModuleBundle"] - [contract.AssociatedSystemsModule] artifact = "contracts/modules/core/AssociatedSystemsModule.sol:AssociatedSystemsModule" @@ -56,17 +54,10 @@ artifact = "DebtShareMock" [router.CoreRouter] contracts = [ - "AssociatedSystemsModule", - "ElectionModule", - "ElectionInspectorModule", - "InitialModuleBundle", -] - -depends = [ - "contract.AssociatedSystemsModule", - "contract.ElectionModule", - "contract.ElectionInspectorModule", - "contract.InitialModuleBundle", + "AssociatedSystemsModule", + "ElectionModule", + "ElectionInspectorModule", + "InitialModuleBundle", ] [invoke.upgrade_core_proxy] @@ -77,34 +68,22 @@ args = ["<%= contracts.CoreRouter.address %>"] factory.CoreProxy.abiOf = ["CoreRouter"] factory.CoreProxy.event = "Upgraded" factory.CoreProxy.arg = 0 -depends = ["contract.InitialProxy", "router.CoreRouter"] [router.CouncilTokenRouter] -contracts = [ - "CouncilTokenModule", - "InitialModuleBundle", -] - -depends = [ - "contract.CouncilTokenModule", - "contract.InitialModuleBundle" -] +contracts = ["CouncilTokenModule", "InitialModuleBundle"] [invoke.init_council_token] target = ["CoreProxy"] from = "<%= settings.owner %>" func = "initOrUpgradeNft" args = [ - "<%= formatBytes32String('councilToken') %>", - "Synthetix Governance Token", - "SNXGOV", - "https://synthetix.io", - "<%= contracts.CouncilTokenRouter.address %>" -] -depends = [ - "invoke.upgrade_core_proxy", - "router.CouncilTokenRouter" + "<%= formatBytes32String('councilToken') %>", + "Synthetix Governance Token", + "SNXGOV", + "https://synthetix.io", + "<%= contracts.CouncilTokenRouter.address %>" ] +depends = ["invoke.upgrade_core_proxy", "router.CouncilTokenRouter"] factory.AccountProxy.abiOf = ["CouncilTokenRouter"] factory.AccountProxy.event = "AssociatedSystemSet" factory.AccountProxy.arg = 2 @@ -113,13 +92,11 @@ factory.AccountProxy.arg = 2 target = ["CoreProxy"] func = "initOrUpgradeElectionModule(address[],uint8,uint64,uint64,uint64,address)" args = [ - ["<%= settings.init_council_member %>"], - "1", - "<%= settings.epoch_start %>", - "<%= settings.epoch_start + 86400 * settings.voting_period_duration %>", - "<%= settings.epoch_start + 86400 * settings.epoch_duration %>", - "<%= contracts.DebtShareMock.address %>", + ["<%= settings.init_council_member %>"], + "1", + "<%= settings.epoch_start %>", + "<%= settings.epoch_start + 86400 * settings.voting_period_duration %>", + "<%= settings.epoch_start + 86400 * settings.epoch_duration %>", + "<%= contracts.DebtShareMock.address %>", ] from = "<%= settings.owner %>" - -depends = ["invoke.init_council_token", "contract.DebtShareMock"] diff --git a/protocol/governance/package.json b/protocol/governance/package.json index 2c9e0c540a..1dfb6689a6 100644 --- a/protocol/governance/package.json +++ b/protocol/governance/package.json @@ -17,8 +17,8 @@ "@synthetixio/core-modules": "workspace:*", "@synthetixio/core-utils": "workspace:*", "@synthetixio/docgen": "workspace:*", - "@synthetixio/router": "^3.1.3", - "hardhat": "2.15.0", + "@synthetixio/router": "^3.3.0", + "hardhat": "2.17.2", "solidity-docgen": "0.6.0-beta.35" } } diff --git a/protocol/governance/test/contracts/modules/ElectionModule/Elections.test.js b/protocol/governance/test/contracts/modules/ElectionModule/Elections.test.js index 6ba195e66e..f9a70e889b 100644 --- a/protocol/governance/test/contracts/modules/ElectionModule/Elections.test.js +++ b/protocol/governance/test/contracts/modules/ElectionModule/Elections.test.js @@ -3,7 +3,7 @@ const assert = require('assert/strict'); const assertBn = require('@synthetixio/core-utils/utils/assertions/assert-bignumber'); const assertRevert = require('@synthetixio/core-utils/utils/assertions/assert-revert'); -const { bootstrap } = require('@synthetixio/router/dist/utils/tests'); +const { bootstrap } = require('@synthetixio/router/utils/tests'); const initializer = require('@synthetixio/core-modules/test/helpers/initializer'); const { getTime, diff --git a/protocol/governance/test/contracts/modules/ElectionModule/Initialize.test.js b/protocol/governance/test/contracts/modules/ElectionModule/Initialize.test.js index 7da59e1233..c7d6e9b80c 100644 --- a/protocol/governance/test/contracts/modules/ElectionModule/Initialize.test.js +++ b/protocol/governance/test/contracts/modules/ElectionModule/Initialize.test.js @@ -3,7 +3,7 @@ const assert = require('assert/strict'); const assertRevert = require('@synthetixio/core-utils/utils/assertions/assert-revert'); const { daysToSeconds } = require('@synthetixio/core-utils/utils/misc/dates'); const { getTime } = require('@synthetixio/core-utils/utils/hardhat/rpc'); -const { bootstrap } = require('@synthetixio/router/dist/utils/tests'); +const { bootstrap } = require('@synthetixio/router/utils/tests'); const initializer = require('@synthetixio/core-modules/test/helpers/initializer'); describe('SynthetixElectionModule (initialization)', () => { diff --git a/protocol/governance/test/contracts/modules/UpgradeModule.test.js b/protocol/governance/test/contracts/modules/UpgradeModule.test.js index c9c3621472..f9ca82cdda 100644 --- a/protocol/governance/test/contracts/modules/UpgradeModule.test.js +++ b/protocol/governance/test/contracts/modules/UpgradeModule.test.js @@ -1,7 +1,7 @@ const assert = require('assert/strict'); const assertRevert = require('@synthetixio/core-utils/utils/assertions/assert-revert'); -const { bootstrap } = require('@synthetixio/router/dist/utils/tests'); +const { bootstrap } = require('@synthetixio/router/utils/tests'); const initializer = require('@synthetixio/core-modules/test/helpers/initializer'); const { ethers } = hre; diff --git a/protocol/oracle-manager/cannonfile.test.toml b/protocol/oracle-manager/cannonfile.test.toml index f01e530791..7a0acdfaad 100644 --- a/protocol/oracle-manager/cannonfile.test.toml +++ b/protocol/oracle-manager/cannonfile.test.toml @@ -1,5 +1,2 @@ version = "<%= package.version %>-testable" - -include = [ - "cannonfile.toml" -] +include = ["cannonfile.toml"] diff --git a/protocol/oracle-manager/cannonfile.toml b/protocol/oracle-manager/cannonfile.toml index 256d31e337..f9cf248d62 100644 --- a/protocol/oracle-manager/cannonfile.toml +++ b/protocol/oracle-manager/cannonfile.toml @@ -26,14 +26,8 @@ salt = "<%= settings.salt %>" abiOf = ["CoreModule"] create2 = true -depends = ["contract.CoreModule"] - [router.OracleRouter] contracts = ["CoreModule", "NodeModule"] -depends = [ - "contract.CoreModule", - "contract.NodeModule" -] [invoke.upgrade_proxy] target = ["InitialProxy"] @@ -43,4 +37,3 @@ args = ["<%= contracts.OracleRouter.address %>"] factory.Proxy.abiOf = ["OracleRouter"] factory.Proxy.event = "Upgraded" factory.Proxy.arg = 0 -depends = ["contract.InitialProxy", "router.OracleRouter"] diff --git a/protocol/oracle-manager/contracts/interfaces/INodeModule.sol b/protocol/oracle-manager/contracts/interfaces/INodeModule.sol index 89558f8642..eedb18d378 100644 --- a/protocol/oracle-manager/contracts/interfaces/INodeModule.sol +++ b/protocol/oracle-manager/contracts/interfaces/INodeModule.sol @@ -74,4 +74,17 @@ interface INodeModule { * @return node The node's output data */ function process(bytes32 nodeId) external view returns (NodeOutput.Data memory node); + + /** + * @notice Returns a node current output data + * @param nodeId The node ID + * @param runtimeKeys Keys corresponding to runtime values which could be used by the node graph + * @param runtimeValues The values used by the node graph + * @return node The node's output data + */ + function processWithRuntime( + bytes32 nodeId, + bytes32[] memory runtimeKeys, + bytes32[] memory runtimeValues + ) external view returns (NodeOutput.Data memory node); } diff --git a/protocol/oracle-manager/contracts/interfaces/external/IExternalNode.sol b/protocol/oracle-manager/contracts/interfaces/external/IExternalNode.sol index 8ce8089425..275a629d15 100644 --- a/protocol/oracle-manager/contracts/interfaces/external/IExternalNode.sol +++ b/protocol/oracle-manager/contracts/interfaces/external/IExternalNode.sol @@ -10,7 +10,9 @@ import "../../storage/NodeDefinition.sol"; interface IExternalNode is IERC165 { function process( NodeOutput.Data[] memory parentNodeOutputs, - bytes memory parameters + bytes memory parameters, + bytes32[] memory runtimeKeys, + bytes32[] memory runtimeValues ) external view returns (NodeOutput.Data memory); function isValid(NodeDefinition.Data memory nodeDefinition) external returns (bool); diff --git a/protocol/oracle-manager/contracts/mocks/MockExternalNode.sol b/protocol/oracle-manager/contracts/mocks/MockExternalNode.sol index 1233f17c21..bcc22d029a 100644 --- a/protocol/oracle-manager/contracts/mocks/MockExternalNode.sol +++ b/protocol/oracle-manager/contracts/mocks/MockExternalNode.sol @@ -13,9 +13,19 @@ contract MockExternalNode is IExternalNode { function process( NodeOutput.Data[] memory, - bytes memory + bytes memory, + bytes32[] memory runtimeKeys, + bytes32[] memory runtimeValues ) external view override returns (NodeOutput.Data memory) { - return output; + NodeOutput.Data memory theOutput = output; + + for (uint256 i = 0; i < runtimeKeys.length; i++) { + if (runtimeKeys[i] == "overridePrice") { + // solhint-disable-next-line numcast/safe-cast + theOutput.price = int256(uint256(runtimeValues[i])); + } + } + return theOutput; } function isValid( @@ -24,11 +34,7 @@ contract MockExternalNode is IExternalNode { return nodeDefinition.nodeType == NodeDefinition.NodeType.EXTERNAL; } - function supportsInterface( - bytes4 interfaceId - ) public view virtual override(IERC165) returns (bool) { - return - interfaceId == type(IExternalNode).interfaceId || - interfaceId == this.supportsInterface.selector; + function supportsInterface(bytes4) public view virtual override(IERC165) returns (bool) { + return true; } } diff --git a/protocol/oracle-manager/contracts/modules/NodeModule.sol b/protocol/oracle-manager/contracts/modules/NodeModule.sol index 115cde6aad..c09e096f19 100644 --- a/protocol/oracle-manager/contracts/modules/NodeModule.sol +++ b/protocol/oracle-manager/contracts/modules/NodeModule.sol @@ -14,6 +14,8 @@ import "../nodes/ConstantNode.sol"; import "../storage/NodeOutput.sol"; import "../storage/NodeDefinition.sol"; +import "@synthetixio/core-contracts/contracts/errors/ParameterError.sol"; + /** * @title Module for managing nodes * @dev See INodeModule. @@ -64,7 +66,18 @@ contract NodeModule is INodeModule { * @inheritdoc INodeModule */ function process(bytes32 nodeId) external view returns (NodeOutput.Data memory node) { - return _process(nodeId); + return _process(nodeId, new bytes32[](0), new bytes32[](0)); + } + + /** + * @inheritdoc INodeModule + */ + function processWithRuntime( + bytes32 nodeId, + bytes32[] memory runtimeKeys, + bytes32[] memory runtimeValues + ) external view returns (NodeOutput.Data memory node) { + return _process(nodeId, runtimeKeys, runtimeValues); } /** @@ -135,7 +148,18 @@ contract NodeModule is INodeModule { /** * @dev Returns the output of a specified node. */ - function _process(bytes32 nodeId) internal view returns (NodeOutput.Data memory price) { + function _process( + bytes32 nodeId, + bytes32[] memory runtimeKeys, + bytes32[] memory runtimeValues + ) internal view returns (NodeOutput.Data memory price) { + if (runtimeKeys.length != runtimeValues.length) { + revert ParameterError.InvalidParameter( + "runtimeValues", + "must be same length as runtimeKeys" + ); + } + NodeDefinition.Data memory nodeDefinition = NodeDefinition.load(nodeId); if (nodeDefinition.nodeType == NodeDefinition.NodeType.REDUCER) { @@ -148,7 +172,9 @@ contract NodeModule is INodeModule { return ExternalNode.process( _processParentNodeOutputs(nodeDefinition), - nodeDefinition.parameters + nodeDefinition.parameters, + runtimeKeys, + runtimeValues ); } else if (nodeDefinition.nodeType == NodeDefinition.NodeType.CHAINLINK) { return ChainlinkNode.process(nodeDefinition.parameters); diff --git a/protocol/oracle-manager/contracts/nodes/ExternalNode.sol b/protocol/oracle-manager/contracts/nodes/ExternalNode.sol index 3441bc64b9..2a102ea1be 100644 --- a/protocol/oracle-manager/contracts/nodes/ExternalNode.sol +++ b/protocol/oracle-manager/contracts/nodes/ExternalNode.sol @@ -10,10 +10,12 @@ import "../interfaces/external/IExternalNode.sol"; library ExternalNode { function process( NodeOutput.Data[] memory prices, - bytes memory parameters + bytes memory parameters, + bytes32[] memory runtimeKeys, + bytes32[] memory runtimeValues ) internal view returns (NodeOutput.Data memory nodeOutput) { IExternalNode externalNode = IExternalNode(abi.decode(parameters, (address))); - return externalNode.process(prices, parameters); + return externalNode.process(prices, parameters, runtimeKeys, runtimeValues); } function isValid(NodeDefinition.Data memory nodeDefinition) internal returns (bool valid) { diff --git a/protocol/oracle-manager/package.json b/protocol/oracle-manager/package.json index 8baad67bbe..b62bbced0b 100644 --- a/protocol/oracle-manager/package.json +++ b/protocol/oracle-manager/package.json @@ -6,17 +6,17 @@ "access": "public" }, "scripts": { - "test": "hardhat test", + "test": "CANNON_REGISTRY_PRIORITY=local hardhat test", "coverage": "hardhat coverage --network hardhat", "clean": "hardhat clean", "build": "yarn build:contracts", "build:contracts": "hardhat storage:verify && hardhat cannon:build", - "build-testable": "hardhat cannon:build cannonfile.test.toml", + "build-testable": "CANNON_REGISTRY_PRIORITY=local hardhat cannon:build cannonfile.test.toml", "check:storage": "git diff --exit-code storage.dump.sol", "compile-contracts": "hardhat compile", "size-contracts": "hardhat compile && hardhat size-contracts", - "publish-contracts": "yarn build && cannon publish oracle-manager:$(node -p 'require(`./package.json`).version') --quiet", - "postpack": "yarn publish-contracts", + "publish-contracts": "cannon publish oracle-manager:$(node -p 'require(`./package.json`).version') --chain-id 13370 --quiet --tags $(node -p '/^\\d+\\.\\d+\\.\\d+$/.test(require(`./package.json`).version) ? `latest` : `dev`')", + "postpack": "yarn build && yarn publish-contracts", "docgen": "hardhat docgen" }, "keywords": [], @@ -28,14 +28,14 @@ "@synthetixio/core-modules": "workspace:*", "@synthetixio/core-utils": "workspace:*", "@synthetixio/docgen": "workspace:*", - "@synthetixio/router": "^3.1.3", + "@synthetixio/router": "^3.3.0", "@synthetixio/wei": "2.74.4", - "@types/node": "18.11.10", + "@types/node": "^18.16.0", "ethers": "^5.7.2", - "hardhat": "2.15.0", + "hardhat": "2.17.2", "solidity-docgen": "0.6.0-beta.35", "ts-node": "10.9.1", - "typescript": "4.9.3" + "typescript": "^4.9.3" }, - "gitHead": "af79d976af56150c628a885cc94a94f5bcc2c862" + "gitHead": "ba5a9730df248cd1999b5a6fd1bf67b307b95eec" } diff --git a/protocol/oracle-manager/test/integration/bootstrap.ts b/protocol/oracle-manager/test/integration/bootstrap.ts index bd8775fc13..bdb5a71597 100644 --- a/protocol/oracle-manager/test/integration/bootstrap.ts +++ b/protocol/oracle-manager/test/integration/bootstrap.ts @@ -1,9 +1,9 @@ -import { coreBootstrap } from '@synthetixio/router/dist/utils/tests'; +import { coreBootstrap } from '@synthetixio/router/utils/tests'; +import { wei } from '@synthetixio/wei'; import { ethers } from 'ethers'; import hre from 'hardhat'; import { NodeModule } from '../generated/typechain'; import NodeTypes from './mixins/Node.types'; -import { wei } from '@synthetixio/wei'; const abi = ethers.utils.defaultAbiCoder; diff --git a/protocol/oracle-manager/test/integration/nodes/ExternalNode.test.ts b/protocol/oracle-manager/test/integration/nodes/ExternalNode.test.ts index 6eb7f1ac15..bb5e524274 100644 --- a/protocol/oracle-manager/test/integration/nodes/ExternalNode.test.ts +++ b/protocol/oracle-manager/test/integration/nodes/ExternalNode.test.ts @@ -46,6 +46,39 @@ describe('ExternalNode', function () { assertBn.equal(output.timestamp, timestamp); }); + it('works with runtimeKeys and runtimeValues', async () => { + const [owner] = getSigners(); + const price = 100; + const timestamp = 200; + + // Deploy the mock + const factory = await hre.ethers.getContractFactory('MockExternalNode'); + const ValidExternalNode = await factory.connect(owner).deploy(price, timestamp); + + // Register the mock + const NodeParameters = abi.encode(['address'], [ValidExternalNode.address]); + const tx = await NodeModule.registerNode(NodeTypes.EXTERNAL, NodeParameters, []); + const receipt = await tx.wait(); + const event = findSingleEvent({ + receipt, + eventName: 'NodeRegistered', + }); + + // Verify the registration event data + const nodeId = event.args.nodeId; + assert.equal(event.args.nodeType, NodeTypes.EXTERNAL); + assert.equal(event.args.parameters, NodeParameters); + + // Verify the node processes output as expected + const output = await NodeModule.processWithRuntime( + nodeId, + [ethers.utils.formatBytes32String('overridePrice')], + [ethers.utils.hexZeroPad(ethers.BigNumber.from('100').toHexString(), 32)] + ); + assertBn.equal(output.price, ethers.BigNumber.from('100')); + assertBn.equal(output.timestamp, timestamp); + }); + it('cannot be registered if it does not conform to the IExternalNode interface.', async () => { const [owner] = getSigners(); const factory = await hre.ethers.getContractFactory('MockChainlinkAggregator'); diff --git a/protocol/synthetix/cannonfile.test.toml b/protocol/synthetix/cannonfile.test.toml index 7a88323967..d13bc1db85 100644 --- a/protocol/synthetix/cannonfile.test.toml +++ b/protocol/synthetix/cannonfile.test.toml @@ -1,10 +1,10 @@ # overrides to create a testable deployment of the core system - version = "<%= package.version %>-testable" +include = ["cannonfile.toml"] -include = [ - "cannonfile.toml" -] +# use the testable oracle manager +[setting.oracle_manager_source] +defaultValue = "oracle-manager:<%= package.version %>-testable" # Test Modules [contract.TestableAccountStorage] @@ -164,8 +164,7 @@ salt = "2" [invoke.intializeCollateralMock] target = ["CollateralMock"] func = "initialize" -args = ["SampleToken","TKN","18"] -depends = ["contract.CollateralMock"] +args = ["SampleToken", "TKN", "18"] [invoke.enableAllFeatures] target = ["CoreProxy"] diff --git a/protocol/synthetix/cannonfile.toml b/protocol/synthetix/cannonfile.toml index e3eb6e8aaf..dc2c296b28 100644 --- a/protocol/synthetix/cannonfile.toml +++ b/protocol/synthetix/cannonfile.toml @@ -155,7 +155,6 @@ args = ["<%= contracts.InitialModuleBundle.address %>", "<%= settings.owner %>"] abiOf = ["InitialModuleBundle"] salt = "<%= settings.salt %>" create2 = true -depends = ["contract.InitialModuleBundle"] [invoke.upgrade_core_proxy] target = ["InitialCoreProxy"] @@ -163,57 +162,31 @@ abi = "UpgradeModule" fromCall.func = "owner" func = "upgradeTo" args = ["<%= contracts.CoreRouter.address %>"] - factory.CoreProxy.abiOf = ["CoreRouter"] factory.CoreProxy.event = "Upgraded" factory.CoreProxy.arg = 0 -depends = [ - "contract.InitialCoreProxy", - "router.CoreRouter" -] - # Account [router.AccountRouter] -contracts = [ - "InitialModuleBundle", - "AccountTokenModule", -] -depends = [ - "contract.InitialModuleBundle", - "contract.AccountTokenModule" -] +contracts = ["InitialModuleBundle", "AccountTokenModule"] # USD [router.USDRouter] -contracts = [ - "InitialModuleBundle", - "AssociatedSystemsModule", - "USDTokenModule" -] -depends = [ - "contract.InitialModuleBundle", - "contract.AssociatedSystemsModule", - "contract.USDTokenModule" -] +contracts = ["InitialModuleBundle", "AssociatedSystemsModule", "USDTokenModule"] # Post stuff - [invoke.init_account] target = ["CoreProxy"] fromCall.func = "owner" func = "initOrUpgradeNft" args = [ - "0x6163636f756e744e667400000000000000000000000000000000000000000000", - "Synthetix Account", - "SACCT", - "https://synthetix.io", - "<%= contracts.AccountRouter.address %>" -] -depends = [ - "invoke.upgrade_core_proxy", - "router.AccountRouter" + "0x6163636f756e744e667400000000000000000000000000000000000000000000", + "Synthetix Account", + "SACCT", + "https://synthetix.io", + "<%= contracts.AccountRouter.address %>" ] +depends = ["invoke.upgrade_core_proxy", "router.AccountRouter"] factory.AccountProxy.abiOf = ["AccountRouter"] factory.AccountProxy.event = "AssociatedSystemSet" factory.AccountProxy.arg = 2 @@ -223,16 +196,13 @@ target = ["CoreProxy"] fromCall.func = "owner" func = "initOrUpgradeToken" args = [ - "0x555344546f6b656e000000000000000000000000000000000000000000000000", - "Synthetic USD Token v3", - "snxUSD", - 18, - "<%= contracts.USDRouter.address %>" -] -depends = [ - "invoke.upgrade_core_proxy", - "router.USDRouter" + "0x555344546f6b656e000000000000000000000000000000000000000000000000", + "Synthetic USD Token v3", + "snxUSD", + 18, + "<%= contracts.USDRouter.address %>" ] +depends = ["invoke.upgrade_core_proxy", "router.USDRouter"] factory.USDProxy.abiOf = ["USDRouter"] factory.USDProxy.event = "AssociatedSystemSet" factory.USDProxy.arg = 2 @@ -241,34 +211,30 @@ factory.USDProxy.arg = 2 target = ["CoreProxy"] fromCall.func = "owner" func = "configureOracleManager" -args = [ - "<%= imports.oracle_manager.contracts.Proxy.address %>", -] -depends = ["invoke.upgrade_core_proxy", "provision.oracle_manager"] +args = ["<%= imports.oracle_manager.contracts.Proxy.address %>"] [invoke.enable_basic_features] target = ["CoreProxy"] fromCall.func = "owner" func = "multicall" -args = [[ - # for all the below functions, "0x7d632bd2" is the selector for "setFeatureFlagAllowAll(bytes32,bool)" - "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('createAccount'), true]).slice(2) %>", - "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('deposit'), true]).slice(2) %>", - "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('withdraw'), true]).slice(2) %>", - "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('mintUsd'), true]).slice(2) %>", - "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('burnUsd'), true]).slice(2) %>", - "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('liquidate'), true]).slice(2) %>", - "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('liquidateVault'), true]).slice(2) %>", - "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('depositMarketCollateral'), true]).slice(2) %>", - "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('withdrawMarketCollateral'), true]).slice(2) %>", - "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('depositMarketUsd'), true]).slice(2) %>", - "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('withdrawMarketUsd'), true]).slice(2) %>", - "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('claimRewards'), true]).slice(2) %>", - "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('delegateCollateral'), true]).slice(2) %>", -]] - -depends = ["invoke.upgrade_core_proxy"] - +args = [ + [ + # for all the below functions, "0x7d632bd2" is the selector for "setFeatureFlagAllowAll(bytes32,bool)" + "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('createAccount'), true]).slice(2) %>", + "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('deposit'), true]).slice(2) %>", + "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('withdraw'), true]).slice(2) %>", + "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('mintUsd'), true]).slice(2) %>", + "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('burnUsd'), true]).slice(2) %>", + "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('liquidate'), true]).slice(2) %>", + "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('liquidateVault'), true]).slice(2) %>", + "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('depositMarketCollateral'), true]).slice(2) %>", + "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('withdrawMarketCollateral'), true]).slice(2) %>", + "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('depositMarketUsd'), true]).slice(2) %>", + "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('withdrawMarketUsd'), true]).slice(2) %>", + "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('claimRewards'), true]).slice(2) %>", + "0x7d632bd2<%= defaultAbiCoder.encode(['bytes32', 'bool'], [formatBytes32String('delegateCollateral'), true]).slice(2) %>", + ] +] [invoke.register_const_one_oracle] target = ["oracle_manager.Proxy"] @@ -279,22 +245,14 @@ args = [ "<%= defaultAbiCoder.encode(['uint256'], [parseEther('1')]) %>", [] ] - extra.const_one_oracle_id.event = "NodeRegistered" extra.const_one_oracle_id.arg = 0 -depends = [ - "provision.oracle_manager" -] - # we register USD as a collateral type because it is useful to treat it the same way as any other collateral [invoke.configure_usd_collateral] target = ["CoreProxy"] fromCall.func = "owner" func = "configureCollateral" - args = [ - { tokenAddress = "<%= contracts.USDProxy.address %>", oracleNodeId = "<%= extras.const_one_oracle_id %>", issuanceRatioD18 = "<%= parseEther('10') %>", liquidationRatioD18 = "<%= parseEther('10') %>", liquidationRewardD18 = "0", minDelegationD18 = "<%= MaxUint256 %>", depositingEnabled = false } + { tokenAddress = "<%= contracts.USDProxy.address %>", oracleNodeId = "<%= extras.const_one_oracle_id %>", issuanceRatioD18 = "<%= parseEther('10') %>", liquidationRatioD18 = "<%= parseEther('10') %>", liquidationRewardD18 = "0", minDelegationD18 = "<%= MaxUint256 %>", depositingEnabled = true } ] - -depends = ["invoke.register_const_one_oracle", "invoke.init_usd"] diff --git a/protocol/synthetix/contracts/interfaces/IMarketManagerModule.sol b/protocol/synthetix/contracts/interfaces/IMarketManagerModule.sol index a4ae176ebc..e56950890f 100644 --- a/protocol/synthetix/contracts/interfaces/IMarketManagerModule.sol +++ b/protocol/synthetix/contracts/interfaces/IMarketManagerModule.sol @@ -133,6 +133,13 @@ interface IMarketManagerModule { uint128 marketId ) external view returns (uint256 withdrawableD18); + /** + * @notice Returns the contract address for the specified market. + * @param marketId The id of the market + * @return marketAddress The contract address for the specified market + */ + function getMarketAddress(uint128 marketId) external view returns (address marketAddress); + /** * @notice Returns the net issuance of the specified market (snxUSD withdrawn - snxUSD deposited). * @param marketId The id of the market whose net issuance is being queried. diff --git a/protocol/synthetix/contracts/interfaces/IMulticallModule.sol b/protocol/synthetix/contracts/interfaces/IMulticallModule.sol index 6760472dc4..f7ef410e22 100644 --- a/protocol/synthetix/contracts/interfaces/IMulticallModule.sol +++ b/protocol/synthetix/contracts/interfaces/IMulticallModule.sol @@ -5,13 +5,16 @@ pragma solidity >=0.8.11 <0.9.0; * @title Module that enables calling multiple methods of the system in a single transaction. */ interface IMulticallModule { + error RecursiveMulticall(address); + error DeniedMulticallTarget(address); + /** * @notice Executes multiple transaction payloads in a single transaction. * @dev Each transaction is executed using `delegatecall`, and targets the system address. * @param data Array of calldata objects, one for each function that is to be called in the system. * @return results Array of each `delegatecall`'s response corresponding to the incoming calldata array. */ - function multicall(bytes[] calldata data) external payable returns (bytes[] memory results); + function multicall(bytes[] calldata data) external returns (bytes[] memory results); /** * @notice Similar to `multicall`, but allows for transactions to be executed @@ -21,10 +24,22 @@ interface IMulticallModule { * @dev Fails immediately on revert of any call. * @return results Array of each call's response corresponding */ - /*function multicallThrough( + function multicallThrough( address[] calldata to, - bytes[] calldata data + bytes[] calldata data, + uint256[] calldata values ) external payable returns (bytes[] memory results); - function getMessageSender() external view returns (address);*/ + /** + * @notice Permit the given target to be called through `multicallThrough`. + * @dev This function can only be called by the system owner. + * @param target The address of the contract to alter permissions + * @param allowlisted Whether or not the target is allowlisted + */ + function setAllowlistedMulticallTarget(address target, bool allowlisted) external; + + /** + * @notice When receiving a call from this contract through `multicallThrough`, the receiver can use this function to get the original caller. + */ + function getMessageSender() external view returns (address); } diff --git a/protocol/synthetix/contracts/interfaces/IPoolModule.sol b/protocol/synthetix/contracts/interfaces/IPoolModule.sol index f8b07f59d6..dd94452086 100644 --- a/protocol/synthetix/contracts/interfaces/IPoolModule.sol +++ b/protocol/synthetix/contracts/interfaces/IPoolModule.sol @@ -2,6 +2,7 @@ pragma solidity >=0.8.11 <0.9.0; import "../storage/MarketConfiguration.sol"; +import "../storage/PoolCollateralConfiguration.sol"; /** * @title Module for the creation and management of pools. @@ -79,12 +80,25 @@ interface IPoolModule { address indexed sender ); + event PoolCollateralConfigurationUpdated( + uint128 indexed poolId, + address collateralType, + PoolCollateralConfiguration.Data config + ); + /** * @notice Emitted when a system-wide minimum liquidity ratio is set * @param minLiquidityRatio The new system-wide minimum liquidity ratio */ event SetMinLiquidityRatio(uint256 minLiquidityRatio); + /** + * @notice Allows collaterals accepeted by the system to be accepeted by the pool by default + * @param poolId The id of the pool. + * @param disabled Shows if new collateral's will be dsiabled by default for the pool + */ + event PoolCollateralDisabledByDefaultSet(uint128 poolId, bool disabled); + /** * @notice Creates a pool with the requested pool id. * @param requestedPoolId The requested id for the new pool. Reverts if the id is not available. @@ -104,6 +118,25 @@ interface IPoolModule { MarketConfiguration.Data[] memory marketDistribution ) external; + /** + * @notice Allows the pool owner to set the configuration of a specific collateral type for their pool. + * @param poolId The id of the pool whose configuration is being set. + * @param collateralType The collate + * @param newConfig The config to set + */ + function setPoolCollateralConfiguration( + uint128 poolId, + address collateralType, + PoolCollateralConfiguration.Data memory newConfig + ) external; + + /** + * @notice Allows collaterals accepeted by the system to be accepeted by the pool by default + * @param poolId The id of the pool. + * @param disabled If set to true new collaterals will be disabled for the pool. + */ + function setPoolCollateralDisabledByDefault(uint128 poolId, bool disabled) external; + /** * @notice Retrieves the MarketConfiguration of the specified pool. * @param poolId The id of the pool whose configuration is being queried. @@ -179,6 +212,16 @@ interface IPoolModule { */ function setMinLiquidityRatio(uint256 minLiquidityRatio) external; + /** + @notice returns a pool minimum issuance ratio + * @param poolId The id of the pool for to check the collateral for. + * @param collateral The address of the collateral. + */ + function getPoolCollateralIssuanceRatio( + uint128 poolId, + address collateral + ) external returns (uint256 issuanceRatioD18); + /** * @notice Retrieves the system-wide minimum liquidity ratio. * @return minRatioD18 The current system-wide minimum liquidity ratio, denominated with 18 decimals of precision. (100% is represented by 1 followed by 18 zeros.) diff --git a/protocol/synthetix/contracts/mocks/MulticallReceiver.sol b/protocol/synthetix/contracts/mocks/MulticallReceiver.sol new file mode 100644 index 0000000000..8b79353c6b --- /dev/null +++ b/protocol/synthetix/contracts/mocks/MulticallReceiver.sol @@ -0,0 +1,13 @@ +//SPDX-License-Identifier: MIT +pragma solidity >=0.8.11 <0.9.0; + +import "../interfaces/IMulticallModule.sol"; + +contract MulticallReceiver { + event MessageSenderTested(address indexed sender); + + function testMessageSender() external returns (address) { + emit MessageSenderTested(IMulticallModule(msg.sender).getMessageSender()); + return msg.sender; + } +} diff --git a/protocol/synthetix/contracts/modules/core/AccountModule.sol b/protocol/synthetix/contracts/modules/core/AccountModule.sol index 23aca84d99..866fe91d9a 100644 --- a/protocol/synthetix/contracts/modules/core/AccountModule.sol +++ b/protocol/synthetix/contracts/modules/core/AccountModule.sol @@ -81,9 +81,10 @@ contract AccountModule is IAccountModule { accountId = (type(uint128).max / 2) + systemAccountConfiguration.accountIdOffset; systemAccountConfiguration.accountIdOffset += 1; - accountTokenModule.safeMint(msg.sender, accountId, ""); Account.create(accountId, msg.sender); + accountTokenModule.safeMint(msg.sender, accountId, ""); + emit AccountCreated(accountId, msg.sender); } diff --git a/protocol/synthetix/contracts/modules/core/CollateralConfigurationModule.sol b/protocol/synthetix/contracts/modules/core/CollateralConfigurationModule.sol index 01c4ff13e6..53f537e6b1 100644 --- a/protocol/synthetix/contracts/modules/core/CollateralConfigurationModule.sol +++ b/protocol/synthetix/contracts/modules/core/CollateralConfigurationModule.sol @@ -61,7 +61,7 @@ contract CollateralConfigurationModule is ICollateralConfigurationModule { // solc-ignore-next-line func-mutability function getCollateralConfiguration( address collateralType - ) external view override returns (CollateralConfiguration.Data memory) { + ) external pure override returns (CollateralConfiguration.Data memory) { return CollateralConfiguration.load(collateralType); } diff --git a/protocol/synthetix/contracts/modules/core/CollateralModule.sol b/protocol/synthetix/contracts/modules/core/CollateralModule.sol index cc31b0d0a5..152675f02b 100644 --- a/protocol/synthetix/contracts/modules/core/CollateralModule.sol +++ b/protocol/synthetix/contracts/modules/core/CollateralModule.sol @@ -30,7 +30,6 @@ contract CollateralModule is ICollateralModule { bytes32 private constant _DEPOSIT_FEATURE_FLAG = "deposit"; bytes32 private constant _WITHDRAW_FEATURE_FLAG = "withdraw"; - bytes32 private constant _CONFIG_TIMEOUT_WITHDRAW = "accountTimeoutWithdraw"; /** diff --git a/protocol/synthetix/contracts/modules/core/IssueUSDModule.sol b/protocol/synthetix/contracts/modules/core/IssueUSDModule.sol index 8b0ee603a9..de8a21d3ae 100644 --- a/protocol/synthetix/contracts/modules/core/IssueUSDModule.sol +++ b/protocol/synthetix/contracts/modules/core/IssueUSDModule.sol @@ -1,18 +1,18 @@ //SPDX-License-Identifier: MIT pragma solidity >=0.8.11 <0.9.0; -import "../../interfaces/IIssueUSDModule.sol"; - import "@synthetixio/core-contracts/contracts/utils/SafeCast.sol"; +import "@synthetixio/core-modules/contracts/storage/FeatureFlag.sol"; import "@synthetixio/core-modules/contracts/storage/AssociatedSystem.sol"; +import "../../interfaces/IIssueUSDModule.sol"; + import "../../storage/Account.sol"; +import "../../storage/Collateral.sol"; import "../../storage/CollateralConfiguration.sol"; import "../../storage/Config.sol"; -import "@synthetixio/core-modules/contracts/storage/FeatureFlag.sol"; - /** * @title Module for the minting and burning of stablecoins. * @dev See IIssueUSDModule. @@ -24,6 +24,7 @@ contract IssueUSDModule is IIssueUSDModule { using AssociatedSystem for AssociatedSystem.Data; using Pool for Pool.Data; using CollateralConfiguration for CollateralConfiguration.Data; + using Collateral for Collateral.Data; using Vault for Vault.Data; using VaultEpoch for VaultEpoch.Data; using Distribution for Distribution.Data; @@ -38,10 +39,8 @@ contract IssueUSDModule is IIssueUSDModule { using SafeCastI256 for int256; bytes32 private constant _USD_TOKEN = "USDToken"; - bytes32 private constant _MINT_FEATURE_FLAG = "mintUsd"; bytes32 private constant _BURN_FEATURE_FLAG = "burnUsd"; - bytes32 private constant _CONFIG_MINT_FEE_RATIO = "mintUsd_feeRatio"; bytes32 private constant _CONFIG_BURN_FEE_RATIO = "burnUsd_feeRatio"; bytes32 private constant _CONFIG_MINT_FEE_ADDRESS = "mintUsd_feeAddress"; @@ -57,7 +56,11 @@ contract IssueUSDModule is IIssueUSDModule { uint256 amount ) external override { FeatureFlag.ensureAccessToFeature(_MINT_FEATURE_FLAG); - Account.loadAccountAndValidatePermission(accountId, AccountRBAC._MINT_PERMISSION); + + Account.Data storage account = Account.loadAccountAndValidatePermission( + accountId, + AccountRBAC._MINT_PERMISSION + ); // disabled collateralType cannot be used for minting CollateralConfiguration.collateralEnabled(collateralType); @@ -87,7 +90,8 @@ contract IssueUSDModule is IIssueUSDModule { if (newDebt > 0) { CollateralConfiguration.load(collateralType).verifyIssuanceRatio( newDebt.toUint(), - collateralValue + collateralValue, + pool.collateralConfigurations[collateralType].issuanceRatioD18 ); } @@ -126,6 +130,12 @@ contract IssueUSDModule is IIssueUSDModule { uint256 amount ) external override { FeatureFlag.ensureAccessToFeature(_BURN_FEATURE_FLAG); + + Account.Data storage account = Account.loadAccountAndValidatePermission( + accountId, + AccountRBAC._BURN_PERMISSION + ); + Pool.Data storage pool = Pool.load(poolId); // Retrieve current position debt @@ -148,6 +158,8 @@ contract IssueUSDModule is IIssueUSDModule { amount = debt.toUint() + feeAmount; } + AssociatedSystem.Data storage usdToken = AssociatedSystem.load(_USD_TOKEN); + // Burn the stablecoins Account .load(accountId) @@ -160,7 +172,6 @@ contract IssueUSDModule is IIssueUSDModule { emit IssuanceFeePaid(accountId, poolId, collateralType, feeAmount); } - // Decrease the debt of the position pool.assignDebtToAccount(collateralType, accountId, -(amount - feeAmount).toInt()); diff --git a/protocol/synthetix/contracts/modules/core/MarketManagerModule.sol b/protocol/synthetix/contracts/modules/core/MarketManagerModule.sol index 47714ab81e..7ac7bae25a 100644 --- a/protocol/synthetix/contracts/modules/core/MarketManagerModule.sol +++ b/protocol/synthetix/contracts/modules/core/MarketManagerModule.sol @@ -76,6 +76,13 @@ contract MarketManagerModule is IMarketManagerModule { return withdrawable < 0 ? 0 : withdrawable.toUint(); } + /** + * @inheritdoc IMarketManagerModule + */ + function getMarketAddress(uint128 marketId) external view override returns (address) { + return Market.load(marketId).marketAddress; + } + /** * @inheritdoc IMarketManagerModule */ diff --git a/protocol/synthetix/contracts/modules/core/MulticallModule.sol b/protocol/synthetix/contracts/modules/core/MulticallModule.sol index d258240d57..6ea87e5213 100644 --- a/protocol/synthetix/contracts/modules/core/MulticallModule.sol +++ b/protocol/synthetix/contracts/modules/core/MulticallModule.sol @@ -5,6 +5,9 @@ import "../../interfaces/IMulticallModule.sol"; import "../../storage/Config.sol"; +import {OwnableStorage} from "@synthetixio/core-contracts/contracts/ownership/OwnableStorage.sol"; +import {ParameterError} from "@synthetixio/core-contracts/contracts/errors/ParameterError.sol"; + /** * @title Module that enables calling multiple methods of the system in a single transaction. * @dev See IMulticallModule. @@ -12,15 +15,18 @@ import "../../storage/Config.sol"; */ contract MulticallModule is IMulticallModule { bytes32 internal constant _CONFIG_MESSAGE_SENDER = "_messageSender"; + bytes32 internal constant _CONFIG_ALLOWLISTED_MULTICALL_TARGETS = + "_allowlistedMulticallTargets"; - error RecursiveMulticall(address); + // solhint-disable-next-line numcast/safe-cast + bytes32 constant ALLOWED = bytes32(uint256(1)); + // solhint-disable-next-line numcast/safe-cast + bytes32 constant DISALLOWED = bytes32(uint256(0)); /** * @inheritdoc IMulticallModule */ - function multicall( - bytes[] calldata data - ) public payable override returns (bytes[] memory results) { + function multicall(bytes[] calldata data) public override returns (bytes[] memory results) { results = new bytes[](data.length); for (uint256 i = 0; i < data.length; i++) { (bool success, bytes memory result) = address(this).delegatecall(data[i]); @@ -36,25 +42,41 @@ contract MulticallModule is IMulticallModule { } } - // uncomment this when governance approves `multicallThrough` functionality (didnt want to put this in a separate PR for now) - /*function multicallThrough( + /** + * @inheritdoc IMulticallModule + */ + function multicallThrough( address[] calldata to, - bytes[] calldata data + bytes[] calldata data, + uint256[] calldata values ) public payable override returns (bytes[] memory results) { + if (to.length != data.length || to.length != values.length) { + revert ParameterError.InvalidParameter("", "all arrays must be same length"); + } if (Config.read(_CONFIG_MESSAGE_SENDER, 0) != 0) { revert RecursiveMulticall(msg.sender); } + // solhint-disable-next-line numcast/safe-cast Config.put(_CONFIG_MESSAGE_SENDER, bytes32(uint256(uint160(msg.sender)))); results = new bytes[](data.length); + uint256 valueUsed; for (uint256 i = 0; i < data.length; i++) { bool success; bytes memory result; if (to[i] == address(this)) { (success, result) = address(this).delegatecall(data[i]); + } else if ( + Config.read( + keccak256(abi.encodePacked(_CONFIG_ALLOWLISTED_MULTICALL_TARGETS, to[i])), + 0 + ) != 0 + ) { + valueUsed += values[i]; + (success, result) = address(to[i]).call{value: values[i]}(data[i]); } else { - (success, result) = address(to[i]).call(data[i]); + revert DeniedMulticallTarget(to[i]); } if (!success) { @@ -67,10 +89,28 @@ contract MulticallModule is IMulticallModule { results[i] = result; } + if (valueUsed > msg.value) { + revert ParameterError.InvalidParameter("msg.value", "must exceed value total"); + } + Config.put(_CONFIG_MESSAGE_SENDER, 0); } + /** + * @inheritdoc IMulticallModule + */ + function setAllowlistedMulticallTarget(address target, bool allowlisted) external override { + OwnableStorage.onlyOwner(); + Config.put( + keccak256(abi.encodePacked(_CONFIG_ALLOWLISTED_MULTICALL_TARGETS, target)), + allowlisted ? ALLOWED : DISALLOWED + ); + } + + /** + * @inheritdoc IMulticallModule + */ function getMessageSender() external view override returns (address) { return Config.readAddress(_CONFIG_MESSAGE_SENDER, address(0)); - }*/ + } } diff --git a/protocol/synthetix/contracts/modules/core/PoolModule.sol b/protocol/synthetix/contracts/modules/core/PoolModule.sol index b99a5f177f..107e86547e 100644 --- a/protocol/synthetix/contracts/modules/core/PoolModule.sol +++ b/protocol/synthetix/contracts/modules/core/PoolModule.sol @@ -205,6 +205,18 @@ contract PoolModule is IPoolModule { emit PoolConfigurationSet(poolId, newMarketConfigurations, msg.sender); } + /** + * @inheritdoc IPoolModule + */ + function setPoolCollateralDisabledByDefault(uint128 poolId, bool disabled) external override { + Pool.Data storage pool = Pool.loadExisting(poolId); + Pool.onlyPoolOwner(poolId, msg.sender); + + pool.collateralDisabledByDefault = disabled; + + emit PoolCollateralDisabledByDefaultSet(poolId, disabled); + } + /** * @inheritdoc IPoolModule */ @@ -240,6 +252,32 @@ contract PoolModule is IPoolModule { emit PoolNameUpdated(poolId, name, msg.sender); } + /** + * @inheritdoc IPoolModule + */ + function setPoolCollateralConfiguration( + uint128 poolId, + address collateralType, + PoolCollateralConfiguration.Data memory newConfig + ) external override { + Pool.Data storage pool = Pool.loadExisting(poolId); + Pool.onlyPoolOwner(poolId, msg.sender); + + pool.collateralConfigurations[collateralType] = newConfig; + + emit PoolCollateralConfigurationUpdated(poolId, collateralType, newConfig); + } + + /** + * @inheritdoc IPoolModule + */ + function getPoolCollateralIssuanceRatio( + uint128 poolId, + address collateral + ) external view override returns (uint256) { + return Pool.loadExisting(poolId).collateralConfigurations[collateral].issuanceRatioD18; + } + /** * @inheritdoc IPoolModule */ diff --git a/protocol/synthetix/contracts/modules/core/RewardsManagerModule.sol b/protocol/synthetix/contracts/modules/core/RewardsManagerModule.sol index 6e7629d354..f951f6d351 100644 --- a/protocol/synthetix/contracts/modules/core/RewardsManagerModule.sol +++ b/protocol/synthetix/contracts/modules/core/RewardsManagerModule.sol @@ -155,7 +155,7 @@ contract RewardsManagerModule is IRewardsManagerModule { Account.loadAccountAndValidatePermission(accountId, AccountRBAC._REWARDS_PERMISSION); Vault.Data storage vault = Pool.load(poolId).vaults[collateralType]; - bytes32 rewardId = keccak256(abi.encode(poolId, collateralType, distributor)); + bytes32 rewardId = _getRewardId(poolId, collateralType, distributor); if (address(vault.rewards[rewardId].distributor) != distributor) { revert ParameterError.InvalidParameter("invalid-params", "reward is not found"); @@ -251,10 +251,6 @@ contract RewardsManagerModule is IRewardsManagerModule { rewardIds.remove(rewardId); - if (distributor == address(0)) { - revert ParameterError.InvalidParameter("distributor", "must be non-zero"); - } - RewardDistribution.Data storage reward = pool.vaults[collateralType].rewards[rewardId]; // ensure rewards emission is stopped (users can still come in to claim rewards after the fact) diff --git a/protocol/synthetix/contracts/modules/core/VaultModule.sol b/protocol/synthetix/contracts/modules/core/VaultModule.sol index 39526b72e3..07e144e23d 100644 --- a/protocol/synthetix/contracts/modules/core/VaultModule.sol +++ b/protocol/synthetix/contracts/modules/core/VaultModule.sol @@ -85,6 +85,11 @@ contract VaultModule is IVaultModule { newCollateralAmountD18 - currentCollateralAmount ); + Pool.loadExisting(poolId).checkPoolCollateralLimit( + collateralType, + newCollateralAmountD18 - currentCollateralAmount + ); + // if decreasing delegation amount, ensure min time has elapsed } else { Pool.loadExisting(poolId).requireMinDelegationTimeElapsed( @@ -116,11 +121,17 @@ contract VaultModule is IVaultModule { if (newCollateralAmountD18 < currentCollateralAmount) { int256 debt = vault.currentEpoch().consolidatedDebtAmountsD18[accountId]; + uint256 minIssuanceRatioD18 = Pool + .loadExisting(poolId) + .collateralConfigurations[collateralType] + .issuanceRatioD18; + // Minimum collateralization ratios are configured in the system per collateral type.abi // Ensure that the account's updated position satisfies this requirement. CollateralConfiguration.load(collateralType).verifyIssuanceRatio( debt < 0 ? 0 : debt.toUint(), - newCollateralAmountD18.mulDecimal(collateralPrice) + newCollateralAmountD18.mulDecimal(collateralPrice), + minIssuanceRatioD18 ); // Accounts cannot reduce collateral if any of the pool's diff --git a/protocol/synthetix/contracts/storage/AccountRBAC.sol b/protocol/synthetix/contracts/storage/AccountRBAC.sol index 063340fa9e..32348262b6 100644 --- a/protocol/synthetix/contracts/storage/AccountRBAC.sol +++ b/protocol/synthetix/contracts/storage/AccountRBAC.sol @@ -22,6 +22,7 @@ library AccountRBAC { bytes32 internal constant _REWARDS_PERMISSION = "REWARDS"; bytes32 internal constant _PERPS_MODIFY_COLLATERAL_PERMISSION = "PERPS_MODIFY_COLLATERAL"; bytes32 internal constant _PERPS_COMMIT_ASYNC_ORDER_PERMISSION = "PERPS_COMMIT_ASYNC_ORDER"; + bytes32 internal constant _BURN_PERMISSION = "BURN"; /** * @dev Thrown when a permission specified by a user does not exist or is invalid. @@ -54,7 +55,8 @@ library AccountRBAC { permission != AccountRBAC._ADMIN_PERMISSION && permission != AccountRBAC._REWARDS_PERMISSION && permission != AccountRBAC._PERPS_MODIFY_COLLATERAL_PERMISSION && - permission != AccountRBAC._PERPS_COMMIT_ASYNC_ORDER_PERMISSION + permission != AccountRBAC._PERPS_COMMIT_ASYNC_ORDER_PERMISSION && + permission != AccountRBAC._BURN_PERMISSION ) { revert InvalidPermission(permission); } diff --git a/protocol/synthetix/contracts/storage/Collateral.sol b/protocol/synthetix/contracts/storage/Collateral.sol index c28909afb9..4ab64f9991 100644 --- a/protocol/synthetix/contracts/storage/Collateral.sol +++ b/protocol/synthetix/contracts/storage/Collateral.sol @@ -14,6 +14,14 @@ import "./CollateralLock.sol"; library Collateral { using SafeCastU256 for uint256; + /** + * @dev Thrown when a specified market is not found. + */ + error InsufficentAvailableCollateral( + uint256 amountAvailableForDelegationD18, + uint256 amountD18 + ); + struct Data { /** * @dev The amount that can be withdrawn or delegated in this collateral. @@ -44,6 +52,9 @@ library Collateral { * @dev Decrements the entry's availableCollateral. */ function decreaseAvailableCollateral(Data storage self, uint256 amountD18) internal { + if (self.amountAvailableForDelegationD18 < amountD18) { + revert InsufficentAvailableCollateral(self.amountAvailableForDelegationD18, amountD18); + } self.amountAvailableForDelegationD18 -= amountD18; } diff --git a/protocol/synthetix/contracts/storage/CollateralConfiguration.sol b/protocol/synthetix/contracts/storage/CollateralConfiguration.sol index b504829c86..63773126bf 100644 --- a/protocol/synthetix/contracts/storage/CollateralConfiguration.sol +++ b/protocol/synthetix/contracts/storage/CollateralConfiguration.sol @@ -142,6 +142,24 @@ library CollateralConfiguration { ); } + if (config.issuanceRatioD18 <= 1e18) { + revert ParameterError.InvalidParameter("issuanceRatioD18", "must be greater than 100%"); + } + + if (config.liquidationRatioD18 <= 1e18) { + revert ParameterError.InvalidParameter( + "liquidationRatioD18", + "must be greater than 100%" + ); + } + + if (config.issuanceRatioD18 < config.liquidationRatioD18) { + revert ParameterError.InvalidParameter( + "issuanceRatioD18", + "must be greater than liquidationRatioD18" + ); + } + Data storage storedConfig = load(config.tokenAddress); storedConfig.tokenAddress = config.tokenAddress; @@ -205,18 +223,22 @@ library CollateralConfiguration { function verifyIssuanceRatio( Data storage self, uint256 debtD18, - uint256 collateralValueD18 + uint256 collateralValueD18, + uint256 minIssuanceRatioD18 ) internal view { + uint256 issuanceRatioD18 = self.issuanceRatioD18 > minIssuanceRatioD18 + ? self.issuanceRatioD18 + : minIssuanceRatioD18; + if ( debtD18 != 0 && - (collateralValueD18 == 0 || - collateralValueD18.divDecimal(debtD18) < self.issuanceRatioD18) + (collateralValueD18 == 0 || collateralValueD18.divDecimal(debtD18) < issuanceRatioD18) ) { revert InsufficientCollateralRatio( collateralValueD18, debtD18, collateralValueD18.divDecimal(debtD18), - self.issuanceRatioD18 + issuanceRatioD18 ); } } diff --git a/protocol/synthetix/contracts/storage/Pool.sol b/protocol/synthetix/contracts/storage/Pool.sol index 8cdd0e73cf..aeffe67ffa 100644 --- a/protocol/synthetix/contracts/storage/Pool.sol +++ b/protocol/synthetix/contracts/storage/Pool.sol @@ -8,6 +8,7 @@ import "./Vault.sol"; import "./Market.sol"; import "./PoolCrossChainInfo.sol"; import "./SystemPoolConfiguration.sol"; +import "./PoolCollateralConfiguration.sol"; import "@synthetixio/core-contracts/contracts/errors/AccessError.sol"; import "@synthetixio/core-contracts/contracts/utils/SafeCast.sol"; diff --git a/protocol/synthetix/contracts/storage/PoolCollateralConfiguration.sol b/protocol/synthetix/contracts/storage/PoolCollateralConfiguration.sol new file mode 100644 index 0000000000..4200a24118 --- /dev/null +++ b/protocol/synthetix/contracts/storage/PoolCollateralConfiguration.sol @@ -0,0 +1,12 @@ +//SPDX-License-Identifier: MIT +pragma solidity >=0.8.11 <0.9.0; + +library PoolCollateralConfiguration { + bytes32 private constant _SLOT = + keccak256(abi.encode("io.synthetix.synthetix.PoolCollateralConfiguration")); + + struct Data { + uint256 collateralLimitD18; + uint256 issuanceRatioD18; + } +} diff --git a/protocol/synthetix/package.json b/protocol/synthetix/package.json index 3ceca95d78..9b580ea675 100644 --- a/protocol/synthetix/package.json +++ b/protocol/synthetix/package.json @@ -10,14 +10,14 @@ "build": "yarn build:contracts", "build:contracts": "hardhat storage:verify && hardhat cannon:build", "generate-testable": "rm -rf contracts/generated && hardhat generate-testable", - "build-testable": "hardhat cannon:build cannonfile.test.toml", + "build-testable": "CANNON_REGISTRY_PRIORITY=local hardhat cannon:build cannonfile.test.toml", "check:storage": "git diff --exit-code storage.dump.sol", - "test": "hardhat test", + "test": "CANNON_REGISTRY_PRIORITY=local hardhat test", "coverage": "hardhat coverage --network hardhat", "compile-contracts": "hardhat compile", "size-contracts": "hardhat compile && hardhat size-contracts", - "publish-contracts": "yarn build && cannon publish synthetix:$(node -p 'require(`./package.json`).version') --quiet", - "postpack": "yarn publish-contracts", + "publish-contracts": "cannon publish synthetix:$(node -p 'require(`./package.json`).version') --chain-id 13370 --quiet --tags $(node -p '/^\\d+\\.\\d+\\.\\d+$/.test(require(`./package.json`).version) ? `latest` : `dev`')", + "postpack": "yarn build && yarn publish-contracts", "docgen": "hardhat docgen" }, "keywords": [], @@ -31,11 +31,10 @@ "@synthetixio/core-utils": "workspace:*", "@synthetixio/docgen": "workspace:*", "@synthetixio/oracle-manager": "workspace:*", - "@synthetixio/router": "^3.1.3", + "@synthetixio/router": "^3.3.0", "@synthetixio/wei": "2.74.4", - "@usecannon/builder": "^2.5.1", "ethers": "^5.7.2", - "hardhat": "2.15.0", + "hardhat": "2.17.2", "solidity-ast": "0.4.46", "solidity-docgen": "0.6.0-beta.35", "ts-node": "10.9.1" diff --git a/protocol/synthetix/storage.dump.sol b/protocol/synthetix/storage.dump.sol index 4caacb7f58..6a16ca0c56 100644 --- a/protocol/synthetix/storage.dump.sol +++ b/protocol/synthetix/storage.dump.sol @@ -396,6 +396,9 @@ contract MarketManagerModule { // @custom:artifact contracts/modules/core/MulticallModule.sol:MulticallModule contract MulticallModule { bytes32 internal constant _CONFIG_MESSAGE_SENDER = "_messageSender"; + bytes32 internal constant _CONFIG_ALLOWLISTED_MULTICALL_TARGETS = "_allowlistedMulticallTargets"; + bytes32 internal constant ALLOWED = bytes32(uint256(1)); + bytes32 internal constant DISALLOWED = bytes32(uint256(0)); } // @custom:artifact contracts/modules/core/PoolModule.sol:PoolModule @@ -454,6 +457,7 @@ library AccountRBAC { bytes32 internal constant _REWARDS_PERMISSION = "REWARDS"; bytes32 internal constant _PERPS_MODIFY_COLLATERAL_PERMISSION = "PERPS_MODIFY_COLLATERAL"; bytes32 internal constant _PERPS_COMMIT_ASYNC_ORDER_PERMISSION = "PERPS_COMMIT_ASYNC_ORDER"; + bytes32 internal constant _BURN_PERMISSION = "BURN"; struct Data { address owner; mapping(address => SetUtil.Bytes32Set) permissions; diff --git a/protocol/synthetix/subgraph/.gitignore b/protocol/synthetix/subgraph/.gitignore index a3e826de17..c6173feedc 100644 --- a/protocol/synthetix/subgraph/.gitignore +++ b/protocol/synthetix/subgraph/.gitignore @@ -2,5 +2,5 @@ tests/.bin/ tests/.latest.json subgraph.yaml -deployments/ +**/deployments/ build/ diff --git a/protocol/synthetix/subgraph/base-goerli-competition/generated/CoreProxy/CoreProxy.ts b/protocol/synthetix/subgraph/base-goerli-competition/generated/CoreProxy/CoreProxy.ts new file mode 100644 index 0000000000..e6fbb8c58c --- /dev/null +++ b/protocol/synthetix/subgraph/base-goerli-competition/generated/CoreProxy/CoreProxy.ts @@ -0,0 +1,6657 @@ +// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. + +import { + ethereum, + JSONValue, + TypedMap, + Entity, + Bytes, + Address, + BigInt, +} from '@graphprotocol/graph-ts'; + +export class OwnerChanged extends ethereum.Event { + get params(): OwnerChanged__Params { + return new OwnerChanged__Params(this); + } +} + +export class OwnerChanged__Params { + _event: OwnerChanged; + + constructor(event: OwnerChanged) { + this._event = event; + } + + get oldOwner(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get newOwner(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class OwnerNominated extends ethereum.Event { + get params(): OwnerNominated__Params { + return new OwnerNominated__Params(this); + } +} + +export class OwnerNominated__Params { + _event: OwnerNominated; + + constructor(event: OwnerNominated) { + this._event = event; + } + + get newOwner(): Address { + return this._event.parameters[0].value.toAddress(); + } +} + +export class Upgraded extends ethereum.Event { + get params(): Upgraded__Params { + return new Upgraded__Params(this); + } +} + +export class Upgraded__Params { + _event: Upgraded; + + constructor(event: Upgraded) { + this._event = event; + } + + get self(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get implementation(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class FeatureFlagAllowAllSet extends ethereum.Event { + get params(): FeatureFlagAllowAllSet__Params { + return new FeatureFlagAllowAllSet__Params(this); + } +} + +export class FeatureFlagAllowAllSet__Params { + _event: FeatureFlagAllowAllSet; + + constructor(event: FeatureFlagAllowAllSet) { + this._event = event; + } + + get feature(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get allowAll(): boolean { + return this._event.parameters[1].value.toBoolean(); + } +} + +export class FeatureFlagAllowlistAdded extends ethereum.Event { + get params(): FeatureFlagAllowlistAdded__Params { + return new FeatureFlagAllowlistAdded__Params(this); + } +} + +export class FeatureFlagAllowlistAdded__Params { + _event: FeatureFlagAllowlistAdded; + + constructor(event: FeatureFlagAllowlistAdded) { + this._event = event; + } + + get feature(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get account(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class FeatureFlagAllowlistRemoved extends ethereum.Event { + get params(): FeatureFlagAllowlistRemoved__Params { + return new FeatureFlagAllowlistRemoved__Params(this); + } +} + +export class FeatureFlagAllowlistRemoved__Params { + _event: FeatureFlagAllowlistRemoved; + + constructor(event: FeatureFlagAllowlistRemoved) { + this._event = event; + } + + get feature(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get account(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class FeatureFlagDeniersReset extends ethereum.Event { + get params(): FeatureFlagDeniersReset__Params { + return new FeatureFlagDeniersReset__Params(this); + } +} + +export class FeatureFlagDeniersReset__Params { + _event: FeatureFlagDeniersReset; + + constructor(event: FeatureFlagDeniersReset) { + this._event = event; + } + + get feature(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get deniers(): Array
{ + return this._event.parameters[1].value.toAddressArray(); + } +} + +export class FeatureFlagDenyAllSet extends ethereum.Event { + get params(): FeatureFlagDenyAllSet__Params { + return new FeatureFlagDenyAllSet__Params(this); + } +} + +export class FeatureFlagDenyAllSet__Params { + _event: FeatureFlagDenyAllSet; + + constructor(event: FeatureFlagDenyAllSet) { + this._event = event; + } + + get feature(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get denyAll(): boolean { + return this._event.parameters[1].value.toBoolean(); + } +} + +export class AccountCreated extends ethereum.Event { + get params(): AccountCreated__Params { + return new AccountCreated__Params(this); + } +} + +export class AccountCreated__Params { + _event: AccountCreated; + + constructor(event: AccountCreated) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get owner(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class PermissionGranted extends ethereum.Event { + get params(): PermissionGranted__Params { + return new PermissionGranted__Params(this); + } +} + +export class PermissionGranted__Params { + _event: PermissionGranted; + + constructor(event: PermissionGranted) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get permission(): Bytes { + return this._event.parameters[1].value.toBytes(); + } + + get user(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get sender(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class PermissionRevoked extends ethereum.Event { + get params(): PermissionRevoked__Params { + return new PermissionRevoked__Params(this); + } +} + +export class PermissionRevoked__Params { + _event: PermissionRevoked; + + constructor(event: PermissionRevoked) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get permission(): Bytes { + return this._event.parameters[1].value.toBytes(); + } + + get user(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get sender(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class DebtAssociated extends ethereum.Event { + get params(): DebtAssociated__Params { + return new DebtAssociated__Params(this); + } +} + +export class DebtAssociated__Params { + _event: DebtAssociated; + + constructor(event: DebtAssociated) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get accountId(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get amount(): BigInt { + return this._event.parameters[4].value.toBigInt(); + } + + get updatedDebt(): BigInt { + return this._event.parameters[5].value.toBigInt(); + } +} + +export class AssociatedSystemSet extends ethereum.Event { + get params(): AssociatedSystemSet__Params { + return new AssociatedSystemSet__Params(this); + } +} + +export class AssociatedSystemSet__Params { + _event: AssociatedSystemSet; + + constructor(event: AssociatedSystemSet) { + this._event = event; + } + + get kind(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get id(): Bytes { + return this._event.parameters[1].value.toBytes(); + } + + get proxy(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get impl(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class CollateralLockCreated extends ethereum.Event { + get params(): CollateralLockCreated__Params { + return new CollateralLockCreated__Params(this); + } +} + +export class CollateralLockCreated__Params { + _event: CollateralLockCreated; + + constructor(event: CollateralLockCreated) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenAmount(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get expireTimestamp(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } +} + +export class CollateralLockExpired extends ethereum.Event { + get params(): CollateralLockExpired__Params { + return new CollateralLockExpired__Params(this); + } +} + +export class CollateralLockExpired__Params { + _event: CollateralLockExpired; + + constructor(event: CollateralLockExpired) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenAmount(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get expireTimestamp(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } +} + +export class Deposited extends ethereum.Event { + get params(): Deposited__Params { + return new Deposited__Params(this); + } +} + +export class Deposited__Params { + _event: Deposited; + + constructor(event: Deposited) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenAmount(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class Withdrawn extends ethereum.Event { + get params(): Withdrawn__Params { + return new Withdrawn__Params(this); + } +} + +export class Withdrawn__Params { + _event: Withdrawn; + + constructor(event: Withdrawn) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenAmount(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class CollateralConfigured extends ethereum.Event { + get params(): CollateralConfigured__Params { + return new CollateralConfigured__Params(this); + } +} + +export class CollateralConfigured__Params { + _event: CollateralConfigured; + + constructor(event: CollateralConfigured) { + this._event = event; + } + + get collateralType(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get config(): CollateralConfiguredConfigStruct { + return changetype(this._event.parameters[1].value.toTuple()); + } +} + +export class CollateralConfiguredConfigStruct extends ethereum.Tuple { + get depositingEnabled(): boolean { + return this[0].toBoolean(); + } + + get issuanceRatioD18(): BigInt { + return this[1].toBigInt(); + } + + get liquidationRatioD18(): BigInt { + return this[2].toBigInt(); + } + + get liquidationRewardD18(): BigInt { + return this[3].toBigInt(); + } + + get oracleNodeId(): Bytes { + return this[4].toBytes(); + } + + get tokenAddress(): Address { + return this[5].toAddress(); + } + + get minDelegationD18(): BigInt { + return this[6].toBigInt(); + } +} + +export class TransferCrossChainInitiated extends ethereum.Event { + get params(): TransferCrossChainInitiated__Params { + return new TransferCrossChainInitiated__Params(this); + } +} + +export class TransferCrossChainInitiated__Params { + _event: TransferCrossChainInitiated; + + constructor(event: TransferCrossChainInitiated) { + this._event = event; + } + + get destChainId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get amount(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[2].value.toAddress(); + } +} + +export class IssuanceFeePaid extends ethereum.Event { + get params(): IssuanceFeePaid__Params { + return new IssuanceFeePaid__Params(this); + } +} + +export class IssuanceFeePaid__Params { + _event: IssuanceFeePaid; + + constructor(event: IssuanceFeePaid) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get feeAmount(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } +} + +export class UsdBurned extends ethereum.Event { + get params(): UsdBurned__Params { + return new UsdBurned__Params(this); + } +} + +export class UsdBurned__Params { + _event: UsdBurned; + + constructor(event: UsdBurned) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get amount(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[4].value.toAddress(); + } +} + +export class UsdMinted extends ethereum.Event { + get params(): UsdMinted__Params { + return new UsdMinted__Params(this); + } +} + +export class UsdMinted__Params { + _event: UsdMinted; + + constructor(event: UsdMinted) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get amount(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[4].value.toAddress(); + } +} + +export class Liquidation extends ethereum.Event { + get params(): Liquidation__Params { + return new Liquidation__Params(this); + } +} + +export class Liquidation__Params { + _event: Liquidation; + + constructor(event: Liquidation) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get liquidationData(): LiquidationLiquidationDataStruct { + return changetype(this._event.parameters[3].value.toTuple()); + } + + get liquidateAsAccountId(): BigInt { + return this._event.parameters[4].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[5].value.toAddress(); + } +} + +export class LiquidationLiquidationDataStruct extends ethereum.Tuple { + get debtLiquidated(): BigInt { + return this[0].toBigInt(); + } + + get collateralLiquidated(): BigInt { + return this[1].toBigInt(); + } + + get amountRewarded(): BigInt { + return this[2].toBigInt(); + } +} + +export class VaultLiquidation extends ethereum.Event { + get params(): VaultLiquidation__Params { + return new VaultLiquidation__Params(this); + } +} + +export class VaultLiquidation__Params { + _event: VaultLiquidation; + + constructor(event: VaultLiquidation) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get liquidationData(): VaultLiquidationLiquidationDataStruct { + return changetype( + this._event.parameters[2].value.toTuple() + ); + } + + get liquidateAsAccountId(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[4].value.toAddress(); + } +} + +export class VaultLiquidationLiquidationDataStruct extends ethereum.Tuple { + get debtLiquidated(): BigInt { + return this[0].toBigInt(); + } + + get collateralLiquidated(): BigInt { + return this[1].toBigInt(); + } + + get amountRewarded(): BigInt { + return this[2].toBigInt(); + } +} + +export class MarketCollateralDeposited extends ethereum.Event { + get params(): MarketCollateralDeposited__Params { + return new MarketCollateralDeposited__Params(this); + } +} + +export class MarketCollateralDeposited__Params { + _event: MarketCollateralDeposited; + + constructor(event: MarketCollateralDeposited) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenAmount(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class MarketCollateralWithdrawn extends ethereum.Event { + get params(): MarketCollateralWithdrawn__Params { + return new MarketCollateralWithdrawn__Params(this); + } +} + +export class MarketCollateralWithdrawn__Params { + _event: MarketCollateralWithdrawn; + + constructor(event: MarketCollateralWithdrawn) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenAmount(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class MaximumMarketCollateralConfigured extends ethereum.Event { + get params(): MaximumMarketCollateralConfigured__Params { + return new MaximumMarketCollateralConfigured__Params(this); + } +} + +export class MaximumMarketCollateralConfigured__Params { + _event: MaximumMarketCollateralConfigured; + + constructor(event: MaximumMarketCollateralConfigured) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get systemAmount(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get owner(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class MarketRegistered extends ethereum.Event { + get params(): MarketRegistered__Params { + return new MarketRegistered__Params(this); + } +} + +export class MarketRegistered__Params { + _event: MarketRegistered; + + constructor(event: MarketRegistered) { + this._event = event; + } + + get market(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get marketId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[2].value.toAddress(); + } +} + +export class MarketSystemFeePaid extends ethereum.Event { + get params(): MarketSystemFeePaid__Params { + return new MarketSystemFeePaid__Params(this); + } +} + +export class MarketSystemFeePaid__Params { + _event: MarketSystemFeePaid; + + constructor(event: MarketSystemFeePaid) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get feeAmount(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class MarketUsdDeposited extends ethereum.Event { + get params(): MarketUsdDeposited__Params { + return new MarketUsdDeposited__Params(this); + } +} + +export class MarketUsdDeposited__Params { + _event: MarketUsdDeposited; + + constructor(event: MarketUsdDeposited) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get target(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get amount(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get market(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class MarketUsdWithdrawn extends ethereum.Event { + get params(): MarketUsdWithdrawn__Params { + return new MarketUsdWithdrawn__Params(this); + } +} + +export class MarketUsdWithdrawn__Params { + _event: MarketUsdWithdrawn; + + constructor(event: MarketUsdWithdrawn) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get target(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get amount(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get market(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class SetMarketMinLiquidityRatio extends ethereum.Event { + get params(): SetMarketMinLiquidityRatio__Params { + return new SetMarketMinLiquidityRatio__Params(this); + } +} + +export class SetMarketMinLiquidityRatio__Params { + _event: SetMarketMinLiquidityRatio; + + constructor(event: SetMarketMinLiquidityRatio) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get minLiquidityRatio(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class SetMinDelegateTime extends ethereum.Event { + get params(): SetMinDelegateTime__Params { + return new SetMinDelegateTime__Params(this); + } +} + +export class SetMinDelegateTime__Params { + _event: SetMinDelegateTime; + + constructor(event: SetMinDelegateTime) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get minDelegateTime(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class PoolApprovedAdded extends ethereum.Event { + get params(): PoolApprovedAdded__Params { + return new PoolApprovedAdded__Params(this); + } +} + +export class PoolApprovedAdded__Params { + _event: PoolApprovedAdded; + + constructor(event: PoolApprovedAdded) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } +} + +export class PoolApprovedRemoved extends ethereum.Event { + get params(): PoolApprovedRemoved__Params { + return new PoolApprovedRemoved__Params(this); + } +} + +export class PoolApprovedRemoved__Params { + _event: PoolApprovedRemoved; + + constructor(event: PoolApprovedRemoved) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } +} + +export class PreferredPoolSet extends ethereum.Event { + get params(): PreferredPoolSet__Params { + return new PreferredPoolSet__Params(this); + } +} + +export class PreferredPoolSet__Params { + _event: PreferredPoolSet; + + constructor(event: PreferredPoolSet) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } +} + +export class PoolCollateralConfigurationUpdated extends ethereum.Event { + get params(): PoolCollateralConfigurationUpdated__Params { + return new PoolCollateralConfigurationUpdated__Params(this); + } +} + +export class PoolCollateralConfigurationUpdated__Params { + _event: PoolCollateralConfigurationUpdated; + + constructor(event: PoolCollateralConfigurationUpdated) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get config(): PoolCollateralConfigurationUpdatedConfigStruct { + return changetype( + this._event.parameters[2].value.toTuple() + ); + } +} + +export class PoolCollateralConfigurationUpdatedConfigStruct extends ethereum.Tuple { + get collateralLimitD18(): BigInt { + return this[0].toBigInt(); + } + + get issuanceRatioD18(): BigInt { + return this[1].toBigInt(); + } +} + +export class PoolCollateralDisabledByDefaultSet extends ethereum.Event { + get params(): PoolCollateralDisabledByDefaultSet__Params { + return new PoolCollateralDisabledByDefaultSet__Params(this); + } +} + +export class PoolCollateralDisabledByDefaultSet__Params { + _event: PoolCollateralDisabledByDefaultSet; + + constructor(event: PoolCollateralDisabledByDefaultSet) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get disabled(): boolean { + return this._event.parameters[1].value.toBoolean(); + } +} + +export class PoolConfigurationSet extends ethereum.Event { + get params(): PoolConfigurationSet__Params { + return new PoolConfigurationSet__Params(this); + } +} + +export class PoolConfigurationSet__Params { + _event: PoolConfigurationSet; + + constructor(event: PoolConfigurationSet) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get markets(): Array { + return this._event.parameters[1].value.toTupleArray(); + } + + get sender(): Address { + return this._event.parameters[2].value.toAddress(); + } +} + +export class PoolConfigurationSetMarketsStruct extends ethereum.Tuple { + get marketId(): BigInt { + return this[0].toBigInt(); + } + + get weightD18(): BigInt { + return this[1].toBigInt(); + } + + get maxDebtShareValueD18(): BigInt { + return this[2].toBigInt(); + } +} + +export class PoolCreated extends ethereum.Event { + get params(): PoolCreated__Params { + return new PoolCreated__Params(this); + } +} + +export class PoolCreated__Params { + _event: PoolCreated; + + constructor(event: PoolCreated) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get owner(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get sender(): Address { + return this._event.parameters[2].value.toAddress(); + } +} + +export class PoolNameUpdated extends ethereum.Event { + get params(): PoolNameUpdated__Params { + return new PoolNameUpdated__Params(this); + } +} + +export class PoolNameUpdated__Params { + _event: PoolNameUpdated; + + constructor(event: PoolNameUpdated) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get name(): string { + return this._event.parameters[1].value.toString(); + } + + get sender(): Address { + return this._event.parameters[2].value.toAddress(); + } +} + +export class PoolNominationRenounced extends ethereum.Event { + get params(): PoolNominationRenounced__Params { + return new PoolNominationRenounced__Params(this); + } +} + +export class PoolNominationRenounced__Params { + _event: PoolNominationRenounced; + + constructor(event: PoolNominationRenounced) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get owner(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class PoolNominationRevoked extends ethereum.Event { + get params(): PoolNominationRevoked__Params { + return new PoolNominationRevoked__Params(this); + } +} + +export class PoolNominationRevoked__Params { + _event: PoolNominationRevoked; + + constructor(event: PoolNominationRevoked) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get owner(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class PoolOwnerNominated extends ethereum.Event { + get params(): PoolOwnerNominated__Params { + return new PoolOwnerNominated__Params(this); + } +} + +export class PoolOwnerNominated__Params { + _event: PoolOwnerNominated; + + constructor(event: PoolOwnerNominated) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get nominatedOwner(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get owner(): Address { + return this._event.parameters[2].value.toAddress(); + } +} + +export class PoolOwnershipAccepted extends ethereum.Event { + get params(): PoolOwnershipAccepted__Params { + return new PoolOwnershipAccepted__Params(this); + } +} + +export class PoolOwnershipAccepted__Params { + _event: PoolOwnershipAccepted; + + constructor(event: PoolOwnershipAccepted) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get owner(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class SetMinLiquidityRatio extends ethereum.Event { + get params(): SetMinLiquidityRatio__Params { + return new SetMinLiquidityRatio__Params(this); + } +} + +export class SetMinLiquidityRatio__Params { + _event: SetMinLiquidityRatio; + + constructor(event: SetMinLiquidityRatio) { + this._event = event; + } + + get minLiquidityRatio(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } +} + +export class RewardsClaimed extends ethereum.Event { + get params(): RewardsClaimed__Params { + return new RewardsClaimed__Params(this); + } +} + +export class RewardsClaimed__Params { + _event: RewardsClaimed; + + constructor(event: RewardsClaimed) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get distributor(): Address { + return this._event.parameters[3].value.toAddress(); + } + + get amount(): BigInt { + return this._event.parameters[4].value.toBigInt(); + } +} + +export class RewardsDistributed extends ethereum.Event { + get params(): RewardsDistributed__Params { + return new RewardsDistributed__Params(this); + } +} + +export class RewardsDistributed__Params { + _event: RewardsDistributed; + + constructor(event: RewardsDistributed) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get distributor(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get amount(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get start(): BigInt { + return this._event.parameters[4].value.toBigInt(); + } + + get duration(): BigInt { + return this._event.parameters[5].value.toBigInt(); + } +} + +export class RewardsDistributorRegistered extends ethereum.Event { + get params(): RewardsDistributorRegistered__Params { + return new RewardsDistributorRegistered__Params(this); + } +} + +export class RewardsDistributorRegistered__Params { + _event: RewardsDistributorRegistered; + + constructor(event: RewardsDistributorRegistered) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get distributor(): Address { + return this._event.parameters[2].value.toAddress(); + } +} + +export class RewardsDistributorRemoved extends ethereum.Event { + get params(): RewardsDistributorRemoved__Params { + return new RewardsDistributorRemoved__Params(this); + } +} + +export class RewardsDistributorRemoved__Params { + _event: RewardsDistributorRemoved; + + constructor(event: RewardsDistributorRemoved) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get distributor(): Address { + return this._event.parameters[2].value.toAddress(); + } +} + +export class NewSupportedCrossChainNetwork extends ethereum.Event { + get params(): NewSupportedCrossChainNetwork__Params { + return new NewSupportedCrossChainNetwork__Params(this); + } +} + +export class NewSupportedCrossChainNetwork__Params { + _event: NewSupportedCrossChainNetwork; + + constructor(event: NewSupportedCrossChainNetwork) { + this._event = event; + } + + get newChainId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } +} + +export class DelegationUpdated extends ethereum.Event { + get params(): DelegationUpdated__Params { + return new DelegationUpdated__Params(this); + } +} + +export class DelegationUpdated__Params { + _event: DelegationUpdated; + + constructor(event: DelegationUpdated) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get amount(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get leverage(): BigInt { + return this._event.parameters[4].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[5].value.toAddress(); + } +} + +export class CoreProxy__getAccountPermissionsResultAccountPermsStruct extends ethereum.Tuple { + get user(): Address { + return this[0].toAddress(); + } + + get permissions(): Array { + return this[1].toBytesArray(); + } +} + +export class CoreProxy__getAssociatedSystemResult { + value0: Address; + value1: Bytes; + + constructor(value0: Address, value1: Bytes) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromAddress(this.value0)); + map.set('value1', ethereum.Value.fromFixedBytes(this.value1)); + return map; + } + + getAddr(): Address { + return this.value0; + } + + getKind(): Bytes { + return this.value1; + } +} + +export class CoreProxy__getAccountCollateralResult { + value0: BigInt; + value1: BigInt; + value2: BigInt; + + constructor(value0: BigInt, value1: BigInt, value2: BigInt) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + map.set('value2', ethereum.Value.fromUnsignedBigInt(this.value2)); + return map; + } + + getTotalDeposited(): BigInt { + return this.value0; + } + + getTotalAssigned(): BigInt { + return this.value1; + } + + getTotalLocked(): BigInt { + return this.value2; + } +} + +export class CoreProxy__getLocksResultLocksStruct extends ethereum.Tuple { + get amountD18(): BigInt { + return this[0].toBigInt(); + } + + get lockExpirationTime(): BigInt { + return this[1].toBigInt(); + } +} + +export class CoreProxy__getCollateralConfigurationResultValue0Struct extends ethereum.Tuple { + get depositingEnabled(): boolean { + return this[0].toBoolean(); + } + + get issuanceRatioD18(): BigInt { + return this[1].toBigInt(); + } + + get liquidationRatioD18(): BigInt { + return this[2].toBigInt(); + } + + get liquidationRewardD18(): BigInt { + return this[3].toBigInt(); + } + + get oracleNodeId(): Bytes { + return this[4].toBytes(); + } + + get tokenAddress(): Address { + return this[5].toAddress(); + } + + get minDelegationD18(): BigInt { + return this[6].toBigInt(); + } +} + +export class CoreProxy__getCollateralConfigurationsResultValue0Struct extends ethereum.Tuple { + get depositingEnabled(): boolean { + return this[0].toBoolean(); + } + + get issuanceRatioD18(): BigInt { + return this[1].toBigInt(); + } + + get liquidationRatioD18(): BigInt { + return this[2].toBigInt(); + } + + get liquidationRewardD18(): BigInt { + return this[3].toBigInt(); + } + + get oracleNodeId(): Bytes { + return this[4].toBytes(); + } + + get tokenAddress(): Address { + return this[5].toAddress(); + } + + get minDelegationD18(): BigInt { + return this[6].toBigInt(); + } +} + +export class CoreProxy__liquidateResultLiquidationDataStruct extends ethereum.Tuple { + get debtLiquidated(): BigInt { + return this[0].toBigInt(); + } + + get collateralLiquidated(): BigInt { + return this[1].toBigInt(); + } + + get amountRewarded(): BigInt { + return this[2].toBigInt(); + } +} + +export class CoreProxy__liquidateVaultResultLiquidationDataStruct extends ethereum.Tuple { + get debtLiquidated(): BigInt { + return this[0].toBigInt(); + } + + get collateralLiquidated(): BigInt { + return this[1].toBigInt(); + } + + get amountRewarded(): BigInt { + return this[2].toBigInt(); + } +} + +export class CoreProxy__getMarketFeesResult { + value0: BigInt; + value1: BigInt; + + constructor(value0: BigInt, value1: BigInt) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + return map; + } + + getDepositFeeAmount(): BigInt { + return this.value0; + } + + getWithdrawFeeAmount(): BigInt { + return this.value1; + } +} + +export class CoreProxy__getMarketPoolDebtDistributionResult { + value0: BigInt; + value1: BigInt; + value2: BigInt; + + constructor(value0: BigInt, value1: BigInt, value2: BigInt) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + map.set('value2', ethereum.Value.fromSignedBigInt(this.value2)); + return map; + } + + getSharesD18(): BigInt { + return this.value0; + } + + getTotalSharesD18(): BigInt { + return this.value1; + } + + getValuePerShareD27(): BigInt { + return this.value2; + } +} + +export class CoreProxy__getMarketPoolsResult { + value0: Array; + value1: Array; + + constructor(value0: Array, value1: Array) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigIntArray(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigIntArray(this.value1)); + return map; + } + + getInRangePoolIds(): Array { + return this.value0; + } + + getOutRangePoolIds(): Array { + return this.value1; + } +} + +export class CoreProxy__getPoolConfigurationResultValue0Struct extends ethereum.Tuple { + get marketId(): BigInt { + return this[0].toBigInt(); + } + + get weightD18(): BigInt { + return this[1].toBigInt(); + } + + get maxDebtShareValueD18(): BigInt { + return this[2].toBigInt(); + } +} + +export class CoreProxy__updateRewardsResult { + value0: Array; + value1: Array
; + + constructor(value0: Array, value1: Array
) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigIntArray(this.value0)); + map.set('value1', ethereum.Value.fromAddressArray(this.value1)); + return map; + } + + getValue0(): Array { + return this.value0; + } + + getValue1(): Array
{ + return this.value1; + } +} + +export class CoreProxy__getPositionResult { + value0: BigInt; + value1: BigInt; + value2: BigInt; + value3: BigInt; + + constructor(value0: BigInt, value1: BigInt, value2: BigInt, value3: BigInt) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + this.value3 = value3; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + map.set('value2', ethereum.Value.fromSignedBigInt(this.value2)); + map.set('value3', ethereum.Value.fromUnsignedBigInt(this.value3)); + return map; + } + + getCollateralAmount(): BigInt { + return this.value0; + } + + getCollateralValue(): BigInt { + return this.value1; + } + + getDebt(): BigInt { + return this.value2; + } + + getCollateralizationRatio(): BigInt { + return this.value3; + } +} + +export class CoreProxy__getPositionCollateralResult { + value0: BigInt; + value1: BigInt; + + constructor(value0: BigInt, value1: BigInt) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + return map; + } + + getAmount(): BigInt { + return this.value0; + } + + getValue(): BigInt { + return this.value1; + } +} + +export class CoreProxy__getVaultCollateralResult { + value0: BigInt; + value1: BigInt; + + constructor(value0: BigInt, value1: BigInt) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + return map; + } + + getAmount(): BigInt { + return this.value0; + } + + getValue(): BigInt { + return this.value1; + } +} + +export class CoreProxy extends ethereum.SmartContract { + static bind(address: Address): CoreProxy { + return new CoreProxy('CoreProxy', address); + } + + getImplementation(): Address { + let result = super.call('getImplementation', 'getImplementation():(address)', []); + + return result[0].toAddress(); + } + + try_getImplementation(): ethereum.CallResult
{ + let result = super.tryCall('getImplementation', 'getImplementation():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + nominatedOwner(): Address { + let result = super.call('nominatedOwner', 'nominatedOwner():(address)', []); + + return result[0].toAddress(); + } + + try_nominatedOwner(): ethereum.CallResult
{ + let result = super.tryCall('nominatedOwner', 'nominatedOwner():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + owner(): Address { + let result = super.call('owner', 'owner():(address)', []); + + return result[0].toAddress(); + } + + try_owner(): ethereum.CallResult
{ + let result = super.tryCall('owner', 'owner():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + getDeniers(feature: Bytes): Array
{ + let result = super.call('getDeniers', 'getDeniers(bytes32):(address[])', [ + ethereum.Value.fromFixedBytes(feature), + ]); + + return result[0].toAddressArray(); + } + + try_getDeniers(feature: Bytes): ethereum.CallResult> { + let result = super.tryCall('getDeniers', 'getDeniers(bytes32):(address[])', [ + ethereum.Value.fromFixedBytes(feature), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddressArray()); + } + + getFeatureFlagAllowAll(feature: Bytes): boolean { + let result = super.call('getFeatureFlagAllowAll', 'getFeatureFlagAllowAll(bytes32):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ]); + + return result[0].toBoolean(); + } + + try_getFeatureFlagAllowAll(feature: Bytes): ethereum.CallResult { + let result = super.tryCall('getFeatureFlagAllowAll', 'getFeatureFlagAllowAll(bytes32):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + getFeatureFlagAllowlist(feature: Bytes): Array
{ + let result = super.call( + 'getFeatureFlagAllowlist', + 'getFeatureFlagAllowlist(bytes32):(address[])', + [ethereum.Value.fromFixedBytes(feature)] + ); + + return result[0].toAddressArray(); + } + + try_getFeatureFlagAllowlist(feature: Bytes): ethereum.CallResult> { + let result = super.tryCall( + 'getFeatureFlagAllowlist', + 'getFeatureFlagAllowlist(bytes32):(address[])', + [ethereum.Value.fromFixedBytes(feature)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddressArray()); + } + + getFeatureFlagDenyAll(feature: Bytes): boolean { + let result = super.call('getFeatureFlagDenyAll', 'getFeatureFlagDenyAll(bytes32):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ]); + + return result[0].toBoolean(); + } + + try_getFeatureFlagDenyAll(feature: Bytes): ethereum.CallResult { + let result = super.tryCall('getFeatureFlagDenyAll', 'getFeatureFlagDenyAll(bytes32):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + isFeatureAllowed(feature: Bytes, account: Address): boolean { + let result = super.call('isFeatureAllowed', 'isFeatureAllowed(bytes32,address):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ethereum.Value.fromAddress(account), + ]); + + return result[0].toBoolean(); + } + + try_isFeatureAllowed(feature: Bytes, account: Address): ethereum.CallResult { + let result = super.tryCall('isFeatureAllowed', 'isFeatureAllowed(bytes32,address):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ethereum.Value.fromAddress(account), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + createAccount(): BigInt { + let result = super.call('createAccount', 'createAccount():(uint128)', []); + + return result[0].toBigInt(); + } + + try_createAccount(): ethereum.CallResult { + let result = super.tryCall('createAccount', 'createAccount():(uint128)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getAccountLastInteraction(accountId: BigInt): BigInt { + let result = super.call( + 'getAccountLastInteraction', + 'getAccountLastInteraction(uint128):(uint256)', + [ethereum.Value.fromUnsignedBigInt(accountId)] + ); + + return result[0].toBigInt(); + } + + try_getAccountLastInteraction(accountId: BigInt): ethereum.CallResult { + let result = super.tryCall( + 'getAccountLastInteraction', + 'getAccountLastInteraction(uint128):(uint256)', + [ethereum.Value.fromUnsignedBigInt(accountId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getAccountOwner(accountId: BigInt): Address { + let result = super.call('getAccountOwner', 'getAccountOwner(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ]); + + return result[0].toAddress(); + } + + try_getAccountOwner(accountId: BigInt): ethereum.CallResult
{ + let result = super.tryCall('getAccountOwner', 'getAccountOwner(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + getAccountPermissions( + accountId: BigInt + ): Array { + let result = super.call( + 'getAccountPermissions', + 'getAccountPermissions(uint128):((address,bytes32[])[])', + [ethereum.Value.fromUnsignedBigInt(accountId)] + ); + + return result[0].toTupleArray(); + } + + try_getAccountPermissions( + accountId: BigInt + ): ethereum.CallResult> { + let result = super.tryCall( + 'getAccountPermissions', + 'getAccountPermissions(uint128):((address,bytes32[])[])', + [ethereum.Value.fromUnsignedBigInt(accountId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + value[0].toTupleArray() + ); + } + + getAccountTokenAddress(): Address { + let result = super.call('getAccountTokenAddress', 'getAccountTokenAddress():(address)', []); + + return result[0].toAddress(); + } + + try_getAccountTokenAddress(): ethereum.CallResult
{ + let result = super.tryCall('getAccountTokenAddress', 'getAccountTokenAddress():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + hasPermission(accountId: BigInt, permission: Bytes, user: Address): boolean { + let result = super.call('hasPermission', 'hasPermission(uint128,bytes32,address):(bool)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromFixedBytes(permission), + ethereum.Value.fromAddress(user), + ]); + + return result[0].toBoolean(); + } + + try_hasPermission( + accountId: BigInt, + permission: Bytes, + user: Address + ): ethereum.CallResult { + let result = super.tryCall('hasPermission', 'hasPermission(uint128,bytes32,address):(bool)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromFixedBytes(permission), + ethereum.Value.fromAddress(user), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + isAuthorized(accountId: BigInt, permission: Bytes, user: Address): boolean { + let result = super.call('isAuthorized', 'isAuthorized(uint128,bytes32,address):(bool)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromFixedBytes(permission), + ethereum.Value.fromAddress(user), + ]); + + return result[0].toBoolean(); + } + + try_isAuthorized( + accountId: BigInt, + permission: Bytes, + user: Address + ): ethereum.CallResult { + let result = super.tryCall('isAuthorized', 'isAuthorized(uint128,bytes32,address):(bool)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromFixedBytes(permission), + ethereum.Value.fromAddress(user), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + associateDebt( + marketId: BigInt, + poolId: BigInt, + collateralType: Address, + accountId: BigInt, + amount: BigInt + ): BigInt { + let result = super.call( + 'associateDebt', + 'associateDebt(uint128,uint128,address,uint128,uint256):(int256)', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(amount), + ] + ); + + return result[0].toBigInt(); + } + + try_associateDebt( + marketId: BigInt, + poolId: BigInt, + collateralType: Address, + accountId: BigInt, + amount: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'associateDebt', + 'associateDebt(uint128,uint128,address,uint128,uint256):(int256)', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(amount), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getAssociatedSystem(id: Bytes): CoreProxy__getAssociatedSystemResult { + let result = super.call( + 'getAssociatedSystem', + 'getAssociatedSystem(bytes32):(address,bytes32)', + [ethereum.Value.fromFixedBytes(id)] + ); + + return new CoreProxy__getAssociatedSystemResult(result[0].toAddress(), result[1].toBytes()); + } + + try_getAssociatedSystem(id: Bytes): ethereum.CallResult { + let result = super.tryCall( + 'getAssociatedSystem', + 'getAssociatedSystem(bytes32):(address,bytes32)', + [ethereum.Value.fromFixedBytes(id)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__getAssociatedSystemResult(value[0].toAddress(), value[1].toBytes()) + ); + } + + cleanExpiredLocks( + accountId: BigInt, + collateralType: Address, + offset: BigInt, + count: BigInt + ): BigInt { + let result = super.call( + 'cleanExpiredLocks', + 'cleanExpiredLocks(uint128,address,uint256,uint256):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(offset), + ethereum.Value.fromUnsignedBigInt(count), + ] + ); + + return result[0].toBigInt(); + } + + try_cleanExpiredLocks( + accountId: BigInt, + collateralType: Address, + offset: BigInt, + count: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'cleanExpiredLocks', + 'cleanExpiredLocks(uint128,address,uint256,uint256):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(offset), + ethereum.Value.fromUnsignedBigInt(count), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getAccountAvailableCollateral(accountId: BigInt, collateralType: Address): BigInt { + let result = super.call( + 'getAccountAvailableCollateral', + 'getAccountAvailableCollateral(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(accountId), ethereum.Value.fromAddress(collateralType)] + ); + + return result[0].toBigInt(); + } + + try_getAccountAvailableCollateral( + accountId: BigInt, + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getAccountAvailableCollateral', + 'getAccountAvailableCollateral(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(accountId), ethereum.Value.fromAddress(collateralType)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getAccountCollateral( + accountId: BigInt, + collateralType: Address + ): CoreProxy__getAccountCollateralResult { + let result = super.call( + 'getAccountCollateral', + 'getAccountCollateral(uint128,address):(uint256,uint256,uint256)', + [ethereum.Value.fromUnsignedBigInt(accountId), ethereum.Value.fromAddress(collateralType)] + ); + + return new CoreProxy__getAccountCollateralResult( + result[0].toBigInt(), + result[1].toBigInt(), + result[2].toBigInt() + ); + } + + try_getAccountCollateral( + accountId: BigInt, + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getAccountCollateral', + 'getAccountCollateral(uint128,address):(uint256,uint256,uint256)', + [ethereum.Value.fromUnsignedBigInt(accountId), ethereum.Value.fromAddress(collateralType)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__getAccountCollateralResult( + value[0].toBigInt(), + value[1].toBigInt(), + value[2].toBigInt() + ) + ); + } + + getLocks( + accountId: BigInt, + collateralType: Address, + offset: BigInt, + count: BigInt + ): Array { + let result = super.call( + 'getLocks', + 'getLocks(uint128,address,uint256,uint256):((uint128,uint64)[])', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(offset), + ethereum.Value.fromUnsignedBigInt(count), + ] + ); + + return result[0].toTupleArray(); + } + + try_getLocks( + accountId: BigInt, + collateralType: Address, + offset: BigInt, + count: BigInt + ): ethereum.CallResult> { + let result = super.tryCall( + 'getLocks', + 'getLocks(uint128,address,uint256,uint256):((uint128,uint64)[])', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(offset), + ethereum.Value.fromUnsignedBigInt(count), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + value[0].toTupleArray() + ); + } + + getCollateralConfiguration( + collateralType: Address + ): CoreProxy__getCollateralConfigurationResultValue0Struct { + let result = super.call( + 'getCollateralConfiguration', + 'getCollateralConfiguration(address):((bool,uint256,uint256,uint256,bytes32,address,uint256))', + [ethereum.Value.fromAddress(collateralType)] + ); + + return changetype(result[0].toTuple()); + } + + try_getCollateralConfiguration( + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getCollateralConfiguration', + 'getCollateralConfiguration(address):((bool,uint256,uint256,uint256,bytes32,address,uint256))', + [ethereum.Value.fromAddress(collateralType)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + changetype(value[0].toTuple()) + ); + } + + getCollateralConfigurations( + hideDisabled: boolean + ): Array { + let result = super.call( + 'getCollateralConfigurations', + 'getCollateralConfigurations(bool):((bool,uint256,uint256,uint256,bytes32,address,uint256)[])', + [ethereum.Value.fromBoolean(hideDisabled)] + ); + + return result[0].toTupleArray(); + } + + try_getCollateralConfigurations( + hideDisabled: boolean + ): ethereum.CallResult> { + let result = super.tryCall( + 'getCollateralConfigurations', + 'getCollateralConfigurations(bool):((bool,uint256,uint256,uint256,bytes32,address,uint256)[])', + [ethereum.Value.fromBoolean(hideDisabled)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + value[0].toTupleArray() + ); + } + + getCollateralPrice(collateralType: Address, collateralAmount: BigInt): BigInt { + let result = super.call('getCollateralPrice', 'getCollateralPrice(address,uint256):(uint256)', [ + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(collateralAmount), + ]); + + return result[0].toBigInt(); + } + + try_getCollateralPrice( + collateralType: Address, + collateralAmount: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'getCollateralPrice', + 'getCollateralPrice(address,uint256):(uint256)', + [ + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(collateralAmount), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + isPositionLiquidatable(accountId: BigInt, poolId: BigInt, collateralType: Address): boolean { + let result = super.call( + 'isPositionLiquidatable', + 'isPositionLiquidatable(uint128,uint128,address):(bool)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ] + ); + + return result[0].toBoolean(); + } + + try_isPositionLiquidatable( + accountId: BigInt, + poolId: BigInt, + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'isPositionLiquidatable', + 'isPositionLiquidatable(uint128,uint128,address):(bool)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + isVaultLiquidatable(poolId: BigInt, collateralType: Address): boolean { + let result = super.call('isVaultLiquidatable', 'isVaultLiquidatable(uint128,address):(bool)', [ + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ]); + + return result[0].toBoolean(); + } + + try_isVaultLiquidatable(poolId: BigInt, collateralType: Address): ethereum.CallResult { + let result = super.tryCall( + 'isVaultLiquidatable', + 'isVaultLiquidatable(uint128,address):(bool)', + [ethereum.Value.fromUnsignedBigInt(poolId), ethereum.Value.fromAddress(collateralType)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + liquidate( + accountId: BigInt, + poolId: BigInt, + collateralType: Address, + liquidateAsAccountId: BigInt + ): CoreProxy__liquidateResultLiquidationDataStruct { + let result = super.call( + 'liquidate', + 'liquidate(uint128,uint128,address,uint128):((uint256,uint256,uint256))', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(liquidateAsAccountId), + ] + ); + + return changetype(result[0].toTuple()); + } + + try_liquidate( + accountId: BigInt, + poolId: BigInt, + collateralType: Address, + liquidateAsAccountId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'liquidate', + 'liquidate(uint128,uint128,address,uint128):((uint256,uint256,uint256))', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(liquidateAsAccountId), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + changetype(value[0].toTuple()) + ); + } + + liquidateVault( + poolId: BigInt, + collateralType: Address, + liquidateAsAccountId: BigInt, + maxUsd: BigInt + ): CoreProxy__liquidateVaultResultLiquidationDataStruct { + let result = super.call( + 'liquidateVault', + 'liquidateVault(uint128,address,uint128,uint256):((uint256,uint256,uint256))', + [ + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(liquidateAsAccountId), + ethereum.Value.fromUnsignedBigInt(maxUsd), + ] + ); + + return changetype(result[0].toTuple()); + } + + try_liquidateVault( + poolId: BigInt, + collateralType: Address, + liquidateAsAccountId: BigInt, + maxUsd: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'liquidateVault', + 'liquidateVault(uint128,address,uint128,uint256):((uint256,uint256,uint256))', + [ + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(liquidateAsAccountId), + ethereum.Value.fromUnsignedBigInt(maxUsd), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + changetype(value[0].toTuple()) + ); + } + + getMarketCollateralAmount(marketId: BigInt, collateralType: Address): BigInt { + let result = super.call( + 'getMarketCollateralAmount', + 'getMarketCollateralAmount(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromAddress(collateralType)] + ); + + return result[0].toBigInt(); + } + + try_getMarketCollateralAmount( + marketId: BigInt, + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getMarketCollateralAmount', + 'getMarketCollateralAmount(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromAddress(collateralType)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getMarketCollateralValue(marketId: BigInt): BigInt { + let result = super.call( + 'getMarketCollateralValue', + 'getMarketCollateralValue(uint128):(uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + + return result[0].toBigInt(); + } + + try_getMarketCollateralValue(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall( + 'getMarketCollateralValue', + 'getMarketCollateralValue(uint128):(uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getMaximumMarketCollateral(marketId: BigInt, collateralType: Address): BigInt { + let result = super.call( + 'getMaximumMarketCollateral', + 'getMaximumMarketCollateral(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromAddress(collateralType)] + ); + + return result[0].toBigInt(); + } + + try_getMaximumMarketCollateral( + marketId: BigInt, + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getMaximumMarketCollateral', + 'getMaximumMarketCollateral(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromAddress(collateralType)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + depositMarketUsd(marketId: BigInt, target: Address, amount: BigInt): BigInt { + let result = super.call( + 'depositMarketUsd', + 'depositMarketUsd(uint128,address,uint256):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromAddress(target), + ethereum.Value.fromUnsignedBigInt(amount), + ] + ); + + return result[0].toBigInt(); + } + + try_depositMarketUsd( + marketId: BigInt, + target: Address, + amount: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'depositMarketUsd', + 'depositMarketUsd(uint128,address,uint256):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromAddress(target), + ethereum.Value.fromUnsignedBigInt(amount), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + distributeDebtToPools(marketId: BigInt, maxIter: BigInt): boolean { + let result = super.call( + 'distributeDebtToPools', + 'distributeDebtToPools(uint128,uint256):(bool)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(maxIter)] + ); + + return result[0].toBoolean(); + } + + try_distributeDebtToPools(marketId: BigInt, maxIter: BigInt): ethereum.CallResult { + let result = super.tryCall( + 'distributeDebtToPools', + 'distributeDebtToPools(uint128,uint256):(bool)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(maxIter)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + getMarketAddress(marketId: BigInt): Address { + let result = super.call('getMarketAddress', 'getMarketAddress(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toAddress(); + } + + try_getMarketAddress(marketId: BigInt): ethereum.CallResult
{ + let result = super.tryCall('getMarketAddress', 'getMarketAddress(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + getMarketCollateral(marketId: BigInt): BigInt { + let result = super.call('getMarketCollateral', 'getMarketCollateral(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBigInt(); + } + + try_getMarketCollateral(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('getMarketCollateral', 'getMarketCollateral(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getMarketDebtPerShare(marketId: BigInt): BigInt { + let result = super.call('getMarketDebtPerShare', 'getMarketDebtPerShare(uint128):(int256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBigInt(); + } + + try_getMarketDebtPerShare(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('getMarketDebtPerShare', 'getMarketDebtPerShare(uint128):(int256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getMarketFees(param0: BigInt, amount: BigInt): CoreProxy__getMarketFeesResult { + let result = super.call('getMarketFees', 'getMarketFees(uint128,uint256):(uint256,uint256)', [ + ethereum.Value.fromUnsignedBigInt(param0), + ethereum.Value.fromUnsignedBigInt(amount), + ]); + + return new CoreProxy__getMarketFeesResult(result[0].toBigInt(), result[1].toBigInt()); + } + + try_getMarketFees( + param0: BigInt, + amount: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'getMarketFees', + 'getMarketFees(uint128,uint256):(uint256,uint256)', + [ethereum.Value.fromUnsignedBigInt(param0), ethereum.Value.fromUnsignedBigInt(amount)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__getMarketFeesResult(value[0].toBigInt(), value[1].toBigInt()) + ); + } + + getMarketMinDelegateTime(marketId: BigInt): BigInt { + let result = super.call( + 'getMarketMinDelegateTime', + 'getMarketMinDelegateTime(uint128):(uint32)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + + return result[0].toBigInt(); + } + + try_getMarketMinDelegateTime(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall( + 'getMarketMinDelegateTime', + 'getMarketMinDelegateTime(uint128):(uint32)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getMarketNetIssuance(marketId: BigInt): BigInt { + let result = super.call('getMarketNetIssuance', 'getMarketNetIssuance(uint128):(int128)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBigInt(); + } + + try_getMarketNetIssuance(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('getMarketNetIssuance', 'getMarketNetIssuance(uint128):(int128)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getMarketPoolDebtDistribution( + marketId: BigInt, + poolId: BigInt + ): CoreProxy__getMarketPoolDebtDistributionResult { + let result = super.call( + 'getMarketPoolDebtDistribution', + 'getMarketPoolDebtDistribution(uint128,uint128):(uint256,uint128,int128)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(poolId)] + ); + + return new CoreProxy__getMarketPoolDebtDistributionResult( + result[0].toBigInt(), + result[1].toBigInt(), + result[2].toBigInt() + ); + } + + try_getMarketPoolDebtDistribution( + marketId: BigInt, + poolId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'getMarketPoolDebtDistribution', + 'getMarketPoolDebtDistribution(uint128,uint128):(uint256,uint128,int128)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(poolId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__getMarketPoolDebtDistributionResult( + value[0].toBigInt(), + value[1].toBigInt(), + value[2].toBigInt() + ) + ); + } + + getMarketPools(marketId: BigInt): CoreProxy__getMarketPoolsResult { + let result = super.call('getMarketPools', 'getMarketPools(uint128):(uint128[],uint128[])', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return new CoreProxy__getMarketPoolsResult( + result[0].toBigIntArray(), + result[1].toBigIntArray() + ); + } + + try_getMarketPools(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('getMarketPools', 'getMarketPools(uint128):(uint128[],uint128[])', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__getMarketPoolsResult(value[0].toBigIntArray(), value[1].toBigIntArray()) + ); + } + + getMarketReportedDebt(marketId: BigInt): BigInt { + let result = super.call('getMarketReportedDebt', 'getMarketReportedDebt(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBigInt(); + } + + try_getMarketReportedDebt(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall( + 'getMarketReportedDebt', + 'getMarketReportedDebt(uint128):(uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getMarketTotalDebt(marketId: BigInt): BigInt { + let result = super.call('getMarketTotalDebt', 'getMarketTotalDebt(uint128):(int256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBigInt(); + } + + try_getMarketTotalDebt(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('getMarketTotalDebt', 'getMarketTotalDebt(uint128):(int256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getMinLiquidityRatio(marketId: BigInt): BigInt { + let result = super.call('getMinLiquidityRatio', 'getMinLiquidityRatio(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBigInt(); + } + + try_getMinLiquidityRatio(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('getMinLiquidityRatio', 'getMinLiquidityRatio(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getOracleManager(): Address { + let result = super.call('getOracleManager', 'getOracleManager():(address)', []); + + return result[0].toAddress(); + } + + try_getOracleManager(): ethereum.CallResult
{ + let result = super.tryCall('getOracleManager', 'getOracleManager():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + getUsdToken(): Address { + let result = super.call('getUsdToken', 'getUsdToken():(address)', []); + + return result[0].toAddress(); + } + + try_getUsdToken(): ethereum.CallResult
{ + let result = super.tryCall('getUsdToken', 'getUsdToken():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + getWithdrawableMarketUsd(marketId: BigInt): BigInt { + let result = super.call( + 'getWithdrawableMarketUsd', + 'getWithdrawableMarketUsd(uint128):(uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + + return result[0].toBigInt(); + } + + try_getWithdrawableMarketUsd(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall( + 'getWithdrawableMarketUsd', + 'getWithdrawableMarketUsd(uint128):(uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + isMarketCapacityLocked(marketId: BigInt): boolean { + let result = super.call('isMarketCapacityLocked', 'isMarketCapacityLocked(uint128):(bool)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBoolean(); + } + + try_isMarketCapacityLocked(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('isMarketCapacityLocked', 'isMarketCapacityLocked(uint128):(bool)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + registerMarket(market: Address): BigInt { + let result = super.call('registerMarket', 'registerMarket(address):(uint128)', [ + ethereum.Value.fromAddress(market), + ]); + + return result[0].toBigInt(); + } + + try_registerMarket(market: Address): ethereum.CallResult { + let result = super.tryCall('registerMarket', 'registerMarket(address):(uint128)', [ + ethereum.Value.fromAddress(market), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + withdrawMarketUsd(marketId: BigInt, target: Address, amount: BigInt): BigInt { + let result = super.call( + 'withdrawMarketUsd', + 'withdrawMarketUsd(uint128,address,uint256):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromAddress(target), + ethereum.Value.fromUnsignedBigInt(amount), + ] + ); + + return result[0].toBigInt(); + } + + try_withdrawMarketUsd( + marketId: BigInt, + target: Address, + amount: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'withdrawMarketUsd', + 'withdrawMarketUsd(uint128,address,uint256):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromAddress(target), + ethereum.Value.fromUnsignedBigInt(amount), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getApprovedPools(): Array { + let result = super.call('getApprovedPools', 'getApprovedPools():(uint256[])', []); + + return result[0].toBigIntArray(); + } + + try_getApprovedPools(): ethereum.CallResult> { + let result = super.tryCall('getApprovedPools', 'getApprovedPools():(uint256[])', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigIntArray()); + } + + getPreferredPool(): BigInt { + let result = super.call('getPreferredPool', 'getPreferredPool():(uint128)', []); + + return result[0].toBigInt(); + } + + try_getPreferredPool(): ethereum.CallResult { + let result = super.tryCall('getPreferredPool', 'getPreferredPool():(uint128)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getMinLiquidityRatio1(): BigInt { + let result = super.call('getMinLiquidityRatio', 'getMinLiquidityRatio():(uint256)', []); + + return result[0].toBigInt(); + } + + try_getMinLiquidityRatio1(): ethereum.CallResult { + let result = super.tryCall('getMinLiquidityRatio', 'getMinLiquidityRatio():(uint256)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getNominatedPoolOwner(poolId: BigInt): Address { + let result = super.call('getNominatedPoolOwner', 'getNominatedPoolOwner(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(poolId), + ]); + + return result[0].toAddress(); + } + + try_getNominatedPoolOwner(poolId: BigInt): ethereum.CallResult
{ + let result = super.tryCall( + 'getNominatedPoolOwner', + 'getNominatedPoolOwner(uint128):(address)', + [ethereum.Value.fromUnsignedBigInt(poolId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + getPoolCollateralIssuanceRatio(poolId: BigInt, collateral: Address): BigInt { + let result = super.call( + 'getPoolCollateralIssuanceRatio', + 'getPoolCollateralIssuanceRatio(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(poolId), ethereum.Value.fromAddress(collateral)] + ); + + return result[0].toBigInt(); + } + + try_getPoolCollateralIssuanceRatio( + poolId: BigInt, + collateral: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getPoolCollateralIssuanceRatio', + 'getPoolCollateralIssuanceRatio(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(poolId), ethereum.Value.fromAddress(collateral)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getPoolConfiguration(poolId: BigInt): Array { + let result = super.call( + 'getPoolConfiguration', + 'getPoolConfiguration(uint128):((uint128,uint128,int128)[])', + [ethereum.Value.fromUnsignedBigInt(poolId)] + ); + + return result[0].toTupleArray(); + } + + try_getPoolConfiguration( + poolId: BigInt + ): ethereum.CallResult> { + let result = super.tryCall( + 'getPoolConfiguration', + 'getPoolConfiguration(uint128):((uint128,uint128,int128)[])', + [ethereum.Value.fromUnsignedBigInt(poolId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + value[0].toTupleArray() + ); + } + + getPoolName(poolId: BigInt): string { + let result = super.call('getPoolName', 'getPoolName(uint128):(string)', [ + ethereum.Value.fromUnsignedBigInt(poolId), + ]); + + return result[0].toString(); + } + + try_getPoolName(poolId: BigInt): ethereum.CallResult { + let result = super.tryCall('getPoolName', 'getPoolName(uint128):(string)', [ + ethereum.Value.fromUnsignedBigInt(poolId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toString()); + } + + getPoolOwner(poolId: BigInt): Address { + let result = super.call('getPoolOwner', 'getPoolOwner(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(poolId), + ]); + + return result[0].toAddress(); + } + + try_getPoolOwner(poolId: BigInt): ethereum.CallResult
{ + let result = super.tryCall('getPoolOwner', 'getPoolOwner(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(poolId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + claimRewards( + accountId: BigInt, + poolId: BigInt, + collateralType: Address, + distributor: Address + ): BigInt { + let result = super.call( + 'claimRewards', + 'claimRewards(uint128,uint128,address,address):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromAddress(distributor), + ] + ); + + return result[0].toBigInt(); + } + + try_claimRewards( + accountId: BigInt, + poolId: BigInt, + collateralType: Address, + distributor: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'claimRewards', + 'claimRewards(uint128,uint128,address,address):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromAddress(distributor), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getRewardRate(poolId: BigInt, collateralType: Address, distributor: Address): BigInt { + let result = super.call('getRewardRate', 'getRewardRate(uint128,address,address):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromAddress(distributor), + ]); + + return result[0].toBigInt(); + } + + try_getRewardRate( + poolId: BigInt, + collateralType: Address, + distributor: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getRewardRate', + 'getRewardRate(uint128,address,address):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromAddress(distributor), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + updateRewards( + poolId: BigInt, + collateralType: Address, + accountId: BigInt + ): CoreProxy__updateRewardsResult { + let result = super.call( + 'updateRewards', + 'updateRewards(uint128,address,uint128):(uint256[],address[])', + [ + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(accountId), + ] + ); + + return new CoreProxy__updateRewardsResult( + result[0].toBigIntArray(), + result[1].toAddressArray() + ); + } + + try_updateRewards( + poolId: BigInt, + collateralType: Address, + accountId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'updateRewards', + 'updateRewards(uint128,address,uint128):(uint256[],address[])', + [ + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(accountId), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__updateRewardsResult(value[0].toBigIntArray(), value[1].toAddressArray()) + ); + } + + getConfig(k: Bytes): Bytes { + let result = super.call('getConfig', 'getConfig(bytes32):(bytes32)', [ + ethereum.Value.fromFixedBytes(k), + ]); + + return result[0].toBytes(); + } + + try_getConfig(k: Bytes): ethereum.CallResult { + let result = super.tryCall('getConfig', 'getConfig(bytes32):(bytes32)', [ + ethereum.Value.fromFixedBytes(k), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBytes()); + } + + getConfigAddress(k: Bytes): Address { + let result = super.call('getConfigAddress', 'getConfigAddress(bytes32):(address)', [ + ethereum.Value.fromFixedBytes(k), + ]); + + return result[0].toAddress(); + } + + try_getConfigAddress(k: Bytes): ethereum.CallResult
{ + let result = super.tryCall('getConfigAddress', 'getConfigAddress(bytes32):(address)', [ + ethereum.Value.fromFixedBytes(k), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + getConfigUint(k: Bytes): BigInt { + let result = super.call('getConfigUint', 'getConfigUint(bytes32):(uint256)', [ + ethereum.Value.fromFixedBytes(k), + ]); + + return result[0].toBigInt(); + } + + try_getConfigUint(k: Bytes): ethereum.CallResult { + let result = super.tryCall('getConfigUint', 'getConfigUint(bytes32):(uint256)', [ + ethereum.Value.fromFixedBytes(k), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getTrustedForwarder(): Address { + let result = super.call('getTrustedForwarder', 'getTrustedForwarder():(address)', []); + + return result[0].toAddress(); + } + + try_getTrustedForwarder(): ethereum.CallResult
{ + let result = super.tryCall('getTrustedForwarder', 'getTrustedForwarder():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + isTrustedForwarder(forwarder: Address): boolean { + let result = super.call('isTrustedForwarder', 'isTrustedForwarder(address):(bool)', [ + ethereum.Value.fromAddress(forwarder), + ]); + + return result[0].toBoolean(); + } + + try_isTrustedForwarder(forwarder: Address): ethereum.CallResult { + let result = super.tryCall('isTrustedForwarder', 'isTrustedForwarder(address):(bool)', [ + ethereum.Value.fromAddress(forwarder), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + setSupportedCrossChainNetworks( + supportedNetworks: Array, + ccipSelectors: Array + ): BigInt { + let result = super.call( + 'setSupportedCrossChainNetworks', + 'setSupportedCrossChainNetworks(uint64[],uint64[]):(uint256)', + [ + ethereum.Value.fromUnsignedBigIntArray(supportedNetworks), + ethereum.Value.fromUnsignedBigIntArray(ccipSelectors), + ] + ); + + return result[0].toBigInt(); + } + + try_setSupportedCrossChainNetworks( + supportedNetworks: Array, + ccipSelectors: Array + ): ethereum.CallResult { + let result = super.tryCall( + 'setSupportedCrossChainNetworks', + 'setSupportedCrossChainNetworks(uint64[],uint64[]):(uint256)', + [ + ethereum.Value.fromUnsignedBigIntArray(supportedNetworks), + ethereum.Value.fromUnsignedBigIntArray(ccipSelectors), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + supportsInterface(interfaceId: Bytes): boolean { + let result = super.call('supportsInterface', 'supportsInterface(bytes4):(bool)', [ + ethereum.Value.fromFixedBytes(interfaceId), + ]); + + return result[0].toBoolean(); + } + + try_supportsInterface(interfaceId: Bytes): ethereum.CallResult { + let result = super.tryCall('supportsInterface', 'supportsInterface(bytes4):(bool)', [ + ethereum.Value.fromFixedBytes(interfaceId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + getPosition( + accountId: BigInt, + poolId: BigInt, + collateralType: Address + ): CoreProxy__getPositionResult { + let result = super.call( + 'getPosition', + 'getPosition(uint128,uint128,address):(uint256,uint256,int256,uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ] + ); + + return new CoreProxy__getPositionResult( + result[0].toBigInt(), + result[1].toBigInt(), + result[2].toBigInt(), + result[3].toBigInt() + ); + } + + try_getPosition( + accountId: BigInt, + poolId: BigInt, + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getPosition', + 'getPosition(uint128,uint128,address):(uint256,uint256,int256,uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__getPositionResult( + value[0].toBigInt(), + value[1].toBigInt(), + value[2].toBigInt(), + value[3].toBigInt() + ) + ); + } + + getPositionCollateral( + accountId: BigInt, + poolId: BigInt, + collateralType: Address + ): CoreProxy__getPositionCollateralResult { + let result = super.call( + 'getPositionCollateral', + 'getPositionCollateral(uint128,uint128,address):(uint256,uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ] + ); + + return new CoreProxy__getPositionCollateralResult(result[0].toBigInt(), result[1].toBigInt()); + } + + try_getPositionCollateral( + accountId: BigInt, + poolId: BigInt, + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getPositionCollateral', + 'getPositionCollateral(uint128,uint128,address):(uint256,uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__getPositionCollateralResult(value[0].toBigInt(), value[1].toBigInt()) + ); + } + + getPositionCollateralRatio(accountId: BigInt, poolId: BigInt, collateralType: Address): BigInt { + let result = super.call( + 'getPositionCollateralRatio', + 'getPositionCollateralRatio(uint128,uint128,address):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ] + ); + + return result[0].toBigInt(); + } + + try_getPositionCollateralRatio( + accountId: BigInt, + poolId: BigInt, + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getPositionCollateralRatio', + 'getPositionCollateralRatio(uint128,uint128,address):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getPositionDebt(accountId: BigInt, poolId: BigInt, collateralType: Address): BigInt { + let result = super.call( + 'getPositionDebt', + 'getPositionDebt(uint128,uint128,address):(int256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ] + ); + + return result[0].toBigInt(); + } + + try_getPositionDebt( + accountId: BigInt, + poolId: BigInt, + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getPositionDebt', + 'getPositionDebt(uint128,uint128,address):(int256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getVaultCollateral(poolId: BigInt, collateralType: Address): CoreProxy__getVaultCollateralResult { + let result = super.call( + 'getVaultCollateral', + 'getVaultCollateral(uint128,address):(uint256,uint256)', + [ethereum.Value.fromUnsignedBigInt(poolId), ethereum.Value.fromAddress(collateralType)] + ); + + return new CoreProxy__getVaultCollateralResult(result[0].toBigInt(), result[1].toBigInt()); + } + + try_getVaultCollateral( + poolId: BigInt, + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getVaultCollateral', + 'getVaultCollateral(uint128,address):(uint256,uint256)', + [ethereum.Value.fromUnsignedBigInt(poolId), ethereum.Value.fromAddress(collateralType)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__getVaultCollateralResult(value[0].toBigInt(), value[1].toBigInt()) + ); + } + + getVaultCollateralRatio(poolId: BigInt, collateralType: Address): BigInt { + let result = super.call( + 'getVaultCollateralRatio', + 'getVaultCollateralRatio(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(poolId), ethereum.Value.fromAddress(collateralType)] + ); + + return result[0].toBigInt(); + } + + try_getVaultCollateralRatio( + poolId: BigInt, + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getVaultCollateralRatio', + 'getVaultCollateralRatio(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(poolId), ethereum.Value.fromAddress(collateralType)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getVaultDebt(poolId: BigInt, collateralType: Address): BigInt { + let result = super.call('getVaultDebt', 'getVaultDebt(uint128,address):(int256)', [ + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ]); + + return result[0].toBigInt(); + } + + try_getVaultDebt(poolId: BigInt, collateralType: Address): ethereum.CallResult { + let result = super.tryCall('getVaultDebt', 'getVaultDebt(uint128,address):(int256)', [ + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } +} + +export class AcceptOwnershipCall extends ethereum.Call { + get inputs(): AcceptOwnershipCall__Inputs { + return new AcceptOwnershipCall__Inputs(this); + } + + get outputs(): AcceptOwnershipCall__Outputs { + return new AcceptOwnershipCall__Outputs(this); + } +} + +export class AcceptOwnershipCall__Inputs { + _call: AcceptOwnershipCall; + + constructor(call: AcceptOwnershipCall) { + this._call = call; + } +} + +export class AcceptOwnershipCall__Outputs { + _call: AcceptOwnershipCall; + + constructor(call: AcceptOwnershipCall) { + this._call = call; + } +} + +export class NominateNewOwnerCall extends ethereum.Call { + get inputs(): NominateNewOwnerCall__Inputs { + return new NominateNewOwnerCall__Inputs(this); + } + + get outputs(): NominateNewOwnerCall__Outputs { + return new NominateNewOwnerCall__Outputs(this); + } +} + +export class NominateNewOwnerCall__Inputs { + _call: NominateNewOwnerCall; + + constructor(call: NominateNewOwnerCall) { + this._call = call; + } + + get newNominatedOwner(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class NominateNewOwnerCall__Outputs { + _call: NominateNewOwnerCall; + + constructor(call: NominateNewOwnerCall) { + this._call = call; + } +} + +export class RenounceNominationCall extends ethereum.Call { + get inputs(): RenounceNominationCall__Inputs { + return new RenounceNominationCall__Inputs(this); + } + + get outputs(): RenounceNominationCall__Outputs { + return new RenounceNominationCall__Outputs(this); + } +} + +export class RenounceNominationCall__Inputs { + _call: RenounceNominationCall; + + constructor(call: RenounceNominationCall) { + this._call = call; + } +} + +export class RenounceNominationCall__Outputs { + _call: RenounceNominationCall; + + constructor(call: RenounceNominationCall) { + this._call = call; + } +} + +export class SimulateUpgradeToCall extends ethereum.Call { + get inputs(): SimulateUpgradeToCall__Inputs { + return new SimulateUpgradeToCall__Inputs(this); + } + + get outputs(): SimulateUpgradeToCall__Outputs { + return new SimulateUpgradeToCall__Outputs(this); + } +} + +export class SimulateUpgradeToCall__Inputs { + _call: SimulateUpgradeToCall; + + constructor(call: SimulateUpgradeToCall) { + this._call = call; + } + + get newImplementation(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class SimulateUpgradeToCall__Outputs { + _call: SimulateUpgradeToCall; + + constructor(call: SimulateUpgradeToCall) { + this._call = call; + } +} + +export class UpgradeToCall extends ethereum.Call { + get inputs(): UpgradeToCall__Inputs { + return new UpgradeToCall__Inputs(this); + } + + get outputs(): UpgradeToCall__Outputs { + return new UpgradeToCall__Outputs(this); + } +} + +export class UpgradeToCall__Inputs { + _call: UpgradeToCall; + + constructor(call: UpgradeToCall) { + this._call = call; + } + + get newImplementation(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class UpgradeToCall__Outputs { + _call: UpgradeToCall; + + constructor(call: UpgradeToCall) { + this._call = call; + } +} + +export class AddToFeatureFlagAllowlistCall extends ethereum.Call { + get inputs(): AddToFeatureFlagAllowlistCall__Inputs { + return new AddToFeatureFlagAllowlistCall__Inputs(this); + } + + get outputs(): AddToFeatureFlagAllowlistCall__Outputs { + return new AddToFeatureFlagAllowlistCall__Outputs(this); + } +} + +export class AddToFeatureFlagAllowlistCall__Inputs { + _call: AddToFeatureFlagAllowlistCall; + + constructor(call: AddToFeatureFlagAllowlistCall) { + this._call = call; + } + + get feature(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get account(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class AddToFeatureFlagAllowlistCall__Outputs { + _call: AddToFeatureFlagAllowlistCall; + + constructor(call: AddToFeatureFlagAllowlistCall) { + this._call = call; + } +} + +export class RemoveFromFeatureFlagAllowlistCall extends ethereum.Call { + get inputs(): RemoveFromFeatureFlagAllowlistCall__Inputs { + return new RemoveFromFeatureFlagAllowlistCall__Inputs(this); + } + + get outputs(): RemoveFromFeatureFlagAllowlistCall__Outputs { + return new RemoveFromFeatureFlagAllowlistCall__Outputs(this); + } +} + +export class RemoveFromFeatureFlagAllowlistCall__Inputs { + _call: RemoveFromFeatureFlagAllowlistCall; + + constructor(call: RemoveFromFeatureFlagAllowlistCall) { + this._call = call; + } + + get feature(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get account(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class RemoveFromFeatureFlagAllowlistCall__Outputs { + _call: RemoveFromFeatureFlagAllowlistCall; + + constructor(call: RemoveFromFeatureFlagAllowlistCall) { + this._call = call; + } +} + +export class SetDeniersCall extends ethereum.Call { + get inputs(): SetDeniersCall__Inputs { + return new SetDeniersCall__Inputs(this); + } + + get outputs(): SetDeniersCall__Outputs { + return new SetDeniersCall__Outputs(this); + } +} + +export class SetDeniersCall__Inputs { + _call: SetDeniersCall; + + constructor(call: SetDeniersCall) { + this._call = call; + } + + get feature(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get deniers(): Array
{ + return this._call.inputValues[1].value.toAddressArray(); + } +} + +export class SetDeniersCall__Outputs { + _call: SetDeniersCall; + + constructor(call: SetDeniersCall) { + this._call = call; + } +} + +export class SetFeatureFlagAllowAllCall extends ethereum.Call { + get inputs(): SetFeatureFlagAllowAllCall__Inputs { + return new SetFeatureFlagAllowAllCall__Inputs(this); + } + + get outputs(): SetFeatureFlagAllowAllCall__Outputs { + return new SetFeatureFlagAllowAllCall__Outputs(this); + } +} + +export class SetFeatureFlagAllowAllCall__Inputs { + _call: SetFeatureFlagAllowAllCall; + + constructor(call: SetFeatureFlagAllowAllCall) { + this._call = call; + } + + get feature(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get allowAll(): boolean { + return this._call.inputValues[1].value.toBoolean(); + } +} + +export class SetFeatureFlagAllowAllCall__Outputs { + _call: SetFeatureFlagAllowAllCall; + + constructor(call: SetFeatureFlagAllowAllCall) { + this._call = call; + } +} + +export class SetFeatureFlagDenyAllCall extends ethereum.Call { + get inputs(): SetFeatureFlagDenyAllCall__Inputs { + return new SetFeatureFlagDenyAllCall__Inputs(this); + } + + get outputs(): SetFeatureFlagDenyAllCall__Outputs { + return new SetFeatureFlagDenyAllCall__Outputs(this); + } +} + +export class SetFeatureFlagDenyAllCall__Inputs { + _call: SetFeatureFlagDenyAllCall; + + constructor(call: SetFeatureFlagDenyAllCall) { + this._call = call; + } + + get feature(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get denyAll(): boolean { + return this._call.inputValues[1].value.toBoolean(); + } +} + +export class SetFeatureFlagDenyAllCall__Outputs { + _call: SetFeatureFlagDenyAllCall; + + constructor(call: SetFeatureFlagDenyAllCall) { + this._call = call; + } +} + +export class CreateAccountCall extends ethereum.Call { + get inputs(): CreateAccountCall__Inputs { + return new CreateAccountCall__Inputs(this); + } + + get outputs(): CreateAccountCall__Outputs { + return new CreateAccountCall__Outputs(this); + } +} + +export class CreateAccountCall__Inputs { + _call: CreateAccountCall; + + constructor(call: CreateAccountCall) { + this._call = call; + } +} + +export class CreateAccountCall__Outputs { + _call: CreateAccountCall; + + constructor(call: CreateAccountCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class CreateAccount1Call extends ethereum.Call { + get inputs(): CreateAccount1Call__Inputs { + return new CreateAccount1Call__Inputs(this); + } + + get outputs(): CreateAccount1Call__Outputs { + return new CreateAccount1Call__Outputs(this); + } +} + +export class CreateAccount1Call__Inputs { + _call: CreateAccount1Call; + + constructor(call: CreateAccount1Call) { + this._call = call; + } + + get requestedAccountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class CreateAccount1Call__Outputs { + _call: CreateAccount1Call; + + constructor(call: CreateAccount1Call) { + this._call = call; + } +} + +export class GrantPermissionCall extends ethereum.Call { + get inputs(): GrantPermissionCall__Inputs { + return new GrantPermissionCall__Inputs(this); + } + + get outputs(): GrantPermissionCall__Outputs { + return new GrantPermissionCall__Outputs(this); + } +} + +export class GrantPermissionCall__Inputs { + _call: GrantPermissionCall; + + constructor(call: GrantPermissionCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get permission(): Bytes { + return this._call.inputValues[1].value.toBytes(); + } + + get user(): Address { + return this._call.inputValues[2].value.toAddress(); + } +} + +export class GrantPermissionCall__Outputs { + _call: GrantPermissionCall; + + constructor(call: GrantPermissionCall) { + this._call = call; + } +} + +export class NotifyAccountTransferCall extends ethereum.Call { + get inputs(): NotifyAccountTransferCall__Inputs { + return new NotifyAccountTransferCall__Inputs(this); + } + + get outputs(): NotifyAccountTransferCall__Outputs { + return new NotifyAccountTransferCall__Outputs(this); + } +} + +export class NotifyAccountTransferCall__Inputs { + _call: NotifyAccountTransferCall; + + constructor(call: NotifyAccountTransferCall) { + this._call = call; + } + + get to(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get accountId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class NotifyAccountTransferCall__Outputs { + _call: NotifyAccountTransferCall; + + constructor(call: NotifyAccountTransferCall) { + this._call = call; + } +} + +export class RenouncePermissionCall extends ethereum.Call { + get inputs(): RenouncePermissionCall__Inputs { + return new RenouncePermissionCall__Inputs(this); + } + + get outputs(): RenouncePermissionCall__Outputs { + return new RenouncePermissionCall__Outputs(this); + } +} + +export class RenouncePermissionCall__Inputs { + _call: RenouncePermissionCall; + + constructor(call: RenouncePermissionCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get permission(): Bytes { + return this._call.inputValues[1].value.toBytes(); + } +} + +export class RenouncePermissionCall__Outputs { + _call: RenouncePermissionCall; + + constructor(call: RenouncePermissionCall) { + this._call = call; + } +} + +export class RevokePermissionCall extends ethereum.Call { + get inputs(): RevokePermissionCall__Inputs { + return new RevokePermissionCall__Inputs(this); + } + + get outputs(): RevokePermissionCall__Outputs { + return new RevokePermissionCall__Outputs(this); + } +} + +export class RevokePermissionCall__Inputs { + _call: RevokePermissionCall; + + constructor(call: RevokePermissionCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get permission(): Bytes { + return this._call.inputValues[1].value.toBytes(); + } + + get user(): Address { + return this._call.inputValues[2].value.toAddress(); + } +} + +export class RevokePermissionCall__Outputs { + _call: RevokePermissionCall; + + constructor(call: RevokePermissionCall) { + this._call = call; + } +} + +export class AssociateDebtCall extends ethereum.Call { + get inputs(): AssociateDebtCall__Inputs { + return new AssociateDebtCall__Inputs(this); + } + + get outputs(): AssociateDebtCall__Outputs { + return new AssociateDebtCall__Outputs(this); + } +} + +export class AssociateDebtCall__Inputs { + _call: AssociateDebtCall; + + constructor(call: AssociateDebtCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[2].value.toAddress(); + } + + get accountId(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } + + get amount(): BigInt { + return this._call.inputValues[4].value.toBigInt(); + } +} + +export class AssociateDebtCall__Outputs { + _call: AssociateDebtCall; + + constructor(call: AssociateDebtCall) { + this._call = call; + } + + get value0(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class InitOrUpgradeNftCall extends ethereum.Call { + get inputs(): InitOrUpgradeNftCall__Inputs { + return new InitOrUpgradeNftCall__Inputs(this); + } + + get outputs(): InitOrUpgradeNftCall__Outputs { + return new InitOrUpgradeNftCall__Outputs(this); + } +} + +export class InitOrUpgradeNftCall__Inputs { + _call: InitOrUpgradeNftCall; + + constructor(call: InitOrUpgradeNftCall) { + this._call = call; + } + + get id(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get name(): string { + return this._call.inputValues[1].value.toString(); + } + + get symbol(): string { + return this._call.inputValues[2].value.toString(); + } + + get uri(): string { + return this._call.inputValues[3].value.toString(); + } + + get impl(): Address { + return this._call.inputValues[4].value.toAddress(); + } +} + +export class InitOrUpgradeNftCall__Outputs { + _call: InitOrUpgradeNftCall; + + constructor(call: InitOrUpgradeNftCall) { + this._call = call; + } +} + +export class InitOrUpgradeTokenCall extends ethereum.Call { + get inputs(): InitOrUpgradeTokenCall__Inputs { + return new InitOrUpgradeTokenCall__Inputs(this); + } + + get outputs(): InitOrUpgradeTokenCall__Outputs { + return new InitOrUpgradeTokenCall__Outputs(this); + } +} + +export class InitOrUpgradeTokenCall__Inputs { + _call: InitOrUpgradeTokenCall; + + constructor(call: InitOrUpgradeTokenCall) { + this._call = call; + } + + get id(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get name(): string { + return this._call.inputValues[1].value.toString(); + } + + get symbol(): string { + return this._call.inputValues[2].value.toString(); + } + + get decimals(): i32 { + return this._call.inputValues[3].value.toI32(); + } + + get impl(): Address { + return this._call.inputValues[4].value.toAddress(); + } +} + +export class InitOrUpgradeTokenCall__Outputs { + _call: InitOrUpgradeTokenCall; + + constructor(call: InitOrUpgradeTokenCall) { + this._call = call; + } +} + +export class RegisterUnmanagedSystemCall extends ethereum.Call { + get inputs(): RegisterUnmanagedSystemCall__Inputs { + return new RegisterUnmanagedSystemCall__Inputs(this); + } + + get outputs(): RegisterUnmanagedSystemCall__Outputs { + return new RegisterUnmanagedSystemCall__Outputs(this); + } +} + +export class RegisterUnmanagedSystemCall__Inputs { + _call: RegisterUnmanagedSystemCall; + + constructor(call: RegisterUnmanagedSystemCall) { + this._call = call; + } + + get id(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get endpoint(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class RegisterUnmanagedSystemCall__Outputs { + _call: RegisterUnmanagedSystemCall; + + constructor(call: RegisterUnmanagedSystemCall) { + this._call = call; + } +} + +export class CcipReceiveCall extends ethereum.Call { + get inputs(): CcipReceiveCall__Inputs { + return new CcipReceiveCall__Inputs(this); + } + + get outputs(): CcipReceiveCall__Outputs { + return new CcipReceiveCall__Outputs(this); + } +} + +export class CcipReceiveCall__Inputs { + _call: CcipReceiveCall; + + constructor(call: CcipReceiveCall) { + this._call = call; + } + + get message(): CcipReceiveCallMessageStruct { + return changetype(this._call.inputValues[0].value.toTuple()); + } +} + +export class CcipReceiveCall__Outputs { + _call: CcipReceiveCall; + + constructor(call: CcipReceiveCall) { + this._call = call; + } +} + +export class CcipReceiveCallMessageStruct extends ethereum.Tuple { + get messageId(): Bytes { + return this[0].toBytes(); + } + + get sourceChainSelector(): BigInt { + return this[1].toBigInt(); + } + + get sender(): Bytes { + return this[2].toBytes(); + } + + get data(): Bytes { + return this[3].toBytes(); + } + + get tokenAmounts(): Array { + return this[4].toTupleArray(); + } +} + +export class CcipReceiveCallMessageTokenAmountsStruct extends ethereum.Tuple { + get token(): Address { + return this[0].toAddress(); + } + + get amount(): BigInt { + return this[1].toBigInt(); + } +} + +export class CleanExpiredLocksCall extends ethereum.Call { + get inputs(): CleanExpiredLocksCall__Inputs { + return new CleanExpiredLocksCall__Inputs(this); + } + + get outputs(): CleanExpiredLocksCall__Outputs { + return new CleanExpiredLocksCall__Outputs(this); + } +} + +export class CleanExpiredLocksCall__Inputs { + _call: CleanExpiredLocksCall; + + constructor(call: CleanExpiredLocksCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get offset(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get count(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } +} + +export class CleanExpiredLocksCall__Outputs { + _call: CleanExpiredLocksCall; + + constructor(call: CleanExpiredLocksCall) { + this._call = call; + } + + get cleared(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class CreateLockCall extends ethereum.Call { + get inputs(): CreateLockCall__Inputs { + return new CreateLockCall__Inputs(this); + } + + get outputs(): CreateLockCall__Outputs { + return new CreateLockCall__Outputs(this); + } +} + +export class CreateLockCall__Inputs { + _call: CreateLockCall; + + constructor(call: CreateLockCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get amount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get expireTimestamp(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } +} + +export class CreateLockCall__Outputs { + _call: CreateLockCall; + + constructor(call: CreateLockCall) { + this._call = call; + } +} + +export class DepositCall extends ethereum.Call { + get inputs(): DepositCall__Inputs { + return new DepositCall__Inputs(this); + } + + get outputs(): DepositCall__Outputs { + return new DepositCall__Outputs(this); + } +} + +export class DepositCall__Inputs { + _call: DepositCall; + + constructor(call: DepositCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get tokenAmount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class DepositCall__Outputs { + _call: DepositCall; + + constructor(call: DepositCall) { + this._call = call; + } +} + +export class WithdrawCall extends ethereum.Call { + get inputs(): WithdrawCall__Inputs { + return new WithdrawCall__Inputs(this); + } + + get outputs(): WithdrawCall__Outputs { + return new WithdrawCall__Outputs(this); + } +} + +export class WithdrawCall__Inputs { + _call: WithdrawCall; + + constructor(call: WithdrawCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get tokenAmount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class WithdrawCall__Outputs { + _call: WithdrawCall; + + constructor(call: WithdrawCall) { + this._call = call; + } +} + +export class ConfigureCollateralCall extends ethereum.Call { + get inputs(): ConfigureCollateralCall__Inputs { + return new ConfigureCollateralCall__Inputs(this); + } + + get outputs(): ConfigureCollateralCall__Outputs { + return new ConfigureCollateralCall__Outputs(this); + } +} + +export class ConfigureCollateralCall__Inputs { + _call: ConfigureCollateralCall; + + constructor(call: ConfigureCollateralCall) { + this._call = call; + } + + get config(): ConfigureCollateralCallConfigStruct { + return changetype( + this._call.inputValues[0].value.toTuple() + ); + } +} + +export class ConfigureCollateralCall__Outputs { + _call: ConfigureCollateralCall; + + constructor(call: ConfigureCollateralCall) { + this._call = call; + } +} + +export class ConfigureCollateralCallConfigStruct extends ethereum.Tuple { + get depositingEnabled(): boolean { + return this[0].toBoolean(); + } + + get issuanceRatioD18(): BigInt { + return this[1].toBigInt(); + } + + get liquidationRatioD18(): BigInt { + return this[2].toBigInt(); + } + + get liquidationRewardD18(): BigInt { + return this[3].toBigInt(); + } + + get oracleNodeId(): Bytes { + return this[4].toBytes(); + } + + get tokenAddress(): Address { + return this[5].toAddress(); + } + + get minDelegationD18(): BigInt { + return this[6].toBigInt(); + } +} + +export class TransferCrossChainCall extends ethereum.Call { + get inputs(): TransferCrossChainCall__Inputs { + return new TransferCrossChainCall__Inputs(this); + } + + get outputs(): TransferCrossChainCall__Outputs { + return new TransferCrossChainCall__Outputs(this); + } +} + +export class TransferCrossChainCall__Inputs { + _call: TransferCrossChainCall; + + constructor(call: TransferCrossChainCall) { + this._call = call; + } + + get destChainId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get amount(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class TransferCrossChainCall__Outputs { + _call: TransferCrossChainCall; + + constructor(call: TransferCrossChainCall) { + this._call = call; + } + + get gasTokenUsed(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class BurnUsdCall extends ethereum.Call { + get inputs(): BurnUsdCall__Inputs { + return new BurnUsdCall__Inputs(this); + } + + get outputs(): BurnUsdCall__Outputs { + return new BurnUsdCall__Outputs(this); + } +} + +export class BurnUsdCall__Inputs { + _call: BurnUsdCall; + + constructor(call: BurnUsdCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[2].value.toAddress(); + } + + get amount(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } +} + +export class BurnUsdCall__Outputs { + _call: BurnUsdCall; + + constructor(call: BurnUsdCall) { + this._call = call; + } +} + +export class MintUsdCall extends ethereum.Call { + get inputs(): MintUsdCall__Inputs { + return new MintUsdCall__Inputs(this); + } + + get outputs(): MintUsdCall__Outputs { + return new MintUsdCall__Outputs(this); + } +} + +export class MintUsdCall__Inputs { + _call: MintUsdCall; + + constructor(call: MintUsdCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[2].value.toAddress(); + } + + get amount(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } +} + +export class MintUsdCall__Outputs { + _call: MintUsdCall; + + constructor(call: MintUsdCall) { + this._call = call; + } +} + +export class IsPositionLiquidatableCall extends ethereum.Call { + get inputs(): IsPositionLiquidatableCall__Inputs { + return new IsPositionLiquidatableCall__Inputs(this); + } + + get outputs(): IsPositionLiquidatableCall__Outputs { + return new IsPositionLiquidatableCall__Outputs(this); + } +} + +export class IsPositionLiquidatableCall__Inputs { + _call: IsPositionLiquidatableCall; + + constructor(call: IsPositionLiquidatableCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[2].value.toAddress(); + } +} + +export class IsPositionLiquidatableCall__Outputs { + _call: IsPositionLiquidatableCall; + + constructor(call: IsPositionLiquidatableCall) { + this._call = call; + } + + get value0(): boolean { + return this._call.outputValues[0].value.toBoolean(); + } +} + +export class IsVaultLiquidatableCall extends ethereum.Call { + get inputs(): IsVaultLiquidatableCall__Inputs { + return new IsVaultLiquidatableCall__Inputs(this); + } + + get outputs(): IsVaultLiquidatableCall__Outputs { + return new IsVaultLiquidatableCall__Outputs(this); + } +} + +export class IsVaultLiquidatableCall__Inputs { + _call: IsVaultLiquidatableCall; + + constructor(call: IsVaultLiquidatableCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class IsVaultLiquidatableCall__Outputs { + _call: IsVaultLiquidatableCall; + + constructor(call: IsVaultLiquidatableCall) { + this._call = call; + } + + get value0(): boolean { + return this._call.outputValues[0].value.toBoolean(); + } +} + +export class LiquidateCall extends ethereum.Call { + get inputs(): LiquidateCall__Inputs { + return new LiquidateCall__Inputs(this); + } + + get outputs(): LiquidateCall__Outputs { + return new LiquidateCall__Outputs(this); + } +} + +export class LiquidateCall__Inputs { + _call: LiquidateCall; + + constructor(call: LiquidateCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[2].value.toAddress(); + } + + get liquidateAsAccountId(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } +} + +export class LiquidateCall__Outputs { + _call: LiquidateCall; + + constructor(call: LiquidateCall) { + this._call = call; + } + + get liquidationData(): LiquidateCallLiquidationDataStruct { + return changetype( + this._call.outputValues[0].value.toTuple() + ); + } +} + +export class LiquidateCallLiquidationDataStruct extends ethereum.Tuple { + get debtLiquidated(): BigInt { + return this[0].toBigInt(); + } + + get collateralLiquidated(): BigInt { + return this[1].toBigInt(); + } + + get amountRewarded(): BigInt { + return this[2].toBigInt(); + } +} + +export class LiquidateVaultCall extends ethereum.Call { + get inputs(): LiquidateVaultCall__Inputs { + return new LiquidateVaultCall__Inputs(this); + } + + get outputs(): LiquidateVaultCall__Outputs { + return new LiquidateVaultCall__Outputs(this); + } +} + +export class LiquidateVaultCall__Inputs { + _call: LiquidateVaultCall; + + constructor(call: LiquidateVaultCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get liquidateAsAccountId(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get maxUsd(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } +} + +export class LiquidateVaultCall__Outputs { + _call: LiquidateVaultCall; + + constructor(call: LiquidateVaultCall) { + this._call = call; + } + + get liquidationData(): LiquidateVaultCallLiquidationDataStruct { + return changetype( + this._call.outputValues[0].value.toTuple() + ); + } +} + +export class LiquidateVaultCallLiquidationDataStruct extends ethereum.Tuple { + get debtLiquidated(): BigInt { + return this[0].toBigInt(); + } + + get collateralLiquidated(): BigInt { + return this[1].toBigInt(); + } + + get amountRewarded(): BigInt { + return this[2].toBigInt(); + } +} + +export class ConfigureMaximumMarketCollateralCall extends ethereum.Call { + get inputs(): ConfigureMaximumMarketCollateralCall__Inputs { + return new ConfigureMaximumMarketCollateralCall__Inputs(this); + } + + get outputs(): ConfigureMaximumMarketCollateralCall__Outputs { + return new ConfigureMaximumMarketCollateralCall__Outputs(this); + } +} + +export class ConfigureMaximumMarketCollateralCall__Inputs { + _call: ConfigureMaximumMarketCollateralCall; + + constructor(call: ConfigureMaximumMarketCollateralCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get amount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class ConfigureMaximumMarketCollateralCall__Outputs { + _call: ConfigureMaximumMarketCollateralCall; + + constructor(call: ConfigureMaximumMarketCollateralCall) { + this._call = call; + } +} + +export class DepositMarketCollateralCall extends ethereum.Call { + get inputs(): DepositMarketCollateralCall__Inputs { + return new DepositMarketCollateralCall__Inputs(this); + } + + get outputs(): DepositMarketCollateralCall__Outputs { + return new DepositMarketCollateralCall__Outputs(this); + } +} + +export class DepositMarketCollateralCall__Inputs { + _call: DepositMarketCollateralCall; + + constructor(call: DepositMarketCollateralCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get tokenAmount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class DepositMarketCollateralCall__Outputs { + _call: DepositMarketCollateralCall; + + constructor(call: DepositMarketCollateralCall) { + this._call = call; + } +} + +export class WithdrawMarketCollateralCall extends ethereum.Call { + get inputs(): WithdrawMarketCollateralCall__Inputs { + return new WithdrawMarketCollateralCall__Inputs(this); + } + + get outputs(): WithdrawMarketCollateralCall__Outputs { + return new WithdrawMarketCollateralCall__Outputs(this); + } +} + +export class WithdrawMarketCollateralCall__Inputs { + _call: WithdrawMarketCollateralCall; + + constructor(call: WithdrawMarketCollateralCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get tokenAmount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class WithdrawMarketCollateralCall__Outputs { + _call: WithdrawMarketCollateralCall; + + constructor(call: WithdrawMarketCollateralCall) { + this._call = call; + } +} + +export class DepositMarketUsdCall extends ethereum.Call { + get inputs(): DepositMarketUsdCall__Inputs { + return new DepositMarketUsdCall__Inputs(this); + } + + get outputs(): DepositMarketUsdCall__Outputs { + return new DepositMarketUsdCall__Outputs(this); + } +} + +export class DepositMarketUsdCall__Inputs { + _call: DepositMarketUsdCall; + + constructor(call: DepositMarketUsdCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get target(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get amount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class DepositMarketUsdCall__Outputs { + _call: DepositMarketUsdCall; + + constructor(call: DepositMarketUsdCall) { + this._call = call; + } + + get feeAmount(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class DistributeDebtToPoolsCall extends ethereum.Call { + get inputs(): DistributeDebtToPoolsCall__Inputs { + return new DistributeDebtToPoolsCall__Inputs(this); + } + + get outputs(): DistributeDebtToPoolsCall__Outputs { + return new DistributeDebtToPoolsCall__Outputs(this); + } +} + +export class DistributeDebtToPoolsCall__Inputs { + _call: DistributeDebtToPoolsCall; + + constructor(call: DistributeDebtToPoolsCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get maxIter(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class DistributeDebtToPoolsCall__Outputs { + _call: DistributeDebtToPoolsCall; + + constructor(call: DistributeDebtToPoolsCall) { + this._call = call; + } + + get value0(): boolean { + return this._call.outputValues[0].value.toBoolean(); + } +} + +export class GetMarketDebtPerShareCall extends ethereum.Call { + get inputs(): GetMarketDebtPerShareCall__Inputs { + return new GetMarketDebtPerShareCall__Inputs(this); + } + + get outputs(): GetMarketDebtPerShareCall__Outputs { + return new GetMarketDebtPerShareCall__Outputs(this); + } +} + +export class GetMarketDebtPerShareCall__Inputs { + _call: GetMarketDebtPerShareCall; + + constructor(call: GetMarketDebtPerShareCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class GetMarketDebtPerShareCall__Outputs { + _call: GetMarketDebtPerShareCall; + + constructor(call: GetMarketDebtPerShareCall) { + this._call = call; + } + + get value0(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class GetMarketPoolDebtDistributionCall extends ethereum.Call { + get inputs(): GetMarketPoolDebtDistributionCall__Inputs { + return new GetMarketPoolDebtDistributionCall__Inputs(this); + } + + get outputs(): GetMarketPoolDebtDistributionCall__Outputs { + return new GetMarketPoolDebtDistributionCall__Outputs(this); + } +} + +export class GetMarketPoolDebtDistributionCall__Inputs { + _call: GetMarketPoolDebtDistributionCall; + + constructor(call: GetMarketPoolDebtDistributionCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class GetMarketPoolDebtDistributionCall__Outputs { + _call: GetMarketPoolDebtDistributionCall; + + constructor(call: GetMarketPoolDebtDistributionCall) { + this._call = call; + } + + get sharesD18(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } + + get totalSharesD18(): BigInt { + return this._call.outputValues[1].value.toBigInt(); + } + + get valuePerShareD27(): BigInt { + return this._call.outputValues[2].value.toBigInt(); + } +} + +export class GetMarketPoolsCall extends ethereum.Call { + get inputs(): GetMarketPoolsCall__Inputs { + return new GetMarketPoolsCall__Inputs(this); + } + + get outputs(): GetMarketPoolsCall__Outputs { + return new GetMarketPoolsCall__Outputs(this); + } +} + +export class GetMarketPoolsCall__Inputs { + _call: GetMarketPoolsCall; + + constructor(call: GetMarketPoolsCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class GetMarketPoolsCall__Outputs { + _call: GetMarketPoolsCall; + + constructor(call: GetMarketPoolsCall) { + this._call = call; + } + + get inRangePoolIds(): Array { + return this._call.outputValues[0].value.toBigIntArray(); + } + + get outRangePoolIds(): Array { + return this._call.outputValues[1].value.toBigIntArray(); + } +} + +export class RegisterMarketCall extends ethereum.Call { + get inputs(): RegisterMarketCall__Inputs { + return new RegisterMarketCall__Inputs(this); + } + + get outputs(): RegisterMarketCall__Outputs { + return new RegisterMarketCall__Outputs(this); + } +} + +export class RegisterMarketCall__Inputs { + _call: RegisterMarketCall; + + constructor(call: RegisterMarketCall) { + this._call = call; + } + + get market(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class RegisterMarketCall__Outputs { + _call: RegisterMarketCall; + + constructor(call: RegisterMarketCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class SetMarketMinDelegateTimeCall extends ethereum.Call { + get inputs(): SetMarketMinDelegateTimeCall__Inputs { + return new SetMarketMinDelegateTimeCall__Inputs(this); + } + + get outputs(): SetMarketMinDelegateTimeCall__Outputs { + return new SetMarketMinDelegateTimeCall__Outputs(this); + } +} + +export class SetMarketMinDelegateTimeCall__Inputs { + _call: SetMarketMinDelegateTimeCall; + + constructor(call: SetMarketMinDelegateTimeCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get minDelegateTime(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class SetMarketMinDelegateTimeCall__Outputs { + _call: SetMarketMinDelegateTimeCall; + + constructor(call: SetMarketMinDelegateTimeCall) { + this._call = call; + } +} + +export class SetMinLiquidityRatioCall extends ethereum.Call { + get inputs(): SetMinLiquidityRatioCall__Inputs { + return new SetMinLiquidityRatioCall__Inputs(this); + } + + get outputs(): SetMinLiquidityRatioCall__Outputs { + return new SetMinLiquidityRatioCall__Outputs(this); + } +} + +export class SetMinLiquidityRatioCall__Inputs { + _call: SetMinLiquidityRatioCall; + + constructor(call: SetMinLiquidityRatioCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get minLiquidityRatio(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class SetMinLiquidityRatioCall__Outputs { + _call: SetMinLiquidityRatioCall; + + constructor(call: SetMinLiquidityRatioCall) { + this._call = call; + } +} + +export class WithdrawMarketUsdCall extends ethereum.Call { + get inputs(): WithdrawMarketUsdCall__Inputs { + return new WithdrawMarketUsdCall__Inputs(this); + } + + get outputs(): WithdrawMarketUsdCall__Outputs { + return new WithdrawMarketUsdCall__Outputs(this); + } +} + +export class WithdrawMarketUsdCall__Inputs { + _call: WithdrawMarketUsdCall; + + constructor(call: WithdrawMarketUsdCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get target(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get amount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class WithdrawMarketUsdCall__Outputs { + _call: WithdrawMarketUsdCall; + + constructor(call: WithdrawMarketUsdCall) { + this._call = call; + } + + get feeAmount(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class MulticallCall extends ethereum.Call { + get inputs(): MulticallCall__Inputs { + return new MulticallCall__Inputs(this); + } + + get outputs(): MulticallCall__Outputs { + return new MulticallCall__Outputs(this); + } +} + +export class MulticallCall__Inputs { + _call: MulticallCall; + + constructor(call: MulticallCall) { + this._call = call; + } + + get data(): Array { + return this._call.inputValues[0].value.toBytesArray(); + } +} + +export class MulticallCall__Outputs { + _call: MulticallCall; + + constructor(call: MulticallCall) { + this._call = call; + } + + get results(): Array { + return this._call.outputValues[0].value.toBytesArray(); + } +} + +export class AddApprovedPoolCall extends ethereum.Call { + get inputs(): AddApprovedPoolCall__Inputs { + return new AddApprovedPoolCall__Inputs(this); + } + + get outputs(): AddApprovedPoolCall__Outputs { + return new AddApprovedPoolCall__Outputs(this); + } +} + +export class AddApprovedPoolCall__Inputs { + _call: AddApprovedPoolCall; + + constructor(call: AddApprovedPoolCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class AddApprovedPoolCall__Outputs { + _call: AddApprovedPoolCall; + + constructor(call: AddApprovedPoolCall) { + this._call = call; + } +} + +export class RemoveApprovedPoolCall extends ethereum.Call { + get inputs(): RemoveApprovedPoolCall__Inputs { + return new RemoveApprovedPoolCall__Inputs(this); + } + + get outputs(): RemoveApprovedPoolCall__Outputs { + return new RemoveApprovedPoolCall__Outputs(this); + } +} + +export class RemoveApprovedPoolCall__Inputs { + _call: RemoveApprovedPoolCall; + + constructor(call: RemoveApprovedPoolCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class RemoveApprovedPoolCall__Outputs { + _call: RemoveApprovedPoolCall; + + constructor(call: RemoveApprovedPoolCall) { + this._call = call; + } +} + +export class SetPreferredPoolCall extends ethereum.Call { + get inputs(): SetPreferredPoolCall__Inputs { + return new SetPreferredPoolCall__Inputs(this); + } + + get outputs(): SetPreferredPoolCall__Outputs { + return new SetPreferredPoolCall__Outputs(this); + } +} + +export class SetPreferredPoolCall__Inputs { + _call: SetPreferredPoolCall; + + constructor(call: SetPreferredPoolCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class SetPreferredPoolCall__Outputs { + _call: SetPreferredPoolCall; + + constructor(call: SetPreferredPoolCall) { + this._call = call; + } +} + +export class AcceptPoolOwnershipCall extends ethereum.Call { + get inputs(): AcceptPoolOwnershipCall__Inputs { + return new AcceptPoolOwnershipCall__Inputs(this); + } + + get outputs(): AcceptPoolOwnershipCall__Outputs { + return new AcceptPoolOwnershipCall__Outputs(this); + } +} + +export class AcceptPoolOwnershipCall__Inputs { + _call: AcceptPoolOwnershipCall; + + constructor(call: AcceptPoolOwnershipCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class AcceptPoolOwnershipCall__Outputs { + _call: AcceptPoolOwnershipCall; + + constructor(call: AcceptPoolOwnershipCall) { + this._call = call; + } +} + +export class CreatePoolCall extends ethereum.Call { + get inputs(): CreatePoolCall__Inputs { + return new CreatePoolCall__Inputs(this); + } + + get outputs(): CreatePoolCall__Outputs { + return new CreatePoolCall__Outputs(this); + } +} + +export class CreatePoolCall__Inputs { + _call: CreatePoolCall; + + constructor(call: CreatePoolCall) { + this._call = call; + } + + get requestedPoolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get owner(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class CreatePoolCall__Outputs { + _call: CreatePoolCall; + + constructor(call: CreatePoolCall) { + this._call = call; + } +} + +export class NominatePoolOwnerCall extends ethereum.Call { + get inputs(): NominatePoolOwnerCall__Inputs { + return new NominatePoolOwnerCall__Inputs(this); + } + + get outputs(): NominatePoolOwnerCall__Outputs { + return new NominatePoolOwnerCall__Outputs(this); + } +} + +export class NominatePoolOwnerCall__Inputs { + _call: NominatePoolOwnerCall; + + constructor(call: NominatePoolOwnerCall) { + this._call = call; + } + + get nominatedOwner(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class NominatePoolOwnerCall__Outputs { + _call: NominatePoolOwnerCall; + + constructor(call: NominatePoolOwnerCall) { + this._call = call; + } +} + +export class RebalancePoolCall extends ethereum.Call { + get inputs(): RebalancePoolCall__Inputs { + return new RebalancePoolCall__Inputs(this); + } + + get outputs(): RebalancePoolCall__Outputs { + return new RebalancePoolCall__Outputs(this); + } +} + +export class RebalancePoolCall__Inputs { + _call: RebalancePoolCall; + + constructor(call: RebalancePoolCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get optionalCollateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class RebalancePoolCall__Outputs { + _call: RebalancePoolCall; + + constructor(call: RebalancePoolCall) { + this._call = call; + } +} + +export class RenouncePoolNominationCall extends ethereum.Call { + get inputs(): RenouncePoolNominationCall__Inputs { + return new RenouncePoolNominationCall__Inputs(this); + } + + get outputs(): RenouncePoolNominationCall__Outputs { + return new RenouncePoolNominationCall__Outputs(this); + } +} + +export class RenouncePoolNominationCall__Inputs { + _call: RenouncePoolNominationCall; + + constructor(call: RenouncePoolNominationCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class RenouncePoolNominationCall__Outputs { + _call: RenouncePoolNominationCall; + + constructor(call: RenouncePoolNominationCall) { + this._call = call; + } +} + +export class RevokePoolNominationCall extends ethereum.Call { + get inputs(): RevokePoolNominationCall__Inputs { + return new RevokePoolNominationCall__Inputs(this); + } + + get outputs(): RevokePoolNominationCall__Outputs { + return new RevokePoolNominationCall__Outputs(this); + } +} + +export class RevokePoolNominationCall__Inputs { + _call: RevokePoolNominationCall; + + constructor(call: RevokePoolNominationCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class RevokePoolNominationCall__Outputs { + _call: RevokePoolNominationCall; + + constructor(call: RevokePoolNominationCall) { + this._call = call; + } +} + +export class SetMinLiquidityRatio1Call extends ethereum.Call { + get inputs(): SetMinLiquidityRatio1Call__Inputs { + return new SetMinLiquidityRatio1Call__Inputs(this); + } + + get outputs(): SetMinLiquidityRatio1Call__Outputs { + return new SetMinLiquidityRatio1Call__Outputs(this); + } +} + +export class SetMinLiquidityRatio1Call__Inputs { + _call: SetMinLiquidityRatio1Call; + + constructor(call: SetMinLiquidityRatio1Call) { + this._call = call; + } + + get minLiquidityRatio(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class SetMinLiquidityRatio1Call__Outputs { + _call: SetMinLiquidityRatio1Call; + + constructor(call: SetMinLiquidityRatio1Call) { + this._call = call; + } +} + +export class SetPoolCollateralConfigurationCall extends ethereum.Call { + get inputs(): SetPoolCollateralConfigurationCall__Inputs { + return new SetPoolCollateralConfigurationCall__Inputs(this); + } + + get outputs(): SetPoolCollateralConfigurationCall__Outputs { + return new SetPoolCollateralConfigurationCall__Outputs(this); + } +} + +export class SetPoolCollateralConfigurationCall__Inputs { + _call: SetPoolCollateralConfigurationCall; + + constructor(call: SetPoolCollateralConfigurationCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get newConfig(): SetPoolCollateralConfigurationCallNewConfigStruct { + return changetype( + this._call.inputValues[2].value.toTuple() + ); + } +} + +export class SetPoolCollateralConfigurationCall__Outputs { + _call: SetPoolCollateralConfigurationCall; + + constructor(call: SetPoolCollateralConfigurationCall) { + this._call = call; + } +} + +export class SetPoolCollateralConfigurationCallNewConfigStruct extends ethereum.Tuple { + get collateralLimitD18(): BigInt { + return this[0].toBigInt(); + } + + get issuanceRatioD18(): BigInt { + return this[1].toBigInt(); + } +} + +export class SetPoolCollateralDisabledByDefaultCall extends ethereum.Call { + get inputs(): SetPoolCollateralDisabledByDefaultCall__Inputs { + return new SetPoolCollateralDisabledByDefaultCall__Inputs(this); + } + + get outputs(): SetPoolCollateralDisabledByDefaultCall__Outputs { + return new SetPoolCollateralDisabledByDefaultCall__Outputs(this); + } +} + +export class SetPoolCollateralDisabledByDefaultCall__Inputs { + _call: SetPoolCollateralDisabledByDefaultCall; + + constructor(call: SetPoolCollateralDisabledByDefaultCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get disabled(): boolean { + return this._call.inputValues[1].value.toBoolean(); + } +} + +export class SetPoolCollateralDisabledByDefaultCall__Outputs { + _call: SetPoolCollateralDisabledByDefaultCall; + + constructor(call: SetPoolCollateralDisabledByDefaultCall) { + this._call = call; + } +} + +export class SetPoolConfigurationCall extends ethereum.Call { + get inputs(): SetPoolConfigurationCall__Inputs { + return new SetPoolConfigurationCall__Inputs(this); + } + + get outputs(): SetPoolConfigurationCall__Outputs { + return new SetPoolConfigurationCall__Outputs(this); + } +} + +export class SetPoolConfigurationCall__Inputs { + _call: SetPoolConfigurationCall; + + constructor(call: SetPoolConfigurationCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get newMarketConfigurations(): Array { + return this._call.inputValues[1].value.toTupleArray(); + } +} + +export class SetPoolConfigurationCall__Outputs { + _call: SetPoolConfigurationCall; + + constructor(call: SetPoolConfigurationCall) { + this._call = call; + } +} + +export class SetPoolConfigurationCallNewMarketConfigurationsStruct extends ethereum.Tuple { + get marketId(): BigInt { + return this[0].toBigInt(); + } + + get weightD18(): BigInt { + return this[1].toBigInt(); + } + + get maxDebtShareValueD18(): BigInt { + return this[2].toBigInt(); + } +} + +export class SetPoolNameCall extends ethereum.Call { + get inputs(): SetPoolNameCall__Inputs { + return new SetPoolNameCall__Inputs(this); + } + + get outputs(): SetPoolNameCall__Outputs { + return new SetPoolNameCall__Outputs(this); + } +} + +export class SetPoolNameCall__Inputs { + _call: SetPoolNameCall; + + constructor(call: SetPoolNameCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get name(): string { + return this._call.inputValues[1].value.toString(); + } +} + +export class SetPoolNameCall__Outputs { + _call: SetPoolNameCall; + + constructor(call: SetPoolNameCall) { + this._call = call; + } +} + +export class ClaimRewardsCall extends ethereum.Call { + get inputs(): ClaimRewardsCall__Inputs { + return new ClaimRewardsCall__Inputs(this); + } + + get outputs(): ClaimRewardsCall__Outputs { + return new ClaimRewardsCall__Outputs(this); + } +} + +export class ClaimRewardsCall__Inputs { + _call: ClaimRewardsCall; + + constructor(call: ClaimRewardsCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[2].value.toAddress(); + } + + get distributor(): Address { + return this._call.inputValues[3].value.toAddress(); + } +} + +export class ClaimRewardsCall__Outputs { + _call: ClaimRewardsCall; + + constructor(call: ClaimRewardsCall) { + this._call = call; + } + + get value0(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class DistributeRewardsCall extends ethereum.Call { + get inputs(): DistributeRewardsCall__Inputs { + return new DistributeRewardsCall__Inputs(this); + } + + get outputs(): DistributeRewardsCall__Outputs { + return new DistributeRewardsCall__Outputs(this); + } +} + +export class DistributeRewardsCall__Inputs { + _call: DistributeRewardsCall; + + constructor(call: DistributeRewardsCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get amount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get start(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } + + get duration(): BigInt { + return this._call.inputValues[4].value.toBigInt(); + } +} + +export class DistributeRewardsCall__Outputs { + _call: DistributeRewardsCall; + + constructor(call: DistributeRewardsCall) { + this._call = call; + } +} + +export class RegisterRewardsDistributorCall extends ethereum.Call { + get inputs(): RegisterRewardsDistributorCall__Inputs { + return new RegisterRewardsDistributorCall__Inputs(this); + } + + get outputs(): RegisterRewardsDistributorCall__Outputs { + return new RegisterRewardsDistributorCall__Outputs(this); + } +} + +export class RegisterRewardsDistributorCall__Inputs { + _call: RegisterRewardsDistributorCall; + + constructor(call: RegisterRewardsDistributorCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get distributor(): Address { + return this._call.inputValues[2].value.toAddress(); + } +} + +export class RegisterRewardsDistributorCall__Outputs { + _call: RegisterRewardsDistributorCall; + + constructor(call: RegisterRewardsDistributorCall) { + this._call = call; + } +} + +export class RemoveRewardsDistributorCall extends ethereum.Call { + get inputs(): RemoveRewardsDistributorCall__Inputs { + return new RemoveRewardsDistributorCall__Inputs(this); + } + + get outputs(): RemoveRewardsDistributorCall__Outputs { + return new RemoveRewardsDistributorCall__Outputs(this); + } +} + +export class RemoveRewardsDistributorCall__Inputs { + _call: RemoveRewardsDistributorCall; + + constructor(call: RemoveRewardsDistributorCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get distributor(): Address { + return this._call.inputValues[2].value.toAddress(); + } +} + +export class RemoveRewardsDistributorCall__Outputs { + _call: RemoveRewardsDistributorCall; + + constructor(call: RemoveRewardsDistributorCall) { + this._call = call; + } +} + +export class UpdateRewardsCall extends ethereum.Call { + get inputs(): UpdateRewardsCall__Inputs { + return new UpdateRewardsCall__Inputs(this); + } + + get outputs(): UpdateRewardsCall__Outputs { + return new UpdateRewardsCall__Outputs(this); + } +} + +export class UpdateRewardsCall__Inputs { + _call: UpdateRewardsCall; + + constructor(call: UpdateRewardsCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get accountId(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class UpdateRewardsCall__Outputs { + _call: UpdateRewardsCall; + + constructor(call: UpdateRewardsCall) { + this._call = call; + } + + get value0(): Array { + return this._call.outputValues[0].value.toBigIntArray(); + } + + get value1(): Array
{ + return this._call.outputValues[1].value.toAddressArray(); + } +} + +export class ConfigureChainlinkCrossChainCall extends ethereum.Call { + get inputs(): ConfigureChainlinkCrossChainCall__Inputs { + return new ConfigureChainlinkCrossChainCall__Inputs(this); + } + + get outputs(): ConfigureChainlinkCrossChainCall__Outputs { + return new ConfigureChainlinkCrossChainCall__Outputs(this); + } +} + +export class ConfigureChainlinkCrossChainCall__Inputs { + _call: ConfigureChainlinkCrossChainCall; + + constructor(call: ConfigureChainlinkCrossChainCall) { + this._call = call; + } + + get ccipRouter(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get ccipTokenPool(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class ConfigureChainlinkCrossChainCall__Outputs { + _call: ConfigureChainlinkCrossChainCall; + + constructor(call: ConfigureChainlinkCrossChainCall) { + this._call = call; + } +} + +export class ConfigureOracleManagerCall extends ethereum.Call { + get inputs(): ConfigureOracleManagerCall__Inputs { + return new ConfigureOracleManagerCall__Inputs(this); + } + + get outputs(): ConfigureOracleManagerCall__Outputs { + return new ConfigureOracleManagerCall__Outputs(this); + } +} + +export class ConfigureOracleManagerCall__Inputs { + _call: ConfigureOracleManagerCall; + + constructor(call: ConfigureOracleManagerCall) { + this._call = call; + } + + get oracleManagerAddress(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class ConfigureOracleManagerCall__Outputs { + _call: ConfigureOracleManagerCall; + + constructor(call: ConfigureOracleManagerCall) { + this._call = call; + } +} + +export class SetConfigCall extends ethereum.Call { + get inputs(): SetConfigCall__Inputs { + return new SetConfigCall__Inputs(this); + } + + get outputs(): SetConfigCall__Outputs { + return new SetConfigCall__Outputs(this); + } +} + +export class SetConfigCall__Inputs { + _call: SetConfigCall; + + constructor(call: SetConfigCall) { + this._call = call; + } + + get k(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get v(): Bytes { + return this._call.inputValues[1].value.toBytes(); + } +} + +export class SetConfigCall__Outputs { + _call: SetConfigCall; + + constructor(call: SetConfigCall) { + this._call = call; + } +} + +export class SetSupportedCrossChainNetworksCall extends ethereum.Call { + get inputs(): SetSupportedCrossChainNetworksCall__Inputs { + return new SetSupportedCrossChainNetworksCall__Inputs(this); + } + + get outputs(): SetSupportedCrossChainNetworksCall__Outputs { + return new SetSupportedCrossChainNetworksCall__Outputs(this); + } +} + +export class SetSupportedCrossChainNetworksCall__Inputs { + _call: SetSupportedCrossChainNetworksCall; + + constructor(call: SetSupportedCrossChainNetworksCall) { + this._call = call; + } + + get supportedNetworks(): Array { + return this._call.inputValues[0].value.toBigIntArray(); + } + + get ccipSelectors(): Array { + return this._call.inputValues[1].value.toBigIntArray(); + } +} + +export class SetSupportedCrossChainNetworksCall__Outputs { + _call: SetSupportedCrossChainNetworksCall; + + constructor(call: SetSupportedCrossChainNetworksCall) { + this._call = call; + } + + get numRegistered(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class DelegateCollateralCall extends ethereum.Call { + get inputs(): DelegateCollateralCall__Inputs { + return new DelegateCollateralCall__Inputs(this); + } + + get outputs(): DelegateCollateralCall__Outputs { + return new DelegateCollateralCall__Outputs(this); + } +} + +export class DelegateCollateralCall__Inputs { + _call: DelegateCollateralCall; + + constructor(call: DelegateCollateralCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[2].value.toAddress(); + } + + get newCollateralAmountD18(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } + + get leverage(): BigInt { + return this._call.inputValues[4].value.toBigInt(); + } +} + +export class DelegateCollateralCall__Outputs { + _call: DelegateCollateralCall; + + constructor(call: DelegateCollateralCall) { + this._call = call; + } +} + +export class GetPositionCall extends ethereum.Call { + get inputs(): GetPositionCall__Inputs { + return new GetPositionCall__Inputs(this); + } + + get outputs(): GetPositionCall__Outputs { + return new GetPositionCall__Outputs(this); + } +} + +export class GetPositionCall__Inputs { + _call: GetPositionCall; + + constructor(call: GetPositionCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[2].value.toAddress(); + } +} + +export class GetPositionCall__Outputs { + _call: GetPositionCall; + + constructor(call: GetPositionCall) { + this._call = call; + } + + get collateralAmount(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } + + get collateralValue(): BigInt { + return this._call.outputValues[1].value.toBigInt(); + } + + get debt(): BigInt { + return this._call.outputValues[2].value.toBigInt(); + } + + get collateralizationRatio(): BigInt { + return this._call.outputValues[3].value.toBigInt(); + } +} + +export class GetPositionCollateralRatioCall extends ethereum.Call { + get inputs(): GetPositionCollateralRatioCall__Inputs { + return new GetPositionCollateralRatioCall__Inputs(this); + } + + get outputs(): GetPositionCollateralRatioCall__Outputs { + return new GetPositionCollateralRatioCall__Outputs(this); + } +} + +export class GetPositionCollateralRatioCall__Inputs { + _call: GetPositionCollateralRatioCall; + + constructor(call: GetPositionCollateralRatioCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[2].value.toAddress(); + } +} + +export class GetPositionCollateralRatioCall__Outputs { + _call: GetPositionCollateralRatioCall; + + constructor(call: GetPositionCollateralRatioCall) { + this._call = call; + } + + get value0(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class GetPositionDebtCall extends ethereum.Call { + get inputs(): GetPositionDebtCall__Inputs { + return new GetPositionDebtCall__Inputs(this); + } + + get outputs(): GetPositionDebtCall__Outputs { + return new GetPositionDebtCall__Outputs(this); + } +} + +export class GetPositionDebtCall__Inputs { + _call: GetPositionDebtCall; + + constructor(call: GetPositionDebtCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[2].value.toAddress(); + } +} + +export class GetPositionDebtCall__Outputs { + _call: GetPositionDebtCall; + + constructor(call: GetPositionDebtCall) { + this._call = call; + } + + get debt(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class GetVaultCollateralRatioCall extends ethereum.Call { + get inputs(): GetVaultCollateralRatioCall__Inputs { + return new GetVaultCollateralRatioCall__Inputs(this); + } + + get outputs(): GetVaultCollateralRatioCall__Outputs { + return new GetVaultCollateralRatioCall__Outputs(this); + } +} + +export class GetVaultCollateralRatioCall__Inputs { + _call: GetVaultCollateralRatioCall; + + constructor(call: GetVaultCollateralRatioCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class GetVaultCollateralRatioCall__Outputs { + _call: GetVaultCollateralRatioCall; + + constructor(call: GetVaultCollateralRatioCall) { + this._call = call; + } + + get value0(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class GetVaultDebtCall extends ethereum.Call { + get inputs(): GetVaultDebtCall__Inputs { + return new GetVaultDebtCall__Inputs(this); + } + + get outputs(): GetVaultDebtCall__Outputs { + return new GetVaultDebtCall__Outputs(this); + } +} + +export class GetVaultDebtCall__Inputs { + _call: GetVaultDebtCall; + + constructor(call: GetVaultDebtCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class GetVaultDebtCall__Outputs { + _call: GetVaultDebtCall; + + constructor(call: GetVaultDebtCall) { + this._call = call; + } + + get value0(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} diff --git a/protocol/synthetix/subgraph/base-goerli-competition/generated/schema.ts b/protocol/synthetix/subgraph/base-goerli-competition/generated/schema.ts new file mode 100644 index 0000000000..e60007852f --- /dev/null +++ b/protocol/synthetix/subgraph/base-goerli-competition/generated/schema.ts @@ -0,0 +1,2621 @@ +// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. + +import { + TypedMap, + Entity, + Value, + ValueKind, + store, + Bytes, + BigInt, + BigDecimal, +} from '@graphprotocol/graph-ts'; + +export class Pool extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save Pool entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type Pool must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('Pool', id.toString(), this); + } + } + + static loadInBlock(id: string): Pool | null { + return changetype(store.get_in_block('Pool', id)); + } + + static load(id: string): Pool | null { + return changetype(store.get('Pool', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get owner(): Bytes { + let value = this.get('owner'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set owner(value: Bytes) { + this.set('owner', Value.fromBytes(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt | null { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt | null) { + if (!value) { + this.unset('updated_at'); + } else { + this.set('updated_at', Value.fromBigInt(value)); + } + } + + get updated_at_block(): BigInt | null { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt | null) { + if (!value) { + this.unset('updated_at_block'); + } else { + this.set('updated_at_block', Value.fromBigInt(value)); + } + } + + get nominated_owner(): Bytes | null { + let value = this.get('nominated_owner'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBytes(); + } + } + + set nominated_owner(value: Bytes | null) { + if (!value) { + this.unset('nominated_owner'); + } else { + this.set('nominated_owner', Value.fromBytes(value)); + } + } + + get name(): string | null { + let value = this.get('name'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set name(value: string | null) { + if (!value) { + this.unset('name'); + } else { + this.set('name', Value.fromString(value)); + } + } + + get total_weight(): BigInt | null { + let value = this.get('total_weight'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set total_weight(value: BigInt | null) { + if (!value) { + this.unset('total_weight'); + } else { + this.set('total_weight', Value.fromBigInt(value)); + } + } + + get registered_distributors(): Array | null { + let value = this.get('registered_distributors'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toStringArray(); + } + } + + get market_ids(): Array | null { + let value = this.get('market_ids'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toStringArray(); + } + } + + set market_ids(value: Array | null) { + if (!value) { + this.unset('market_ids'); + } else { + this.set('market_ids', Value.fromStringArray(>value)); + } + } + + get configurations(): Array | null { + let value = this.get('configurations'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toStringArray(); + } + } +} + +export class Market extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save Market entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type Market must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('Market', id.toString(), this); + } + } + + static loadInBlock(id: string): Market | null { + return changetype(store.get_in_block('Market', id)); + } + + static load(id: string): Market | null { + return changetype(store.get('Market', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get address(): Bytes { + let value = this.get('address'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set address(value: Bytes) { + this.set('address', Value.fromBytes(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get configurations(): Array | null { + let value = this.get('configurations'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toStringArray(); + } + } + + get market_snapshots_by_day(): Array | null { + let value = this.get('market_snapshots_by_day'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toStringArray(); + } + } + + get market_snapshots_by_week(): Array | null { + let value = this.get('market_snapshots_by_week'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toStringArray(); + } + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } + + get usd_deposited(): BigDecimal { + let value = this.get('usd_deposited'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set usd_deposited(value: BigDecimal) { + this.set('usd_deposited', Value.fromBigDecimal(value)); + } + + get usd_withdrawn(): BigDecimal { + let value = this.get('usd_withdrawn'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set usd_withdrawn(value: BigDecimal) { + this.set('usd_withdrawn', Value.fromBigDecimal(value)); + } + + get net_issuance(): BigDecimal { + let value = this.get('net_issuance'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set net_issuance(value: BigDecimal) { + this.set('net_issuance', Value.fromBigDecimal(value)); + } + + get reported_debt(): BigDecimal { + let value = this.get('reported_debt'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set reported_debt(value: BigDecimal) { + this.set('reported_debt', Value.fromBigDecimal(value)); + } +} + +export class MarketSnapshotByDay extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save MarketSnapshotByDay entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type MarketSnapshotByDay must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('MarketSnapshotByDay', id.toString(), this); + } + } + + static loadInBlock(id: string): MarketSnapshotByDay | null { + return changetype(store.get_in_block('MarketSnapshotByDay', id)); + } + + static load(id: string): MarketSnapshotByDay | null { + return changetype(store.get('MarketSnapshotByDay', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updates_in_period(): BigInt { + let value = this.get('updates_in_period'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updates_in_period(value: BigInt) { + this.set('updates_in_period', Value.fromBigInt(value)); + } + + get market(): string { + let value = this.get('market'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set market(value: string) { + this.set('market', Value.fromString(value)); + } + + get usd_deposited(): BigDecimal { + let value = this.get('usd_deposited'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set usd_deposited(value: BigDecimal) { + this.set('usd_deposited', Value.fromBigDecimal(value)); + } + + get usd_withdrawn(): BigDecimal { + let value = this.get('usd_withdrawn'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set usd_withdrawn(value: BigDecimal) { + this.set('usd_withdrawn', Value.fromBigDecimal(value)); + } + + get net_issuance(): BigDecimal { + let value = this.get('net_issuance'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set net_issuance(value: BigDecimal) { + this.set('net_issuance', Value.fromBigDecimal(value)); + } + + get reported_debt(): BigDecimal { + let value = this.get('reported_debt'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set reported_debt(value: BigDecimal) { + this.set('reported_debt', Value.fromBigDecimal(value)); + } +} + +export class MarketSnapshotByWeek extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save MarketSnapshotByWeek entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type MarketSnapshotByWeek must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('MarketSnapshotByWeek', id.toString(), this); + } + } + + static loadInBlock(id: string): MarketSnapshotByWeek | null { + return changetype(store.get_in_block('MarketSnapshotByWeek', id)); + } + + static load(id: string): MarketSnapshotByWeek | null { + return changetype(store.get('MarketSnapshotByWeek', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updates_in_period(): BigInt { + let value = this.get('updates_in_period'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updates_in_period(value: BigInt) { + this.set('updates_in_period', Value.fromBigInt(value)); + } + + get market(): string { + let value = this.get('market'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set market(value: string) { + this.set('market', Value.fromString(value)); + } + + get usd_deposited(): BigDecimal { + let value = this.get('usd_deposited'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set usd_deposited(value: BigDecimal) { + this.set('usd_deposited', Value.fromBigDecimal(value)); + } + + get usd_withdrawn(): BigDecimal { + let value = this.get('usd_withdrawn'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set usd_withdrawn(value: BigDecimal) { + this.set('usd_withdrawn', Value.fromBigDecimal(value)); + } + + get net_issuance(): BigDecimal { + let value = this.get('net_issuance'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set net_issuance(value: BigDecimal) { + this.set('net_issuance', Value.fromBigDecimal(value)); + } + + get reported_debt(): BigDecimal { + let value = this.get('reported_debt'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set reported_debt(value: BigDecimal) { + this.set('reported_debt', Value.fromBigDecimal(value)); + } +} + +export class MarketConfiguration extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save MarketConfiguration entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type MarketConfiguration must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('MarketConfiguration', id.toString(), this); + } + } + + static loadInBlock(id: string): MarketConfiguration | null { + return changetype(store.get_in_block('MarketConfiguration', id)); + } + + static load(id: string): MarketConfiguration | null { + return changetype(store.get('MarketConfiguration', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get pool(): string { + let value = this.get('pool'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set pool(value: string) { + this.set('pool', Value.fromString(value)); + } + + get market(): string { + let value = this.get('market'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set market(value: string) { + this.set('market', Value.fromString(value)); + } + + get weight(): BigInt { + let value = this.get('weight'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set weight(value: BigInt) { + this.set('weight', Value.fromBigInt(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get max_debt_share_value(): BigDecimal { + let value = this.get('max_debt_share_value'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set max_debt_share_value(value: BigDecimal) { + this.set('max_debt_share_value', Value.fromBigDecimal(value)); + } +} + +export class CollateralType extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save CollateralType entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type CollateralType must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('CollateralType', id.toString(), this); + } + } + + static loadInBlock(id: string): CollateralType | null { + return changetype(store.get_in_block('CollateralType', id)); + } + + static load(id: string): CollateralType | null { + return changetype(store.get('CollateralType', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get oracle_node_id(): BigInt { + let value = this.get('oracle_node_id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set oracle_node_id(value: BigInt) { + this.set('oracle_node_id', Value.fromBigInt(value)); + } + + get depositing_enabled(): boolean { + let value = this.get('depositing_enabled'); + if (!value || value.kind == ValueKind.NULL) { + return false; + } else { + return value.toBoolean(); + } + } + + set depositing_enabled(value: boolean) { + this.set('depositing_enabled', Value.fromBoolean(value)); + } + + get issuance_ratio(): BigDecimal { + let value = this.get('issuance_ratio'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set issuance_ratio(value: BigDecimal) { + this.set('issuance_ratio', Value.fromBigDecimal(value)); + } + + get liquidation_ratio(): BigDecimal { + let value = this.get('liquidation_ratio'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set liquidation_ratio(value: BigDecimal) { + this.set('liquidation_ratio', Value.fromBigDecimal(value)); + } + + get liquidation_reward(): BigDecimal { + let value = this.get('liquidation_reward'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set liquidation_reward(value: BigDecimal) { + this.set('liquidation_reward', Value.fromBigDecimal(value)); + } + + get min_delegation(): BigDecimal { + let value = this.get('min_delegation'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set min_delegation(value: BigDecimal) { + this.set('min_delegation', Value.fromBigDecimal(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } + + get total_amount_deposited(): BigDecimal | null { + let value = this.get('total_amount_deposited'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigDecimal(); + } + } + + set total_amount_deposited(value: BigDecimal | null) { + if (!value) { + this.unset('total_amount_deposited'); + } else { + this.set('total_amount_deposited', Value.fromBigDecimal(value)); + } + } +} + +export class Account extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save Account entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type Account must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('Account', id.toString(), this); + } + } + + static loadInBlock(id: string): Account | null { + return changetype(store.get_in_block('Account', id)); + } + + static load(id: string): Account | null { + return changetype(store.get('Account', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get owner(): Bytes { + let value = this.get('owner'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set owner(value: Bytes) { + this.set('owner', Value.fromBytes(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } + + get permissions(): Array | null { + let value = this.get('permissions'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toStringArray(); + } + } + + set permissions(value: Array | null) { + if (!value) { + this.unset('permissions'); + } else { + this.set('permissions', Value.fromStringArray(>value)); + } + } +} + +export class AccountPermissionUsers extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save AccountPermissionUsers entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type AccountPermissionUsers must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('AccountPermissionUsers', id.toString(), this); + } + } + + static loadInBlock(id: string): AccountPermissionUsers | null { + return changetype( + store.get_in_block('AccountPermissionUsers', id) + ); + } + + static load(id: string): AccountPermissionUsers | null { + return changetype(store.get('AccountPermissionUsers', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get address(): Bytes { + let value = this.get('address'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set address(value: Bytes) { + this.set('address', Value.fromBytes(value)); + } + + get account(): string { + let value = this.get('account'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set account(value: string) { + this.set('account', Value.fromString(value)); + } + + get permissions(): Array { + let value = this.get('permissions'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytesArray(); + } + } + + set permissions(value: Array) { + this.set('permissions', Value.fromBytesArray(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } +} + +export class Position extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save Position entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type Position must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('Position', id.toString(), this); + } + } + + static loadInBlock(id: string): Position | null { + return changetype(store.get_in_block('Position', id)); + } + + static load(id: string): Position | null { + return changetype(store.get('Position', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get collateral_amount(): BigDecimal { + let value = this.get('collateral_amount'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set collateral_amount(value: BigDecimal) { + this.set('collateral_amount', Value.fromBigDecimal(value)); + } + + get leverage(): BigDecimal { + let value = this.get('leverage'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set leverage(value: BigDecimal) { + this.set('leverage', Value.fromBigDecimal(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } + + get account(): string { + let value = this.get('account'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set account(value: string) { + this.set('account', Value.fromString(value)); + } + + get pool(): string { + let value = this.get('pool'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set pool(value: string) { + this.set('pool', Value.fromString(value)); + } + + get collateral_type(): string { + let value = this.get('collateral_type'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set collateral_type(value: string) { + this.set('collateral_type', Value.fromString(value)); + } + + get net_issuance(): BigDecimal | null { + let value = this.get('net_issuance'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigDecimal(); + } + } + + set net_issuance(value: BigDecimal | null) { + if (!value) { + this.unset('net_issuance'); + } else { + this.set('net_issuance', Value.fromBigDecimal(value)); + } + } + + get total_minted(): BigDecimal | null { + let value = this.get('total_minted'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigDecimal(); + } + } + + set total_minted(value: BigDecimal | null) { + if (!value) { + this.unset('total_minted'); + } else { + this.set('total_minted', Value.fromBigDecimal(value)); + } + } + + get total_burned(): BigDecimal | null { + let value = this.get('total_burned'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigDecimal(); + } + } + + set total_burned(value: BigDecimal | null) { + if (!value) { + this.unset('total_burned'); + } else { + this.set('total_burned', Value.fromBigDecimal(value)); + } + } +} + +export class Vault extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save Vault entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type Vault must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('Vault', id.toString(), this); + } + } + + static loadInBlock(id: string): Vault | null { + return changetype(store.get_in_block('Vault', id)); + } + + static load(id: string): Vault | null { + return changetype(store.get('Vault', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get collateral_amount(): BigDecimal { + let value = this.get('collateral_amount'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set collateral_amount(value: BigDecimal) { + this.set('collateral_amount', Value.fromBigDecimal(value)); + } + + get collateral_type(): string { + let value = this.get('collateral_type'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set collateral_type(value: string) { + this.set('collateral_type', Value.fromString(value)); + } + + get pool(): string { + let value = this.get('pool'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set pool(value: string) { + this.set('pool', Value.fromString(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } +} + +export class RewardsDistributor extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save RewardsDistributor entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type RewardsDistributor must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('RewardsDistributor', id.toString(), this); + } + } + + static loadInBlock(id: string): RewardsDistributor | null { + return changetype(store.get_in_block('RewardsDistributor', id)); + } + + static load(id: string): RewardsDistributor | null { + return changetype(store.get('RewardsDistributor', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get total_distributed(): BigDecimal { + let value = this.get('total_distributed'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set total_distributed(value: BigDecimal) { + this.set('total_distributed', Value.fromBigDecimal(value)); + } + + get total_claimed(): BigDecimal { + let value = this.get('total_claimed'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set total_claimed(value: BigDecimal) { + this.set('total_claimed', Value.fromBigDecimal(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } + + get pool(): string { + let value = this.get('pool'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set pool(value: string) { + this.set('pool', Value.fromString(value)); + } +} + +export class RewardsDistribution extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save RewardsDistribution entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type RewardsDistribution must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('RewardsDistribution', id.toString(), this); + } + } + + static loadInBlock(id: string): RewardsDistribution | null { + return changetype(store.get_in_block('RewardsDistribution', id)); + } + + static load(id: string): RewardsDistribution | null { + return changetype(store.get('RewardsDistribution', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get collateral_type(): Bytes { + let value = this.get('collateral_type'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set collateral_type(value: Bytes) { + this.set('collateral_type', Value.fromBytes(value)); + } + + get pool(): string { + let value = this.get('pool'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set pool(value: string) { + this.set('pool', Value.fromString(value)); + } + + get amount(): BigDecimal { + let value = this.get('amount'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set amount(value: BigDecimal) { + this.set('amount', Value.fromBigDecimal(value)); + } + + get start(): BigInt { + let value = this.get('start'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set start(value: BigInt) { + this.set('start', Value.fromBigInt(value)); + } + + get duration(): BigInt { + let value = this.get('duration'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set duration(value: BigInt) { + this.set('duration', Value.fromBigInt(value)); + } + + get distributor(): string { + let value = this.get('distributor'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set distributor(value: string) { + this.set('distributor', Value.fromString(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } +} + +export class AccountRewardsDistributor extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save AccountRewardsDistributor entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type AccountRewardsDistributor must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('AccountRewardsDistributor', id.toString(), this); + } + } + + static loadInBlock(id: string): AccountRewardsDistributor | null { + return changetype( + store.get_in_block('AccountRewardsDistributor', id) + ); + } + + static load(id: string): AccountRewardsDistributor | null { + return changetype(store.get('AccountRewardsDistributor', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get distributor(): string { + let value = this.get('distributor'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set distributor(value: string) { + this.set('distributor', Value.fromString(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } + + get total_claimed(): BigDecimal | null { + let value = this.get('total_claimed'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigDecimal(); + } + } + + set total_claimed(value: BigDecimal | null) { + if (!value) { + this.unset('total_claimed'); + } else { + this.set('total_claimed', Value.fromBigDecimal(value)); + } + } +} + +export class RewardsClaimed extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save RewardsClaimed entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type RewardsClaimed must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('RewardsClaimed', id.toString(), this); + } + } + + static loadInBlock(id: string): RewardsClaimed | null { + return changetype(store.get_in_block('RewardsClaimed', id)); + } + + static load(id: string): RewardsClaimed | null { + return changetype(store.get('RewardsClaimed', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get account(): string { + let value = this.get('account'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set account(value: string) { + this.set('account', Value.fromString(value)); + } + + get pool(): string { + let value = this.get('pool'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set pool(value: string) { + this.set('pool', Value.fromString(value)); + } + + get collateral_type(): Bytes { + let value = this.get('collateral_type'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set collateral_type(value: Bytes) { + this.set('collateral_type', Value.fromBytes(value)); + } + + get distributor(): string { + let value = this.get('distributor'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set distributor(value: string) { + this.set('distributor', Value.fromString(value)); + } + + get amount(): BigDecimal { + let value = this.get('amount'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set amount(value: BigDecimal) { + this.set('amount', Value.fromBigDecimal(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } +} + +export class Liquidation extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save Liquidation entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type Liquidation must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('Liquidation', id.toString(), this); + } + } + + static loadInBlock(id: string): Liquidation | null { + return changetype(store.get_in_block('Liquidation', id)); + } + + static load(id: string): Liquidation | null { + return changetype(store.get('Liquidation', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get account(): string { + let value = this.get('account'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set account(value: string) { + this.set('account', Value.fromString(value)); + } + + get pool(): string { + let value = this.get('pool'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set pool(value: string) { + this.set('pool', Value.fromString(value)); + } + + get collateral_type(): Bytes { + let value = this.get('collateral_type'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set collateral_type(value: Bytes) { + this.set('collateral_type', Value.fromBytes(value)); + } + + get debt_liquidated(): BigDecimal { + let value = this.get('debt_liquidated'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set debt_liquidated(value: BigDecimal) { + this.set('debt_liquidated', Value.fromBigDecimal(value)); + } + + get collateral_liquidated(): BigDecimal { + let value = this.get('collateral_liquidated'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set collateral_liquidated(value: BigDecimal) { + this.set('collateral_liquidated', Value.fromBigDecimal(value)); + } + + get amount_rewarded(): BigDecimal { + let value = this.get('amount_rewarded'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set amount_rewarded(value: BigDecimal) { + this.set('amount_rewarded', Value.fromBigDecimal(value)); + } + + get liquidate_as_account_id(): string { + let value = this.get('liquidate_as_account_id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set liquidate_as_account_id(value: string) { + this.set('liquidate_as_account_id', Value.fromString(value)); + } + + get sender(): Bytes { + let value = this.get('sender'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set sender(value: Bytes) { + this.set('sender', Value.fromBytes(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } +} + +export class VaultLiquidation extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save VaultLiquidation entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type VaultLiquidation must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('VaultLiquidation', id.toString(), this); + } + } + + static loadInBlock(id: string): VaultLiquidation | null { + return changetype(store.get_in_block('VaultLiquidation', id)); + } + + static load(id: string): VaultLiquidation | null { + return changetype(store.get('VaultLiquidation', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get pool(): string { + let value = this.get('pool'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set pool(value: string) { + this.set('pool', Value.fromString(value)); + } + + get collateral_type(): Bytes { + let value = this.get('collateral_type'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set collateral_type(value: Bytes) { + this.set('collateral_type', Value.fromBytes(value)); + } + + get amount_rewarded(): BigDecimal { + let value = this.get('amount_rewarded'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set amount_rewarded(value: BigDecimal) { + this.set('amount_rewarded', Value.fromBigDecimal(value)); + } + + get amount_liquidated(): BigDecimal { + let value = this.get('amount_liquidated'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set amount_liquidated(value: BigDecimal) { + this.set('amount_liquidated', Value.fromBigDecimal(value)); + } + + get collateral_liquidated(): BigDecimal { + let value = this.get('collateral_liquidated'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set collateral_liquidated(value: BigDecimal) { + this.set('collateral_liquidated', Value.fromBigDecimal(value)); + } + + get liquidate_as_account_id(): string { + let value = this.get('liquidate_as_account_id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set liquidate_as_account_id(value: string) { + this.set('liquidate_as_account_id', Value.fromString(value)); + } + + get sender(): Bytes { + let value = this.get('sender'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set sender(value: Bytes) { + this.set('sender', Value.fromBytes(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } +} diff --git a/protocol/synthetix/subgraph/base-goerli-competition/index.ts b/protocol/synthetix/subgraph/base-goerli-competition/index.ts new file mode 100644 index 0000000000..9b7aa5617d --- /dev/null +++ b/protocol/synthetix/subgraph/base-goerli-competition/index.ts @@ -0,0 +1,29 @@ +// base-goerli has exactly same deployments as mainnet (in theory lol), so we reuse all the handlers +// If some handlers need to be different - we copy-paste them into base-goerli folder and make adjustments. Later when aligned with mainnet -- revert import +export * from '../mainnet/getISOWeekNumber'; +export * from '../mainnet/handleAccountCreated'; +export * from '../mainnet/handleCollateralConfigured'; +export * from '../mainnet/handleCollateralDeposited'; +export * from '../mainnet/handleCollateralWithdrawn'; +export * from '../mainnet/handleDelegationUpdated'; +export * from '../mainnet/handleLiquidation'; +export * from '../mainnet/handleMarketCreated'; +export * from '../mainnet/handleMarketUsdDeposited'; +export * from '../mainnet/handleMarketUsdWithdrawn'; +export * from '../mainnet/handlePermissionGranted'; +export * from '../mainnet/handlePermissionRevoked'; +export * from '../mainnet/handlePoolConfigurationSet'; +export * from '../mainnet/handlePoolCreated'; +export * from '../mainnet/handlePoolNameUpdated'; +export * from '../mainnet/handlePoolNominationRenounced'; +export * from '../mainnet/handlePoolNominationRevoked'; +export * from '../mainnet/handlePoolOwnerNominated'; +export * from '../mainnet/handlePoolOwnershipAccepted'; +export * from '../mainnet/handleRewardsClaimed'; +export * from '../mainnet/handleRewardsDistributed'; +export * from '../mainnet/handleRewardsDistributorRegistered'; +export * from '../mainnet/handleUSDBurned'; +export * from '../mainnet/handleUSDMinted'; +export * from '../mainnet/handleVaultLiquidation'; +export * from '../mainnet/marketSnapshotByDay'; +export * from '../mainnet/marketSnapshotByWeek'; diff --git a/protocol/synthetix/subgraph/base-goerli-competition/schema.graphql b/protocol/synthetix/subgraph/base-goerli-competition/schema.graphql new file mode 100644 index 0000000000..73878cae44 --- /dev/null +++ b/protocol/synthetix/subgraph/base-goerli-competition/schema.graphql @@ -0,0 +1,239 @@ +type Pool @entity { + id: ID! + owner: Bytes! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt + updated_at_block: BigInt + "Defined when a owner is nominated and empty if he revoked, or got revoked" + nominated_owner: Bytes + "Only set when name of the pool got updated" + name: String + total_weight: BigInt + "Registered rewards distributors" + registered_distributors: [RewardsDistributor!] @derivedFrom(field: "pool") + "This is an internal field, needed to keep configurations in sync. The reason for this is due to derived fields are no readable from event handlers. Consumers should look up markets by the configurations field" + market_ids: [String!] + configurations: [MarketConfiguration!] @derivedFrom(field: "pool") +} + +type Market @entity { + id: ID! + address: Bytes! + created_at: BigInt! + created_at_block: BigInt! + configurations: [MarketConfiguration!] @derivedFrom(field: "market") + market_snapshots_by_day: [MarketSnapshotByDay!] @derivedFrom(field: "market") + market_snapshots_by_week: [MarketSnapshotByWeek!] + @derivedFrom(field: "market") + updated_at: BigInt! + updated_at_block: BigInt! + usd_deposited: BigDecimal! + usd_withdrawn: BigDecimal! + "withdrawn - deposited" + net_issuance: BigDecimal! + reported_debt: BigDecimal! +} + +type MarketSnapshotByDay @entity { + "marketId-YYYY-MM-DD" + id: ID! + updated_at: BigInt! + updated_at_block: BigInt! + created_at: BigInt! + created_at_block: BigInt! + updates_in_period: BigInt! + market: Market! + usd_deposited: BigDecimal! + usd_withdrawn: BigDecimal! + "withdrawn - deposited" + net_issuance: BigDecimal! + reported_debt: BigDecimal! +} + +type MarketSnapshotByWeek @entity { + "marketId-YYYY-WeekNumber" + id: ID! + updated_at: BigInt! + updated_at_block: BigInt! + created_at: BigInt! + created_at_block: BigInt! + updates_in_period: BigInt! + market: Market! + usd_deposited: BigDecimal! + usd_withdrawn: BigDecimal! + "withdrawn - deposited" + net_issuance: BigDecimal! + reported_debt: BigDecimal! +} + +type MarketConfiguration @entity { + "PoolId-MarketId" + id: ID! + pool: Pool! + market: Market! + weight: BigInt! + created_at: BigInt! + created_at_block: BigInt! + updated_at_block: BigInt! + updated_at: BigInt! + max_debt_share_value: BigDecimal! +} + +type CollateralType @entity { + "Address of the ERC20 contract" + id: ID! + oracle_node_id: BigInt! + depositing_enabled: Boolean! + issuance_ratio: BigDecimal! + liquidation_ratio: BigDecimal! + liquidation_reward: BigDecimal! + min_delegation: BigDecimal! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt! + updated_at_block: BigInt! + total_amount_deposited: BigDecimal +} + +type Account @entity { + "NFT token id" + id: ID! + owner: Bytes! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt! + updated_at_block: BigInt! + permissions: [AccountPermissionUsers!] +} + +type AccountPermissionUsers @entity { + "NFT token id + user address" + id: ID! + address: Bytes! + account: Account! + permissions: [Bytes!]! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt! + updated_at_block: BigInt! +} + +type Position @entity { + "NFT token id + pool id + collateral type address" + id: ID! + collateral_amount: BigDecimal! + leverage: BigDecimal! + # TODO @dev find a way to calculate that without a contract call + # c_ratio: BigDecimal! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt! + updated_at_block: BigInt! + account: Account! + pool: Pool! + collateral_type: CollateralType! + "total-minted - total_burned" + net_issuance: BigDecimal + total_minted: BigDecimal + total_burned: BigDecimal +} + +type Vault @entity { + "Pool id + collateral type address" + id: ID! + collateral_amount: BigDecimal! + collateral_type: CollateralType! + pool: Pool! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt! + updated_at_block: BigInt! +} + +type RewardsDistributor @entity { + "Address of the distributor" + id: ID! + "Total amount of to be or already distributions" + total_distributed: BigDecimal! + "Total amount of claimed distributions" + total_claimed: BigDecimal! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt! + updated_at_block: BigInt! + pool: Pool! +} + +type RewardsDistribution @entity { + "Rewards distributor address + timestamp + log index" + id: ID! + collateral_type: Bytes! + pool: Pool! + amount: BigDecimal! + start: BigInt! + duration: BigInt! + distributor: RewardsDistributor! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt! + updated_at_block: BigInt! +} + +type AccountRewardsDistributor @entity { + "Pool id + collateral type + distributor" + id: ID! + distributor: RewardsDistributor! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt! + updated_at_block: BigInt! + total_claimed: BigDecimal +} + +type RewardsClaimed @entity { + "Rewards distributor id + timestamp + log index" + id: ID! + account: Account! + pool: Pool! + collateral_type: Bytes! + distributor: RewardsDistributor! + amount: BigDecimal! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt! + updated_at_block: BigInt! +} + +type Liquidation @entity { + "NFT token id + pool id + collateral_type + log index (number of occurence)" + id: ID! + account: Account! + pool: Pool! + collateral_type: Bytes! + debt_liquidated: BigDecimal! + collateral_liquidated: BigDecimal! + amount_rewarded: BigDecimal! + liquidate_as_account_id: Account! + sender: Bytes! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt! + updated_at_block: BigInt! +} + +type VaultLiquidation @entity { + "Pool id + collateral type + log index (number of occurence)" + id: ID! + pool: Pool! + collateral_type: Bytes! + amount_rewarded: BigDecimal! + amount_liquidated: BigDecimal! + collateral_liquidated: BigDecimal! + liquidate_as_account_id: Account! + sender: Bytes! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt! + updated_at_block: BigInt! +} diff --git a/protocol/synthetix/subgraph/base-goerli/generated/CoreProxy/CoreProxy.ts b/protocol/synthetix/subgraph/base-goerli/generated/CoreProxy/CoreProxy.ts new file mode 100644 index 0000000000..bc2341f8cc --- /dev/null +++ b/protocol/synthetix/subgraph/base-goerli/generated/CoreProxy/CoreProxy.ts @@ -0,0 +1,6724 @@ +// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. + +import { + ethereum, + JSONValue, + TypedMap, + Entity, + Bytes, + Address, + BigInt, +} from '@graphprotocol/graph-ts'; + +export class OwnerChanged extends ethereum.Event { + get params(): OwnerChanged__Params { + return new OwnerChanged__Params(this); + } +} + +export class OwnerChanged__Params { + _event: OwnerChanged; + + constructor(event: OwnerChanged) { + this._event = event; + } + + get oldOwner(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get newOwner(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class OwnerNominated extends ethereum.Event { + get params(): OwnerNominated__Params { + return new OwnerNominated__Params(this); + } +} + +export class OwnerNominated__Params { + _event: OwnerNominated; + + constructor(event: OwnerNominated) { + this._event = event; + } + + get newOwner(): Address { + return this._event.parameters[0].value.toAddress(); + } +} + +export class Upgraded extends ethereum.Event { + get params(): Upgraded__Params { + return new Upgraded__Params(this); + } +} + +export class Upgraded__Params { + _event: Upgraded; + + constructor(event: Upgraded) { + this._event = event; + } + + get self(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get implementation(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class FeatureFlagAllowAllSet extends ethereum.Event { + get params(): FeatureFlagAllowAllSet__Params { + return new FeatureFlagAllowAllSet__Params(this); + } +} + +export class FeatureFlagAllowAllSet__Params { + _event: FeatureFlagAllowAllSet; + + constructor(event: FeatureFlagAllowAllSet) { + this._event = event; + } + + get feature(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get allowAll(): boolean { + return this._event.parameters[1].value.toBoolean(); + } +} + +export class FeatureFlagAllowlistAdded extends ethereum.Event { + get params(): FeatureFlagAllowlistAdded__Params { + return new FeatureFlagAllowlistAdded__Params(this); + } +} + +export class FeatureFlagAllowlistAdded__Params { + _event: FeatureFlagAllowlistAdded; + + constructor(event: FeatureFlagAllowlistAdded) { + this._event = event; + } + + get feature(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get account(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class FeatureFlagAllowlistRemoved extends ethereum.Event { + get params(): FeatureFlagAllowlistRemoved__Params { + return new FeatureFlagAllowlistRemoved__Params(this); + } +} + +export class FeatureFlagAllowlistRemoved__Params { + _event: FeatureFlagAllowlistRemoved; + + constructor(event: FeatureFlagAllowlistRemoved) { + this._event = event; + } + + get feature(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get account(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class FeatureFlagDeniersReset extends ethereum.Event { + get params(): FeatureFlagDeniersReset__Params { + return new FeatureFlagDeniersReset__Params(this); + } +} + +export class FeatureFlagDeniersReset__Params { + _event: FeatureFlagDeniersReset; + + constructor(event: FeatureFlagDeniersReset) { + this._event = event; + } + + get feature(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get deniers(): Array
{ + return this._event.parameters[1].value.toAddressArray(); + } +} + +export class FeatureFlagDenyAllSet extends ethereum.Event { + get params(): FeatureFlagDenyAllSet__Params { + return new FeatureFlagDenyAllSet__Params(this); + } +} + +export class FeatureFlagDenyAllSet__Params { + _event: FeatureFlagDenyAllSet; + + constructor(event: FeatureFlagDenyAllSet) { + this._event = event; + } + + get feature(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get denyAll(): boolean { + return this._event.parameters[1].value.toBoolean(); + } +} + +export class AccountCreated extends ethereum.Event { + get params(): AccountCreated__Params { + return new AccountCreated__Params(this); + } +} + +export class AccountCreated__Params { + _event: AccountCreated; + + constructor(event: AccountCreated) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get owner(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class PermissionGranted extends ethereum.Event { + get params(): PermissionGranted__Params { + return new PermissionGranted__Params(this); + } +} + +export class PermissionGranted__Params { + _event: PermissionGranted; + + constructor(event: PermissionGranted) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get permission(): Bytes { + return this._event.parameters[1].value.toBytes(); + } + + get user(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get sender(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class PermissionRevoked extends ethereum.Event { + get params(): PermissionRevoked__Params { + return new PermissionRevoked__Params(this); + } +} + +export class PermissionRevoked__Params { + _event: PermissionRevoked; + + constructor(event: PermissionRevoked) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get permission(): Bytes { + return this._event.parameters[1].value.toBytes(); + } + + get user(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get sender(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class DebtAssociated extends ethereum.Event { + get params(): DebtAssociated__Params { + return new DebtAssociated__Params(this); + } +} + +export class DebtAssociated__Params { + _event: DebtAssociated; + + constructor(event: DebtAssociated) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get accountId(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get amount(): BigInt { + return this._event.parameters[4].value.toBigInt(); + } + + get updatedDebt(): BigInt { + return this._event.parameters[5].value.toBigInt(); + } +} + +export class AssociatedSystemSet extends ethereum.Event { + get params(): AssociatedSystemSet__Params { + return new AssociatedSystemSet__Params(this); + } +} + +export class AssociatedSystemSet__Params { + _event: AssociatedSystemSet; + + constructor(event: AssociatedSystemSet) { + this._event = event; + } + + get kind(): Bytes { + return this._event.parameters[0].value.toBytes(); + } + + get id(): Bytes { + return this._event.parameters[1].value.toBytes(); + } + + get proxy(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get impl(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class CollateralLockCreated extends ethereum.Event { + get params(): CollateralLockCreated__Params { + return new CollateralLockCreated__Params(this); + } +} + +export class CollateralLockCreated__Params { + _event: CollateralLockCreated; + + constructor(event: CollateralLockCreated) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenAmount(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get expireTimestamp(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } +} + +export class CollateralLockExpired extends ethereum.Event { + get params(): CollateralLockExpired__Params { + return new CollateralLockExpired__Params(this); + } +} + +export class CollateralLockExpired__Params { + _event: CollateralLockExpired; + + constructor(event: CollateralLockExpired) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenAmount(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get expireTimestamp(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } +} + +export class Deposited extends ethereum.Event { + get params(): Deposited__Params { + return new Deposited__Params(this); + } +} + +export class Deposited__Params { + _event: Deposited; + + constructor(event: Deposited) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenAmount(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class Withdrawn extends ethereum.Event { + get params(): Withdrawn__Params { + return new Withdrawn__Params(this); + } +} + +export class Withdrawn__Params { + _event: Withdrawn; + + constructor(event: Withdrawn) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenAmount(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class CollateralConfigured extends ethereum.Event { + get params(): CollateralConfigured__Params { + return new CollateralConfigured__Params(this); + } +} + +export class CollateralConfigured__Params { + _event: CollateralConfigured; + + constructor(event: CollateralConfigured) { + this._event = event; + } + + get collateralType(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get config(): CollateralConfiguredConfigStruct { + return changetype(this._event.parameters[1].value.toTuple()); + } +} + +export class CollateralConfiguredConfigStruct extends ethereum.Tuple { + get depositingEnabled(): boolean { + return this[0].toBoolean(); + } + + get issuanceRatioD18(): BigInt { + return this[1].toBigInt(); + } + + get liquidationRatioD18(): BigInt { + return this[2].toBigInt(); + } + + get liquidationRewardD18(): BigInt { + return this[3].toBigInt(); + } + + get oracleNodeId(): Bytes { + return this[4].toBytes(); + } + + get tokenAddress(): Address { + return this[5].toAddress(); + } + + get minDelegationD18(): BigInt { + return this[6].toBigInt(); + } +} + +export class TransferCrossChainInitiated extends ethereum.Event { + get params(): TransferCrossChainInitiated__Params { + return new TransferCrossChainInitiated__Params(this); + } +} + +export class TransferCrossChainInitiated__Params { + _event: TransferCrossChainInitiated; + + constructor(event: TransferCrossChainInitiated) { + this._event = event; + } + + get destChainId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get amount(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[2].value.toAddress(); + } +} + +export class IssuanceFeePaid extends ethereum.Event { + get params(): IssuanceFeePaid__Params { + return new IssuanceFeePaid__Params(this); + } +} + +export class IssuanceFeePaid__Params { + _event: IssuanceFeePaid; + + constructor(event: IssuanceFeePaid) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get feeAmount(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } +} + +export class UsdBurned extends ethereum.Event { + get params(): UsdBurned__Params { + return new UsdBurned__Params(this); + } +} + +export class UsdBurned__Params { + _event: UsdBurned; + + constructor(event: UsdBurned) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get amount(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[4].value.toAddress(); + } +} + +export class UsdMinted extends ethereum.Event { + get params(): UsdMinted__Params { + return new UsdMinted__Params(this); + } +} + +export class UsdMinted__Params { + _event: UsdMinted; + + constructor(event: UsdMinted) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get amount(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[4].value.toAddress(); + } +} + +export class Liquidation extends ethereum.Event { + get params(): Liquidation__Params { + return new Liquidation__Params(this); + } +} + +export class Liquidation__Params { + _event: Liquidation; + + constructor(event: Liquidation) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get liquidationData(): LiquidationLiquidationDataStruct { + return changetype(this._event.parameters[3].value.toTuple()); + } + + get liquidateAsAccountId(): BigInt { + return this._event.parameters[4].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[5].value.toAddress(); + } +} + +export class LiquidationLiquidationDataStruct extends ethereum.Tuple { + get debtLiquidated(): BigInt { + return this[0].toBigInt(); + } + + get collateralLiquidated(): BigInt { + return this[1].toBigInt(); + } + + get amountRewarded(): BigInt { + return this[2].toBigInt(); + } +} + +export class VaultLiquidation extends ethereum.Event { + get params(): VaultLiquidation__Params { + return new VaultLiquidation__Params(this); + } +} + +export class VaultLiquidation__Params { + _event: VaultLiquidation; + + constructor(event: VaultLiquidation) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get liquidationData(): VaultLiquidationLiquidationDataStruct { + return changetype( + this._event.parameters[2].value.toTuple() + ); + } + + get liquidateAsAccountId(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[4].value.toAddress(); + } +} + +export class VaultLiquidationLiquidationDataStruct extends ethereum.Tuple { + get debtLiquidated(): BigInt { + return this[0].toBigInt(); + } + + get collateralLiquidated(): BigInt { + return this[1].toBigInt(); + } + + get amountRewarded(): BigInt { + return this[2].toBigInt(); + } +} + +export class MarketCollateralDeposited extends ethereum.Event { + get params(): MarketCollateralDeposited__Params { + return new MarketCollateralDeposited__Params(this); + } +} + +export class MarketCollateralDeposited__Params { + _event: MarketCollateralDeposited; + + constructor(event: MarketCollateralDeposited) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenAmount(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class MarketCollateralWithdrawn extends ethereum.Event { + get params(): MarketCollateralWithdrawn__Params { + return new MarketCollateralWithdrawn__Params(this); + } +} + +export class MarketCollateralWithdrawn__Params { + _event: MarketCollateralWithdrawn; + + constructor(event: MarketCollateralWithdrawn) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get tokenAmount(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class MaximumMarketCollateralConfigured extends ethereum.Event { + get params(): MaximumMarketCollateralConfigured__Params { + return new MaximumMarketCollateralConfigured__Params(this); + } +} + +export class MaximumMarketCollateralConfigured__Params { + _event: MaximumMarketCollateralConfigured; + + constructor(event: MaximumMarketCollateralConfigured) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get systemAmount(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get owner(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class MarketRegistered extends ethereum.Event { + get params(): MarketRegistered__Params { + return new MarketRegistered__Params(this); + } +} + +export class MarketRegistered__Params { + _event: MarketRegistered; + + constructor(event: MarketRegistered) { + this._event = event; + } + + get market(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get marketId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[2].value.toAddress(); + } +} + +export class MarketSystemFeePaid extends ethereum.Event { + get params(): MarketSystemFeePaid__Params { + return new MarketSystemFeePaid__Params(this); + } +} + +export class MarketSystemFeePaid__Params { + _event: MarketSystemFeePaid; + + constructor(event: MarketSystemFeePaid) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get feeAmount(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class MarketUsdDeposited extends ethereum.Event { + get params(): MarketUsdDeposited__Params { + return new MarketUsdDeposited__Params(this); + } +} + +export class MarketUsdDeposited__Params { + _event: MarketUsdDeposited; + + constructor(event: MarketUsdDeposited) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get target(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get amount(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get market(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class MarketUsdWithdrawn extends ethereum.Event { + get params(): MarketUsdWithdrawn__Params { + return new MarketUsdWithdrawn__Params(this); + } +} + +export class MarketUsdWithdrawn__Params { + _event: MarketUsdWithdrawn; + + constructor(event: MarketUsdWithdrawn) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get target(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get amount(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get market(): Address { + return this._event.parameters[3].value.toAddress(); + } +} + +export class SetMarketMinLiquidityRatio extends ethereum.Event { + get params(): SetMarketMinLiquidityRatio__Params { + return new SetMarketMinLiquidityRatio__Params(this); + } +} + +export class SetMarketMinLiquidityRatio__Params { + _event: SetMarketMinLiquidityRatio; + + constructor(event: SetMarketMinLiquidityRatio) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get minLiquidityRatio(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class SetMinDelegateTime extends ethereum.Event { + get params(): SetMinDelegateTime__Params { + return new SetMinDelegateTime__Params(this); + } +} + +export class SetMinDelegateTime__Params { + _event: SetMinDelegateTime; + + constructor(event: SetMinDelegateTime) { + this._event = event; + } + + get marketId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get minDelegateTime(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } +} + +export class PoolApprovedAdded extends ethereum.Event { + get params(): PoolApprovedAdded__Params { + return new PoolApprovedAdded__Params(this); + } +} + +export class PoolApprovedAdded__Params { + _event: PoolApprovedAdded; + + constructor(event: PoolApprovedAdded) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } +} + +export class PoolApprovedRemoved extends ethereum.Event { + get params(): PoolApprovedRemoved__Params { + return new PoolApprovedRemoved__Params(this); + } +} + +export class PoolApprovedRemoved__Params { + _event: PoolApprovedRemoved; + + constructor(event: PoolApprovedRemoved) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } +} + +export class PreferredPoolSet extends ethereum.Event { + get params(): PreferredPoolSet__Params { + return new PreferredPoolSet__Params(this); + } +} + +export class PreferredPoolSet__Params { + _event: PreferredPoolSet; + + constructor(event: PreferredPoolSet) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } +} + +export class PoolCollateralConfigurationUpdated extends ethereum.Event { + get params(): PoolCollateralConfigurationUpdated__Params { + return new PoolCollateralConfigurationUpdated__Params(this); + } +} + +export class PoolCollateralConfigurationUpdated__Params { + _event: PoolCollateralConfigurationUpdated; + + constructor(event: PoolCollateralConfigurationUpdated) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get config(): PoolCollateralConfigurationUpdatedConfigStruct { + return changetype( + this._event.parameters[2].value.toTuple() + ); + } +} + +export class PoolCollateralConfigurationUpdatedConfigStruct extends ethereum.Tuple { + get collateralLimitD18(): BigInt { + return this[0].toBigInt(); + } + + get issuanceRatioD18(): BigInt { + return this[1].toBigInt(); + } +} + +export class PoolCollateralDisabledByDefaultSet extends ethereum.Event { + get params(): PoolCollateralDisabledByDefaultSet__Params { + return new PoolCollateralDisabledByDefaultSet__Params(this); + } +} + +export class PoolCollateralDisabledByDefaultSet__Params { + _event: PoolCollateralDisabledByDefaultSet; + + constructor(event: PoolCollateralDisabledByDefaultSet) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get disabled(): boolean { + return this._event.parameters[1].value.toBoolean(); + } +} + +export class PoolConfigurationSet extends ethereum.Event { + get params(): PoolConfigurationSet__Params { + return new PoolConfigurationSet__Params(this); + } +} + +export class PoolConfigurationSet__Params { + _event: PoolConfigurationSet; + + constructor(event: PoolConfigurationSet) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get markets(): Array { + return this._event.parameters[1].value.toTupleArray(); + } + + get sender(): Address { + return this._event.parameters[2].value.toAddress(); + } +} + +export class PoolConfigurationSetMarketsStruct extends ethereum.Tuple { + get marketId(): BigInt { + return this[0].toBigInt(); + } + + get weightD18(): BigInt { + return this[1].toBigInt(); + } + + get maxDebtShareValueD18(): BigInt { + return this[2].toBigInt(); + } +} + +export class PoolCreated extends ethereum.Event { + get params(): PoolCreated__Params { + return new PoolCreated__Params(this); + } +} + +export class PoolCreated__Params { + _event: PoolCreated; + + constructor(event: PoolCreated) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get owner(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get sender(): Address { + return this._event.parameters[2].value.toAddress(); + } +} + +export class PoolNameUpdated extends ethereum.Event { + get params(): PoolNameUpdated__Params { + return new PoolNameUpdated__Params(this); + } +} + +export class PoolNameUpdated__Params { + _event: PoolNameUpdated; + + constructor(event: PoolNameUpdated) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get name(): string { + return this._event.parameters[1].value.toString(); + } + + get sender(): Address { + return this._event.parameters[2].value.toAddress(); + } +} + +export class PoolNominationRenounced extends ethereum.Event { + get params(): PoolNominationRenounced__Params { + return new PoolNominationRenounced__Params(this); + } +} + +export class PoolNominationRenounced__Params { + _event: PoolNominationRenounced; + + constructor(event: PoolNominationRenounced) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get owner(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class PoolNominationRevoked extends ethereum.Event { + get params(): PoolNominationRevoked__Params { + return new PoolNominationRevoked__Params(this); + } +} + +export class PoolNominationRevoked__Params { + _event: PoolNominationRevoked; + + constructor(event: PoolNominationRevoked) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get owner(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class PoolOwnerNominated extends ethereum.Event { + get params(): PoolOwnerNominated__Params { + return new PoolOwnerNominated__Params(this); + } +} + +export class PoolOwnerNominated__Params { + _event: PoolOwnerNominated; + + constructor(event: PoolOwnerNominated) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get nominatedOwner(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get owner(): Address { + return this._event.parameters[2].value.toAddress(); + } +} + +export class PoolOwnershipAccepted extends ethereum.Event { + get params(): PoolOwnershipAccepted__Params { + return new PoolOwnershipAccepted__Params(this); + } +} + +export class PoolOwnershipAccepted__Params { + _event: PoolOwnershipAccepted; + + constructor(event: PoolOwnershipAccepted) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get owner(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class SetMinLiquidityRatio extends ethereum.Event { + get params(): SetMinLiquidityRatio__Params { + return new SetMinLiquidityRatio__Params(this); + } +} + +export class SetMinLiquidityRatio__Params { + _event: SetMinLiquidityRatio; + + constructor(event: SetMinLiquidityRatio) { + this._event = event; + } + + get minLiquidityRatio(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } +} + +export class RewardsClaimed extends ethereum.Event { + get params(): RewardsClaimed__Params { + return new RewardsClaimed__Params(this); + } +} + +export class RewardsClaimed__Params { + _event: RewardsClaimed; + + constructor(event: RewardsClaimed) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get distributor(): Address { + return this._event.parameters[3].value.toAddress(); + } + + get amount(): BigInt { + return this._event.parameters[4].value.toBigInt(); + } +} + +export class RewardsDistributed extends ethereum.Event { + get params(): RewardsDistributed__Params { + return new RewardsDistributed__Params(this); + } +} + +export class RewardsDistributed__Params { + _event: RewardsDistributed; + + constructor(event: RewardsDistributed) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get distributor(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get amount(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get start(): BigInt { + return this._event.parameters[4].value.toBigInt(); + } + + get duration(): BigInt { + return this._event.parameters[5].value.toBigInt(); + } +} + +export class RewardsDistributorRegistered extends ethereum.Event { + get params(): RewardsDistributorRegistered__Params { + return new RewardsDistributorRegistered__Params(this); + } +} + +export class RewardsDistributorRegistered__Params { + _event: RewardsDistributorRegistered; + + constructor(event: RewardsDistributorRegistered) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get distributor(): Address { + return this._event.parameters[2].value.toAddress(); + } +} + +export class RewardsDistributorRemoved extends ethereum.Event { + get params(): RewardsDistributorRemoved__Params { + return new RewardsDistributorRemoved__Params(this); + } +} + +export class RewardsDistributorRemoved__Params { + _event: RewardsDistributorRemoved; + + constructor(event: RewardsDistributorRemoved) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get distributor(): Address { + return this._event.parameters[2].value.toAddress(); + } +} + +export class NewSupportedCrossChainNetwork extends ethereum.Event { + get params(): NewSupportedCrossChainNetwork__Params { + return new NewSupportedCrossChainNetwork__Params(this); + } +} + +export class NewSupportedCrossChainNetwork__Params { + _event: NewSupportedCrossChainNetwork; + + constructor(event: NewSupportedCrossChainNetwork) { + this._event = event; + } + + get newChainId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } +} + +export class DelegationUpdated extends ethereum.Event { + get params(): DelegationUpdated__Params { + return new DelegationUpdated__Params(this); + } +} + +export class DelegationUpdated__Params { + _event: DelegationUpdated; + + constructor(event: DelegationUpdated) { + this._event = event; + } + + get accountId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[2].value.toAddress(); + } + + get amount(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } + + get leverage(): BigInt { + return this._event.parameters[4].value.toBigInt(); + } + + get sender(): Address { + return this._event.parameters[5].value.toAddress(); + } +} + +export class CoreProxy__getAccountPermissionsResultAccountPermsStruct extends ethereum.Tuple { + get user(): Address { + return this[0].toAddress(); + } + + get permissions(): Array { + return this[1].toBytesArray(); + } +} + +export class CoreProxy__getAssociatedSystemResult { + value0: Address; + value1: Bytes; + + constructor(value0: Address, value1: Bytes) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromAddress(this.value0)); + map.set('value1', ethereum.Value.fromFixedBytes(this.value1)); + return map; + } + + getAddr(): Address { + return this.value0; + } + + getKind(): Bytes { + return this.value1; + } +} + +export class CoreProxy__getAccountCollateralResult { + value0: BigInt; + value1: BigInt; + value2: BigInt; + + constructor(value0: BigInt, value1: BigInt, value2: BigInt) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + map.set('value2', ethereum.Value.fromUnsignedBigInt(this.value2)); + return map; + } + + getTotalDeposited(): BigInt { + return this.value0; + } + + getTotalAssigned(): BigInt { + return this.value1; + } + + getTotalLocked(): BigInt { + return this.value2; + } +} + +export class CoreProxy__getLocksResultLocksStruct extends ethereum.Tuple { + get amountD18(): BigInt { + return this[0].toBigInt(); + } + + get lockExpirationTime(): BigInt { + return this[1].toBigInt(); + } +} + +export class CoreProxy__getCollateralConfigurationResultValue0Struct extends ethereum.Tuple { + get depositingEnabled(): boolean { + return this[0].toBoolean(); + } + + get issuanceRatioD18(): BigInt { + return this[1].toBigInt(); + } + + get liquidationRatioD18(): BigInt { + return this[2].toBigInt(); + } + + get liquidationRewardD18(): BigInt { + return this[3].toBigInt(); + } + + get oracleNodeId(): Bytes { + return this[4].toBytes(); + } + + get tokenAddress(): Address { + return this[5].toAddress(); + } + + get minDelegationD18(): BigInt { + return this[6].toBigInt(); + } +} + +export class CoreProxy__getCollateralConfigurationsResultValue0Struct extends ethereum.Tuple { + get depositingEnabled(): boolean { + return this[0].toBoolean(); + } + + get issuanceRatioD18(): BigInt { + return this[1].toBigInt(); + } + + get liquidationRatioD18(): BigInt { + return this[2].toBigInt(); + } + + get liquidationRewardD18(): BigInt { + return this[3].toBigInt(); + } + + get oracleNodeId(): Bytes { + return this[4].toBytes(); + } + + get tokenAddress(): Address { + return this[5].toAddress(); + } + + get minDelegationD18(): BigInt { + return this[6].toBigInt(); + } +} + +export class CoreProxy__liquidateResultLiquidationDataStruct extends ethereum.Tuple { + get debtLiquidated(): BigInt { + return this[0].toBigInt(); + } + + get collateralLiquidated(): BigInt { + return this[1].toBigInt(); + } + + get amountRewarded(): BigInt { + return this[2].toBigInt(); + } +} + +export class CoreProxy__liquidateVaultResultLiquidationDataStruct extends ethereum.Tuple { + get debtLiquidated(): BigInt { + return this[0].toBigInt(); + } + + get collateralLiquidated(): BigInt { + return this[1].toBigInt(); + } + + get amountRewarded(): BigInt { + return this[2].toBigInt(); + } +} + +export class CoreProxy__getMarketFeesResult { + value0: BigInt; + value1: BigInt; + + constructor(value0: BigInt, value1: BigInt) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + return map; + } + + getDepositFeeAmount(): BigInt { + return this.value0; + } + + getWithdrawFeeAmount(): BigInt { + return this.value1; + } +} + +export class CoreProxy__getMarketPoolDebtDistributionResult { + value0: BigInt; + value1: BigInt; + value2: BigInt; + + constructor(value0: BigInt, value1: BigInt, value2: BigInt) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + map.set('value2', ethereum.Value.fromSignedBigInt(this.value2)); + return map; + } + + getSharesD18(): BigInt { + return this.value0; + } + + getTotalSharesD18(): BigInt { + return this.value1; + } + + getValuePerShareD27(): BigInt { + return this.value2; + } +} + +export class CoreProxy__getMarketPoolsResult { + value0: Array; + value1: Array; + + constructor(value0: Array, value1: Array) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigIntArray(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigIntArray(this.value1)); + return map; + } + + getInRangePoolIds(): Array { + return this.value0; + } + + getOutRangePoolIds(): Array { + return this.value1; + } +} + +export class CoreProxy__getPoolConfigurationResultValue0Struct extends ethereum.Tuple { + get marketId(): BigInt { + return this[0].toBigInt(); + } + + get weightD18(): BigInt { + return this[1].toBigInt(); + } + + get maxDebtShareValueD18(): BigInt { + return this[2].toBigInt(); + } +} + +export class CoreProxy__updateRewardsResult { + value0: Array; + value1: Array
; + + constructor(value0: Array, value1: Array
) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigIntArray(this.value0)); + map.set('value1', ethereum.Value.fromAddressArray(this.value1)); + return map; + } + + getValue0(): Array { + return this.value0; + } + + getValue1(): Array
{ + return this.value1; + } +} + +export class CoreProxy__getPositionResult { + value0: BigInt; + value1: BigInt; + value2: BigInt; + value3: BigInt; + + constructor(value0: BigInt, value1: BigInt, value2: BigInt, value3: BigInt) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + this.value3 = value3; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + map.set('value2', ethereum.Value.fromSignedBigInt(this.value2)); + map.set('value3', ethereum.Value.fromUnsignedBigInt(this.value3)); + return map; + } + + getCollateralAmount(): BigInt { + return this.value0; + } + + getCollateralValue(): BigInt { + return this.value1; + } + + getDebt(): BigInt { + return this.value2; + } + + getCollateralizationRatio(): BigInt { + return this.value3; + } +} + +export class CoreProxy__getPositionCollateralResult { + value0: BigInt; + value1: BigInt; + + constructor(value0: BigInt, value1: BigInt) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + return map; + } + + getAmount(): BigInt { + return this.value0; + } + + getValue(): BigInt { + return this.value1; + } +} + +export class CoreProxy__getVaultCollateralResult { + value0: BigInt; + value1: BigInt; + + constructor(value0: BigInt, value1: BigInt) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + return map; + } + + getAmount(): BigInt { + return this.value0; + } + + getValue(): BigInt { + return this.value1; + } +} + +export class CoreProxy extends ethereum.SmartContract { + static bind(address: Address): CoreProxy { + return new CoreProxy('CoreProxy', address); + } + + getImplementation(): Address { + let result = super.call('getImplementation', 'getImplementation():(address)', []); + + return result[0].toAddress(); + } + + try_getImplementation(): ethereum.CallResult
{ + let result = super.tryCall('getImplementation', 'getImplementation():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + nominatedOwner(): Address { + let result = super.call('nominatedOwner', 'nominatedOwner():(address)', []); + + return result[0].toAddress(); + } + + try_nominatedOwner(): ethereum.CallResult
{ + let result = super.tryCall('nominatedOwner', 'nominatedOwner():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + owner(): Address { + let result = super.call('owner', 'owner():(address)', []); + + return result[0].toAddress(); + } + + try_owner(): ethereum.CallResult
{ + let result = super.tryCall('owner', 'owner():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + getDeniers(feature: Bytes): Array
{ + let result = super.call('getDeniers', 'getDeniers(bytes32):(address[])', [ + ethereum.Value.fromFixedBytes(feature), + ]); + + return result[0].toAddressArray(); + } + + try_getDeniers(feature: Bytes): ethereum.CallResult> { + let result = super.tryCall('getDeniers', 'getDeniers(bytes32):(address[])', [ + ethereum.Value.fromFixedBytes(feature), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddressArray()); + } + + getFeatureFlagAllowAll(feature: Bytes): boolean { + let result = super.call('getFeatureFlagAllowAll', 'getFeatureFlagAllowAll(bytes32):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ]); + + return result[0].toBoolean(); + } + + try_getFeatureFlagAllowAll(feature: Bytes): ethereum.CallResult { + let result = super.tryCall('getFeatureFlagAllowAll', 'getFeatureFlagAllowAll(bytes32):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + getFeatureFlagAllowlist(feature: Bytes): Array
{ + let result = super.call( + 'getFeatureFlagAllowlist', + 'getFeatureFlagAllowlist(bytes32):(address[])', + [ethereum.Value.fromFixedBytes(feature)] + ); + + return result[0].toAddressArray(); + } + + try_getFeatureFlagAllowlist(feature: Bytes): ethereum.CallResult> { + let result = super.tryCall( + 'getFeatureFlagAllowlist', + 'getFeatureFlagAllowlist(bytes32):(address[])', + [ethereum.Value.fromFixedBytes(feature)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddressArray()); + } + + getFeatureFlagDenyAll(feature: Bytes): boolean { + let result = super.call('getFeatureFlagDenyAll', 'getFeatureFlagDenyAll(bytes32):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ]); + + return result[0].toBoolean(); + } + + try_getFeatureFlagDenyAll(feature: Bytes): ethereum.CallResult { + let result = super.tryCall('getFeatureFlagDenyAll', 'getFeatureFlagDenyAll(bytes32):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + isFeatureAllowed(feature: Bytes, account: Address): boolean { + let result = super.call('isFeatureAllowed', 'isFeatureAllowed(bytes32,address):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ethereum.Value.fromAddress(account), + ]); + + return result[0].toBoolean(); + } + + try_isFeatureAllowed(feature: Bytes, account: Address): ethereum.CallResult { + let result = super.tryCall('isFeatureAllowed', 'isFeatureAllowed(bytes32,address):(bool)', [ + ethereum.Value.fromFixedBytes(feature), + ethereum.Value.fromAddress(account), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + createAccount(): BigInt { + let result = super.call('createAccount', 'createAccount():(uint128)', []); + + return result[0].toBigInt(); + } + + try_createAccount(): ethereum.CallResult { + let result = super.tryCall('createAccount', 'createAccount():(uint128)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getAccountLastInteraction(accountId: BigInt): BigInt { + let result = super.call( + 'getAccountLastInteraction', + 'getAccountLastInteraction(uint128):(uint256)', + [ethereum.Value.fromUnsignedBigInt(accountId)] + ); + + return result[0].toBigInt(); + } + + try_getAccountLastInteraction(accountId: BigInt): ethereum.CallResult { + let result = super.tryCall( + 'getAccountLastInteraction', + 'getAccountLastInteraction(uint128):(uint256)', + [ethereum.Value.fromUnsignedBigInt(accountId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getAccountOwner(accountId: BigInt): Address { + let result = super.call('getAccountOwner', 'getAccountOwner(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ]); + + return result[0].toAddress(); + } + + try_getAccountOwner(accountId: BigInt): ethereum.CallResult
{ + let result = super.tryCall('getAccountOwner', 'getAccountOwner(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + getAccountPermissions( + accountId: BigInt + ): Array { + let result = super.call( + 'getAccountPermissions', + 'getAccountPermissions(uint128):((address,bytes32[])[])', + [ethereum.Value.fromUnsignedBigInt(accountId)] + ); + + return result[0].toTupleArray(); + } + + try_getAccountPermissions( + accountId: BigInt + ): ethereum.CallResult> { + let result = super.tryCall( + 'getAccountPermissions', + 'getAccountPermissions(uint128):((address,bytes32[])[])', + [ethereum.Value.fromUnsignedBigInt(accountId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + value[0].toTupleArray() + ); + } + + getAccountTokenAddress(): Address { + let result = super.call('getAccountTokenAddress', 'getAccountTokenAddress():(address)', []); + + return result[0].toAddress(); + } + + try_getAccountTokenAddress(): ethereum.CallResult
{ + let result = super.tryCall('getAccountTokenAddress', 'getAccountTokenAddress():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + hasPermission(accountId: BigInt, permission: Bytes, user: Address): boolean { + let result = super.call('hasPermission', 'hasPermission(uint128,bytes32,address):(bool)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromFixedBytes(permission), + ethereum.Value.fromAddress(user), + ]); + + return result[0].toBoolean(); + } + + try_hasPermission( + accountId: BigInt, + permission: Bytes, + user: Address + ): ethereum.CallResult { + let result = super.tryCall('hasPermission', 'hasPermission(uint128,bytes32,address):(bool)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromFixedBytes(permission), + ethereum.Value.fromAddress(user), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + isAuthorized(accountId: BigInt, permission: Bytes, user: Address): boolean { + let result = super.call('isAuthorized', 'isAuthorized(uint128,bytes32,address):(bool)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromFixedBytes(permission), + ethereum.Value.fromAddress(user), + ]); + + return result[0].toBoolean(); + } + + try_isAuthorized( + accountId: BigInt, + permission: Bytes, + user: Address + ): ethereum.CallResult { + let result = super.tryCall('isAuthorized', 'isAuthorized(uint128,bytes32,address):(bool)', [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromFixedBytes(permission), + ethereum.Value.fromAddress(user), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + associateDebt( + marketId: BigInt, + poolId: BigInt, + collateralType: Address, + accountId: BigInt, + amount: BigInt + ): BigInt { + let result = super.call( + 'associateDebt', + 'associateDebt(uint128,uint128,address,uint128,uint256):(int256)', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(amount), + ] + ); + + return result[0].toBigInt(); + } + + try_associateDebt( + marketId: BigInt, + poolId: BigInt, + collateralType: Address, + accountId: BigInt, + amount: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'associateDebt', + 'associateDebt(uint128,uint128,address,uint128,uint256):(int256)', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(amount), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getAssociatedSystem(id: Bytes): CoreProxy__getAssociatedSystemResult { + let result = super.call( + 'getAssociatedSystem', + 'getAssociatedSystem(bytes32):(address,bytes32)', + [ethereum.Value.fromFixedBytes(id)] + ); + + return new CoreProxy__getAssociatedSystemResult(result[0].toAddress(), result[1].toBytes()); + } + + try_getAssociatedSystem(id: Bytes): ethereum.CallResult { + let result = super.tryCall( + 'getAssociatedSystem', + 'getAssociatedSystem(bytes32):(address,bytes32)', + [ethereum.Value.fromFixedBytes(id)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__getAssociatedSystemResult(value[0].toAddress(), value[1].toBytes()) + ); + } + + cleanExpiredLocks( + accountId: BigInt, + collateralType: Address, + offset: BigInt, + count: BigInt + ): BigInt { + let result = super.call( + 'cleanExpiredLocks', + 'cleanExpiredLocks(uint128,address,uint256,uint256):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(offset), + ethereum.Value.fromUnsignedBigInt(count), + ] + ); + + return result[0].toBigInt(); + } + + try_cleanExpiredLocks( + accountId: BigInt, + collateralType: Address, + offset: BigInt, + count: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'cleanExpiredLocks', + 'cleanExpiredLocks(uint128,address,uint256,uint256):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(offset), + ethereum.Value.fromUnsignedBigInt(count), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getAccountAvailableCollateral(accountId: BigInt, collateralType: Address): BigInt { + let result = super.call( + 'getAccountAvailableCollateral', + 'getAccountAvailableCollateral(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(accountId), ethereum.Value.fromAddress(collateralType)] + ); + + return result[0].toBigInt(); + } + + try_getAccountAvailableCollateral( + accountId: BigInt, + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getAccountAvailableCollateral', + 'getAccountAvailableCollateral(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(accountId), ethereum.Value.fromAddress(collateralType)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getAccountCollateral( + accountId: BigInt, + collateralType: Address + ): CoreProxy__getAccountCollateralResult { + let result = super.call( + 'getAccountCollateral', + 'getAccountCollateral(uint128,address):(uint256,uint256,uint256)', + [ethereum.Value.fromUnsignedBigInt(accountId), ethereum.Value.fromAddress(collateralType)] + ); + + return new CoreProxy__getAccountCollateralResult( + result[0].toBigInt(), + result[1].toBigInt(), + result[2].toBigInt() + ); + } + + try_getAccountCollateral( + accountId: BigInt, + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getAccountCollateral', + 'getAccountCollateral(uint128,address):(uint256,uint256,uint256)', + [ethereum.Value.fromUnsignedBigInt(accountId), ethereum.Value.fromAddress(collateralType)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__getAccountCollateralResult( + value[0].toBigInt(), + value[1].toBigInt(), + value[2].toBigInt() + ) + ); + } + + getLocks( + accountId: BigInt, + collateralType: Address, + offset: BigInt, + count: BigInt + ): Array { + let result = super.call( + 'getLocks', + 'getLocks(uint128,address,uint256,uint256):((uint128,uint64)[])', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(offset), + ethereum.Value.fromUnsignedBigInt(count), + ] + ); + + return result[0].toTupleArray(); + } + + try_getLocks( + accountId: BigInt, + collateralType: Address, + offset: BigInt, + count: BigInt + ): ethereum.CallResult> { + let result = super.tryCall( + 'getLocks', + 'getLocks(uint128,address,uint256,uint256):((uint128,uint64)[])', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(offset), + ethereum.Value.fromUnsignedBigInt(count), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + value[0].toTupleArray() + ); + } + + getCollateralConfiguration( + collateralType: Address + ): CoreProxy__getCollateralConfigurationResultValue0Struct { + let result = super.call( + 'getCollateralConfiguration', + 'getCollateralConfiguration(address):((bool,uint256,uint256,uint256,bytes32,address,uint256))', + [ethereum.Value.fromAddress(collateralType)] + ); + + return changetype(result[0].toTuple()); + } + + try_getCollateralConfiguration( + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getCollateralConfiguration', + 'getCollateralConfiguration(address):((bool,uint256,uint256,uint256,bytes32,address,uint256))', + [ethereum.Value.fromAddress(collateralType)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + changetype(value[0].toTuple()) + ); + } + + getCollateralConfigurations( + hideDisabled: boolean + ): Array { + let result = super.call( + 'getCollateralConfigurations', + 'getCollateralConfigurations(bool):((bool,uint256,uint256,uint256,bytes32,address,uint256)[])', + [ethereum.Value.fromBoolean(hideDisabled)] + ); + + return result[0].toTupleArray(); + } + + try_getCollateralConfigurations( + hideDisabled: boolean + ): ethereum.CallResult> { + let result = super.tryCall( + 'getCollateralConfigurations', + 'getCollateralConfigurations(bool):((bool,uint256,uint256,uint256,bytes32,address,uint256)[])', + [ethereum.Value.fromBoolean(hideDisabled)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + value[0].toTupleArray() + ); + } + + getCollateralPrice(collateralType: Address): BigInt { + let result = super.call('getCollateralPrice', 'getCollateralPrice(address):(uint256)', [ + ethereum.Value.fromAddress(collateralType), + ]); + + return result[0].toBigInt(); + } + + try_getCollateralPrice(collateralType: Address): ethereum.CallResult { + let result = super.tryCall('getCollateralPrice', 'getCollateralPrice(address):(uint256)', [ + ethereum.Value.fromAddress(collateralType), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + isPositionLiquidatable(accountId: BigInt, poolId: BigInt, collateralType: Address): boolean { + let result = super.call( + 'isPositionLiquidatable', + 'isPositionLiquidatable(uint128,uint128,address):(bool)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ] + ); + + return result[0].toBoolean(); + } + + try_isPositionLiquidatable( + accountId: BigInt, + poolId: BigInt, + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'isPositionLiquidatable', + 'isPositionLiquidatable(uint128,uint128,address):(bool)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + isVaultLiquidatable(poolId: BigInt, collateralType: Address): boolean { + let result = super.call('isVaultLiquidatable', 'isVaultLiquidatable(uint128,address):(bool)', [ + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ]); + + return result[0].toBoolean(); + } + + try_isVaultLiquidatable(poolId: BigInt, collateralType: Address): ethereum.CallResult { + let result = super.tryCall( + 'isVaultLiquidatable', + 'isVaultLiquidatable(uint128,address):(bool)', + [ethereum.Value.fromUnsignedBigInt(poolId), ethereum.Value.fromAddress(collateralType)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + liquidate( + accountId: BigInt, + poolId: BigInt, + collateralType: Address, + liquidateAsAccountId: BigInt + ): CoreProxy__liquidateResultLiquidationDataStruct { + let result = super.call( + 'liquidate', + 'liquidate(uint128,uint128,address,uint128):((uint256,uint256,uint256))', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(liquidateAsAccountId), + ] + ); + + return changetype(result[0].toTuple()); + } + + try_liquidate( + accountId: BigInt, + poolId: BigInt, + collateralType: Address, + liquidateAsAccountId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'liquidate', + 'liquidate(uint128,uint128,address,uint128):((uint256,uint256,uint256))', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(liquidateAsAccountId), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + changetype(value[0].toTuple()) + ); + } + + liquidateVault( + poolId: BigInt, + collateralType: Address, + liquidateAsAccountId: BigInt, + maxUsd: BigInt + ): CoreProxy__liquidateVaultResultLiquidationDataStruct { + let result = super.call( + 'liquidateVault', + 'liquidateVault(uint128,address,uint128,uint256):((uint256,uint256,uint256))', + [ + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(liquidateAsAccountId), + ethereum.Value.fromUnsignedBigInt(maxUsd), + ] + ); + + return changetype(result[0].toTuple()); + } + + try_liquidateVault( + poolId: BigInt, + collateralType: Address, + liquidateAsAccountId: BigInt, + maxUsd: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'liquidateVault', + 'liquidateVault(uint128,address,uint128,uint256):((uint256,uint256,uint256))', + [ + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(liquidateAsAccountId), + ethereum.Value.fromUnsignedBigInt(maxUsd), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + changetype(value[0].toTuple()) + ); + } + + getMarketCollateralAmount(marketId: BigInt, collateralType: Address): BigInt { + let result = super.call( + 'getMarketCollateralAmount', + 'getMarketCollateralAmount(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromAddress(collateralType)] + ); + + return result[0].toBigInt(); + } + + try_getMarketCollateralAmount( + marketId: BigInt, + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getMarketCollateralAmount', + 'getMarketCollateralAmount(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromAddress(collateralType)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getMarketCollateralValue(marketId: BigInt): BigInt { + let result = super.call( + 'getMarketCollateralValue', + 'getMarketCollateralValue(uint128):(uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + + return result[0].toBigInt(); + } + + try_getMarketCollateralValue(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall( + 'getMarketCollateralValue', + 'getMarketCollateralValue(uint128):(uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getMaximumMarketCollateral(marketId: BigInt, collateralType: Address): BigInt { + let result = super.call( + 'getMaximumMarketCollateral', + 'getMaximumMarketCollateral(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromAddress(collateralType)] + ); + + return result[0].toBigInt(); + } + + try_getMaximumMarketCollateral( + marketId: BigInt, + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getMaximumMarketCollateral', + 'getMaximumMarketCollateral(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromAddress(collateralType)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + depositMarketUsd(marketId: BigInt, target: Address, amount: BigInt): BigInt { + let result = super.call( + 'depositMarketUsd', + 'depositMarketUsd(uint128,address,uint256):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromAddress(target), + ethereum.Value.fromUnsignedBigInt(amount), + ] + ); + + return result[0].toBigInt(); + } + + try_depositMarketUsd( + marketId: BigInt, + target: Address, + amount: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'depositMarketUsd', + 'depositMarketUsd(uint128,address,uint256):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromAddress(target), + ethereum.Value.fromUnsignedBigInt(amount), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + distributeDebtToPools(marketId: BigInt, maxIter: BigInt): boolean { + let result = super.call( + 'distributeDebtToPools', + 'distributeDebtToPools(uint128,uint256):(bool)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(maxIter)] + ); + + return result[0].toBoolean(); + } + + try_distributeDebtToPools(marketId: BigInt, maxIter: BigInt): ethereum.CallResult { + let result = super.tryCall( + 'distributeDebtToPools', + 'distributeDebtToPools(uint128,uint256):(bool)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(maxIter)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + getMarketAddress(marketId: BigInt): Address { + let result = super.call('getMarketAddress', 'getMarketAddress(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toAddress(); + } + + try_getMarketAddress(marketId: BigInt): ethereum.CallResult
{ + let result = super.tryCall('getMarketAddress', 'getMarketAddress(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + getMarketCollateral(marketId: BigInt): BigInt { + let result = super.call('getMarketCollateral', 'getMarketCollateral(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBigInt(); + } + + try_getMarketCollateral(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('getMarketCollateral', 'getMarketCollateral(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getMarketDebtPerShare(marketId: BigInt): BigInt { + let result = super.call('getMarketDebtPerShare', 'getMarketDebtPerShare(uint128):(int256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBigInt(); + } + + try_getMarketDebtPerShare(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('getMarketDebtPerShare', 'getMarketDebtPerShare(uint128):(int256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getMarketFees(param0: BigInt, amount: BigInt): CoreProxy__getMarketFeesResult { + let result = super.call('getMarketFees', 'getMarketFees(uint128,uint256):(uint256,uint256)', [ + ethereum.Value.fromUnsignedBigInt(param0), + ethereum.Value.fromUnsignedBigInt(amount), + ]); + + return new CoreProxy__getMarketFeesResult(result[0].toBigInt(), result[1].toBigInt()); + } + + try_getMarketFees( + param0: BigInt, + amount: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'getMarketFees', + 'getMarketFees(uint128,uint256):(uint256,uint256)', + [ethereum.Value.fromUnsignedBigInt(param0), ethereum.Value.fromUnsignedBigInt(amount)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__getMarketFeesResult(value[0].toBigInt(), value[1].toBigInt()) + ); + } + + getMarketMinDelegateTime(marketId: BigInt): BigInt { + let result = super.call( + 'getMarketMinDelegateTime', + 'getMarketMinDelegateTime(uint128):(uint32)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + + return result[0].toBigInt(); + } + + try_getMarketMinDelegateTime(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall( + 'getMarketMinDelegateTime', + 'getMarketMinDelegateTime(uint128):(uint32)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getMarketNetIssuance(marketId: BigInt): BigInt { + let result = super.call('getMarketNetIssuance', 'getMarketNetIssuance(uint128):(int128)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBigInt(); + } + + try_getMarketNetIssuance(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('getMarketNetIssuance', 'getMarketNetIssuance(uint128):(int128)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getMarketPoolDebtDistribution( + marketId: BigInt, + poolId: BigInt + ): CoreProxy__getMarketPoolDebtDistributionResult { + let result = super.call( + 'getMarketPoolDebtDistribution', + 'getMarketPoolDebtDistribution(uint128,uint128):(uint256,uint128,int128)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(poolId)] + ); + + return new CoreProxy__getMarketPoolDebtDistributionResult( + result[0].toBigInt(), + result[1].toBigInt(), + result[2].toBigInt() + ); + } + + try_getMarketPoolDebtDistribution( + marketId: BigInt, + poolId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'getMarketPoolDebtDistribution', + 'getMarketPoolDebtDistribution(uint128,uint128):(uint256,uint128,int128)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(poolId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__getMarketPoolDebtDistributionResult( + value[0].toBigInt(), + value[1].toBigInt(), + value[2].toBigInt() + ) + ); + } + + getMarketPools(marketId: BigInt): CoreProxy__getMarketPoolsResult { + let result = super.call('getMarketPools', 'getMarketPools(uint128):(uint128[],uint128[])', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return new CoreProxy__getMarketPoolsResult( + result[0].toBigIntArray(), + result[1].toBigIntArray() + ); + } + + try_getMarketPools(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('getMarketPools', 'getMarketPools(uint128):(uint128[],uint128[])', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__getMarketPoolsResult(value[0].toBigIntArray(), value[1].toBigIntArray()) + ); + } + + getMarketReportedDebt(marketId: BigInt): BigInt { + let result = super.call('getMarketReportedDebt', 'getMarketReportedDebt(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBigInt(); + } + + try_getMarketReportedDebt(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall( + 'getMarketReportedDebt', + 'getMarketReportedDebt(uint128):(uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getMarketTotalDebt(marketId: BigInt): BigInt { + let result = super.call('getMarketTotalDebt', 'getMarketTotalDebt(uint128):(int256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBigInt(); + } + + try_getMarketTotalDebt(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('getMarketTotalDebt', 'getMarketTotalDebt(uint128):(int256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getMinLiquidityRatio(marketId: BigInt): BigInt { + let result = super.call('getMinLiquidityRatio', 'getMinLiquidityRatio(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBigInt(); + } + + try_getMinLiquidityRatio(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('getMinLiquidityRatio', 'getMinLiquidityRatio(uint128):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getOracleManager(): Address { + let result = super.call('getOracleManager', 'getOracleManager():(address)', []); + + return result[0].toAddress(); + } + + try_getOracleManager(): ethereum.CallResult
{ + let result = super.tryCall('getOracleManager', 'getOracleManager():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + getUsdToken(): Address { + let result = super.call('getUsdToken', 'getUsdToken():(address)', []); + + return result[0].toAddress(); + } + + try_getUsdToken(): ethereum.CallResult
{ + let result = super.tryCall('getUsdToken', 'getUsdToken():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + getWithdrawableMarketUsd(marketId: BigInt): BigInt { + let result = super.call( + 'getWithdrawableMarketUsd', + 'getWithdrawableMarketUsd(uint128):(uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + + return result[0].toBigInt(); + } + + try_getWithdrawableMarketUsd(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall( + 'getWithdrawableMarketUsd', + 'getWithdrawableMarketUsd(uint128):(uint256)', + [ethereum.Value.fromUnsignedBigInt(marketId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + isMarketCapacityLocked(marketId: BigInt): boolean { + let result = super.call('isMarketCapacityLocked', 'isMarketCapacityLocked(uint128):(bool)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toBoolean(); + } + + try_isMarketCapacityLocked(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('isMarketCapacityLocked', 'isMarketCapacityLocked(uint128):(bool)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + registerMarket(market: Address): BigInt { + let result = super.call('registerMarket', 'registerMarket(address):(uint128)', [ + ethereum.Value.fromAddress(market), + ]); + + return result[0].toBigInt(); + } + + try_registerMarket(market: Address): ethereum.CallResult { + let result = super.tryCall('registerMarket', 'registerMarket(address):(uint128)', [ + ethereum.Value.fromAddress(market), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + withdrawMarketUsd(marketId: BigInt, target: Address, amount: BigInt): BigInt { + let result = super.call( + 'withdrawMarketUsd', + 'withdrawMarketUsd(uint128,address,uint256):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromAddress(target), + ethereum.Value.fromUnsignedBigInt(amount), + ] + ); + + return result[0].toBigInt(); + } + + try_withdrawMarketUsd( + marketId: BigInt, + target: Address, + amount: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'withdrawMarketUsd', + 'withdrawMarketUsd(uint128,address,uint256):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(marketId), + ethereum.Value.fromAddress(target), + ethereum.Value.fromUnsignedBigInt(amount), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getMessageSender(): Address { + let result = super.call('getMessageSender', 'getMessageSender():(address)', []); + + return result[0].toAddress(); + } + + try_getMessageSender(): ethereum.CallResult
{ + let result = super.tryCall('getMessageSender', 'getMessageSender():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + multicall(data: Array): Array { + let result = super.call('multicall', 'multicall(bytes[]):(bytes[])', [ + ethereum.Value.fromBytesArray(data), + ]); + + return result[0].toBytesArray(); + } + + try_multicall(data: Array): ethereum.CallResult> { + let result = super.tryCall('multicall', 'multicall(bytes[]):(bytes[])', [ + ethereum.Value.fromBytesArray(data), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBytesArray()); + } + + getApprovedPools(): Array { + let result = super.call('getApprovedPools', 'getApprovedPools():(uint256[])', []); + + return result[0].toBigIntArray(); + } + + try_getApprovedPools(): ethereum.CallResult> { + let result = super.tryCall('getApprovedPools', 'getApprovedPools():(uint256[])', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigIntArray()); + } + + getPreferredPool(): BigInt { + let result = super.call('getPreferredPool', 'getPreferredPool():(uint128)', []); + + return result[0].toBigInt(); + } + + try_getPreferredPool(): ethereum.CallResult { + let result = super.tryCall('getPreferredPool', 'getPreferredPool():(uint128)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getMinLiquidityRatio1(): BigInt { + let result = super.call('getMinLiquidityRatio', 'getMinLiquidityRatio():(uint256)', []); + + return result[0].toBigInt(); + } + + try_getMinLiquidityRatio1(): ethereum.CallResult { + let result = super.tryCall('getMinLiquidityRatio', 'getMinLiquidityRatio():(uint256)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getNominatedPoolOwner(poolId: BigInt): Address { + let result = super.call('getNominatedPoolOwner', 'getNominatedPoolOwner(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(poolId), + ]); + + return result[0].toAddress(); + } + + try_getNominatedPoolOwner(poolId: BigInt): ethereum.CallResult
{ + let result = super.tryCall( + 'getNominatedPoolOwner', + 'getNominatedPoolOwner(uint128):(address)', + [ethereum.Value.fromUnsignedBigInt(poolId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + getPoolCollateralIssuanceRatio(poolId: BigInt, collateral: Address): BigInt { + let result = super.call( + 'getPoolCollateralIssuanceRatio', + 'getPoolCollateralIssuanceRatio(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(poolId), ethereum.Value.fromAddress(collateral)] + ); + + return result[0].toBigInt(); + } + + try_getPoolCollateralIssuanceRatio( + poolId: BigInt, + collateral: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getPoolCollateralIssuanceRatio', + 'getPoolCollateralIssuanceRatio(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(poolId), ethereum.Value.fromAddress(collateral)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getPoolConfiguration(poolId: BigInt): Array { + let result = super.call( + 'getPoolConfiguration', + 'getPoolConfiguration(uint128):((uint128,uint128,int128)[])', + [ethereum.Value.fromUnsignedBigInt(poolId)] + ); + + return result[0].toTupleArray(); + } + + try_getPoolConfiguration( + poolId: BigInt + ): ethereum.CallResult> { + let result = super.tryCall( + 'getPoolConfiguration', + 'getPoolConfiguration(uint128):((uint128,uint128,int128)[])', + [ethereum.Value.fromUnsignedBigInt(poolId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + value[0].toTupleArray() + ); + } + + getPoolName(poolId: BigInt): string { + let result = super.call('getPoolName', 'getPoolName(uint128):(string)', [ + ethereum.Value.fromUnsignedBigInt(poolId), + ]); + + return result[0].toString(); + } + + try_getPoolName(poolId: BigInt): ethereum.CallResult { + let result = super.tryCall('getPoolName', 'getPoolName(uint128):(string)', [ + ethereum.Value.fromUnsignedBigInt(poolId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toString()); + } + + getPoolOwner(poolId: BigInt): Address { + let result = super.call('getPoolOwner', 'getPoolOwner(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(poolId), + ]); + + return result[0].toAddress(); + } + + try_getPoolOwner(poolId: BigInt): ethereum.CallResult
{ + let result = super.tryCall('getPoolOwner', 'getPoolOwner(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(poolId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + claimRewards( + accountId: BigInt, + poolId: BigInt, + collateralType: Address, + distributor: Address + ): BigInt { + let result = super.call( + 'claimRewards', + 'claimRewards(uint128,uint128,address,address):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromAddress(distributor), + ] + ); + + return result[0].toBigInt(); + } + + try_claimRewards( + accountId: BigInt, + poolId: BigInt, + collateralType: Address, + distributor: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'claimRewards', + 'claimRewards(uint128,uint128,address,address):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromAddress(distributor), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getRewardRate(poolId: BigInt, collateralType: Address, distributor: Address): BigInt { + let result = super.call('getRewardRate', 'getRewardRate(uint128,address,address):(uint256)', [ + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromAddress(distributor), + ]); + + return result[0].toBigInt(); + } + + try_getRewardRate( + poolId: BigInt, + collateralType: Address, + distributor: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getRewardRate', + 'getRewardRate(uint128,address,address):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromAddress(distributor), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + updateRewards( + poolId: BigInt, + collateralType: Address, + accountId: BigInt + ): CoreProxy__updateRewardsResult { + let result = super.call( + 'updateRewards', + 'updateRewards(uint128,address,uint128):(uint256[],address[])', + [ + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(accountId), + ] + ); + + return new CoreProxy__updateRewardsResult( + result[0].toBigIntArray(), + result[1].toAddressArray() + ); + } + + try_updateRewards( + poolId: BigInt, + collateralType: Address, + accountId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'updateRewards', + 'updateRewards(uint128,address,uint128):(uint256[],address[])', + [ + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ethereum.Value.fromUnsignedBigInt(accountId), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__updateRewardsResult(value[0].toBigIntArray(), value[1].toAddressArray()) + ); + } + + getConfig(k: Bytes): Bytes { + let result = super.call('getConfig', 'getConfig(bytes32):(bytes32)', [ + ethereum.Value.fromFixedBytes(k), + ]); + + return result[0].toBytes(); + } + + try_getConfig(k: Bytes): ethereum.CallResult { + let result = super.tryCall('getConfig', 'getConfig(bytes32):(bytes32)', [ + ethereum.Value.fromFixedBytes(k), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBytes()); + } + + getConfigAddress(k: Bytes): Address { + let result = super.call('getConfigAddress', 'getConfigAddress(bytes32):(address)', [ + ethereum.Value.fromFixedBytes(k), + ]); + + return result[0].toAddress(); + } + + try_getConfigAddress(k: Bytes): ethereum.CallResult
{ + let result = super.tryCall('getConfigAddress', 'getConfigAddress(bytes32):(address)', [ + ethereum.Value.fromFixedBytes(k), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + getConfigUint(k: Bytes): BigInt { + let result = super.call('getConfigUint', 'getConfigUint(bytes32):(uint256)', [ + ethereum.Value.fromFixedBytes(k), + ]); + + return result[0].toBigInt(); + } + + try_getConfigUint(k: Bytes): ethereum.CallResult { + let result = super.tryCall('getConfigUint', 'getConfigUint(bytes32):(uint256)', [ + ethereum.Value.fromFixedBytes(k), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + setSupportedCrossChainNetworks( + supportedNetworks: Array, + ccipSelectors: Array + ): BigInt { + let result = super.call( + 'setSupportedCrossChainNetworks', + 'setSupportedCrossChainNetworks(uint64[],uint64[]):(uint256)', + [ + ethereum.Value.fromUnsignedBigIntArray(supportedNetworks), + ethereum.Value.fromUnsignedBigIntArray(ccipSelectors), + ] + ); + + return result[0].toBigInt(); + } + + try_setSupportedCrossChainNetworks( + supportedNetworks: Array, + ccipSelectors: Array + ): ethereum.CallResult { + let result = super.tryCall( + 'setSupportedCrossChainNetworks', + 'setSupportedCrossChainNetworks(uint64[],uint64[]):(uint256)', + [ + ethereum.Value.fromUnsignedBigIntArray(supportedNetworks), + ethereum.Value.fromUnsignedBigIntArray(ccipSelectors), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + supportsInterface(interfaceId: Bytes): boolean { + let result = super.call('supportsInterface', 'supportsInterface(bytes4):(bool)', [ + ethereum.Value.fromFixedBytes(interfaceId), + ]); + + return result[0].toBoolean(); + } + + try_supportsInterface(interfaceId: Bytes): ethereum.CallResult { + let result = super.tryCall('supportsInterface', 'supportsInterface(bytes4):(bool)', [ + ethereum.Value.fromFixedBytes(interfaceId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + getPosition( + accountId: BigInt, + poolId: BigInt, + collateralType: Address + ): CoreProxy__getPositionResult { + let result = super.call( + 'getPosition', + 'getPosition(uint128,uint128,address):(uint256,uint256,int256,uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ] + ); + + return new CoreProxy__getPositionResult( + result[0].toBigInt(), + result[1].toBigInt(), + result[2].toBigInt(), + result[3].toBigInt() + ); + } + + try_getPosition( + accountId: BigInt, + poolId: BigInt, + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getPosition', + 'getPosition(uint128,uint128,address):(uint256,uint256,int256,uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__getPositionResult( + value[0].toBigInt(), + value[1].toBigInt(), + value[2].toBigInt(), + value[3].toBigInt() + ) + ); + } + + getPositionCollateral( + accountId: BigInt, + poolId: BigInt, + collateralType: Address + ): CoreProxy__getPositionCollateralResult { + let result = super.call( + 'getPositionCollateral', + 'getPositionCollateral(uint128,uint128,address):(uint256,uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ] + ); + + return new CoreProxy__getPositionCollateralResult(result[0].toBigInt(), result[1].toBigInt()); + } + + try_getPositionCollateral( + accountId: BigInt, + poolId: BigInt, + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getPositionCollateral', + 'getPositionCollateral(uint128,uint128,address):(uint256,uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__getPositionCollateralResult(value[0].toBigInt(), value[1].toBigInt()) + ); + } + + getPositionCollateralRatio(accountId: BigInt, poolId: BigInt, collateralType: Address): BigInt { + let result = super.call( + 'getPositionCollateralRatio', + 'getPositionCollateralRatio(uint128,uint128,address):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ] + ); + + return result[0].toBigInt(); + } + + try_getPositionCollateralRatio( + accountId: BigInt, + poolId: BigInt, + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getPositionCollateralRatio', + 'getPositionCollateralRatio(uint128,uint128,address):(uint256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getPositionDebt(accountId: BigInt, poolId: BigInt, collateralType: Address): BigInt { + let result = super.call( + 'getPositionDebt', + 'getPositionDebt(uint128,uint128,address):(int256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ] + ); + + return result[0].toBigInt(); + } + + try_getPositionDebt( + accountId: BigInt, + poolId: BigInt, + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getPositionDebt', + 'getPositionDebt(uint128,uint128,address):(int256)', + [ + ethereum.Value.fromUnsignedBigInt(accountId), + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getVaultCollateral(poolId: BigInt, collateralType: Address): CoreProxy__getVaultCollateralResult { + let result = super.call( + 'getVaultCollateral', + 'getVaultCollateral(uint128,address):(uint256,uint256)', + [ethereum.Value.fromUnsignedBigInt(poolId), ethereum.Value.fromAddress(collateralType)] + ); + + return new CoreProxy__getVaultCollateralResult(result[0].toBigInt(), result[1].toBigInt()); + } + + try_getVaultCollateral( + poolId: BigInt, + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getVaultCollateral', + 'getVaultCollateral(uint128,address):(uint256,uint256)', + [ethereum.Value.fromUnsignedBigInt(poolId), ethereum.Value.fromAddress(collateralType)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__getVaultCollateralResult(value[0].toBigInt(), value[1].toBigInt()) + ); + } + + getVaultCollateralRatio(poolId: BigInt, collateralType: Address): BigInt { + let result = super.call( + 'getVaultCollateralRatio', + 'getVaultCollateralRatio(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(poolId), ethereum.Value.fromAddress(collateralType)] + ); + + return result[0].toBigInt(); + } + + try_getVaultCollateralRatio( + poolId: BigInt, + collateralType: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getVaultCollateralRatio', + 'getVaultCollateralRatio(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(poolId), ethereum.Value.fromAddress(collateralType)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getVaultDebt(poolId: BigInt, collateralType: Address): BigInt { + let result = super.call('getVaultDebt', 'getVaultDebt(uint128,address):(int256)', [ + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ]); + + return result[0].toBigInt(); + } + + try_getVaultDebt(poolId: BigInt, collateralType: Address): ethereum.CallResult { + let result = super.tryCall('getVaultDebt', 'getVaultDebt(uint128,address):(int256)', [ + ethereum.Value.fromUnsignedBigInt(poolId), + ethereum.Value.fromAddress(collateralType), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } +} + +export class AcceptOwnershipCall extends ethereum.Call { + get inputs(): AcceptOwnershipCall__Inputs { + return new AcceptOwnershipCall__Inputs(this); + } + + get outputs(): AcceptOwnershipCall__Outputs { + return new AcceptOwnershipCall__Outputs(this); + } +} + +export class AcceptOwnershipCall__Inputs { + _call: AcceptOwnershipCall; + + constructor(call: AcceptOwnershipCall) { + this._call = call; + } +} + +export class AcceptOwnershipCall__Outputs { + _call: AcceptOwnershipCall; + + constructor(call: AcceptOwnershipCall) { + this._call = call; + } +} + +export class NominateNewOwnerCall extends ethereum.Call { + get inputs(): NominateNewOwnerCall__Inputs { + return new NominateNewOwnerCall__Inputs(this); + } + + get outputs(): NominateNewOwnerCall__Outputs { + return new NominateNewOwnerCall__Outputs(this); + } +} + +export class NominateNewOwnerCall__Inputs { + _call: NominateNewOwnerCall; + + constructor(call: NominateNewOwnerCall) { + this._call = call; + } + + get newNominatedOwner(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class NominateNewOwnerCall__Outputs { + _call: NominateNewOwnerCall; + + constructor(call: NominateNewOwnerCall) { + this._call = call; + } +} + +export class RenounceNominationCall extends ethereum.Call { + get inputs(): RenounceNominationCall__Inputs { + return new RenounceNominationCall__Inputs(this); + } + + get outputs(): RenounceNominationCall__Outputs { + return new RenounceNominationCall__Outputs(this); + } +} + +export class RenounceNominationCall__Inputs { + _call: RenounceNominationCall; + + constructor(call: RenounceNominationCall) { + this._call = call; + } +} + +export class RenounceNominationCall__Outputs { + _call: RenounceNominationCall; + + constructor(call: RenounceNominationCall) { + this._call = call; + } +} + +export class SimulateUpgradeToCall extends ethereum.Call { + get inputs(): SimulateUpgradeToCall__Inputs { + return new SimulateUpgradeToCall__Inputs(this); + } + + get outputs(): SimulateUpgradeToCall__Outputs { + return new SimulateUpgradeToCall__Outputs(this); + } +} + +export class SimulateUpgradeToCall__Inputs { + _call: SimulateUpgradeToCall; + + constructor(call: SimulateUpgradeToCall) { + this._call = call; + } + + get newImplementation(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class SimulateUpgradeToCall__Outputs { + _call: SimulateUpgradeToCall; + + constructor(call: SimulateUpgradeToCall) { + this._call = call; + } +} + +export class UpgradeToCall extends ethereum.Call { + get inputs(): UpgradeToCall__Inputs { + return new UpgradeToCall__Inputs(this); + } + + get outputs(): UpgradeToCall__Outputs { + return new UpgradeToCall__Outputs(this); + } +} + +export class UpgradeToCall__Inputs { + _call: UpgradeToCall; + + constructor(call: UpgradeToCall) { + this._call = call; + } + + get newImplementation(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class UpgradeToCall__Outputs { + _call: UpgradeToCall; + + constructor(call: UpgradeToCall) { + this._call = call; + } +} + +export class AddToFeatureFlagAllowlistCall extends ethereum.Call { + get inputs(): AddToFeatureFlagAllowlistCall__Inputs { + return new AddToFeatureFlagAllowlistCall__Inputs(this); + } + + get outputs(): AddToFeatureFlagAllowlistCall__Outputs { + return new AddToFeatureFlagAllowlistCall__Outputs(this); + } +} + +export class AddToFeatureFlagAllowlistCall__Inputs { + _call: AddToFeatureFlagAllowlistCall; + + constructor(call: AddToFeatureFlagAllowlistCall) { + this._call = call; + } + + get feature(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get account(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class AddToFeatureFlagAllowlistCall__Outputs { + _call: AddToFeatureFlagAllowlistCall; + + constructor(call: AddToFeatureFlagAllowlistCall) { + this._call = call; + } +} + +export class RemoveFromFeatureFlagAllowlistCall extends ethereum.Call { + get inputs(): RemoveFromFeatureFlagAllowlistCall__Inputs { + return new RemoveFromFeatureFlagAllowlistCall__Inputs(this); + } + + get outputs(): RemoveFromFeatureFlagAllowlistCall__Outputs { + return new RemoveFromFeatureFlagAllowlistCall__Outputs(this); + } +} + +export class RemoveFromFeatureFlagAllowlistCall__Inputs { + _call: RemoveFromFeatureFlagAllowlistCall; + + constructor(call: RemoveFromFeatureFlagAllowlistCall) { + this._call = call; + } + + get feature(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get account(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class RemoveFromFeatureFlagAllowlistCall__Outputs { + _call: RemoveFromFeatureFlagAllowlistCall; + + constructor(call: RemoveFromFeatureFlagAllowlistCall) { + this._call = call; + } +} + +export class SetDeniersCall extends ethereum.Call { + get inputs(): SetDeniersCall__Inputs { + return new SetDeniersCall__Inputs(this); + } + + get outputs(): SetDeniersCall__Outputs { + return new SetDeniersCall__Outputs(this); + } +} + +export class SetDeniersCall__Inputs { + _call: SetDeniersCall; + + constructor(call: SetDeniersCall) { + this._call = call; + } + + get feature(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get deniers(): Array
{ + return this._call.inputValues[1].value.toAddressArray(); + } +} + +export class SetDeniersCall__Outputs { + _call: SetDeniersCall; + + constructor(call: SetDeniersCall) { + this._call = call; + } +} + +export class SetFeatureFlagAllowAllCall extends ethereum.Call { + get inputs(): SetFeatureFlagAllowAllCall__Inputs { + return new SetFeatureFlagAllowAllCall__Inputs(this); + } + + get outputs(): SetFeatureFlagAllowAllCall__Outputs { + return new SetFeatureFlagAllowAllCall__Outputs(this); + } +} + +export class SetFeatureFlagAllowAllCall__Inputs { + _call: SetFeatureFlagAllowAllCall; + + constructor(call: SetFeatureFlagAllowAllCall) { + this._call = call; + } + + get feature(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get allowAll(): boolean { + return this._call.inputValues[1].value.toBoolean(); + } +} + +export class SetFeatureFlagAllowAllCall__Outputs { + _call: SetFeatureFlagAllowAllCall; + + constructor(call: SetFeatureFlagAllowAllCall) { + this._call = call; + } +} + +export class SetFeatureFlagDenyAllCall extends ethereum.Call { + get inputs(): SetFeatureFlagDenyAllCall__Inputs { + return new SetFeatureFlagDenyAllCall__Inputs(this); + } + + get outputs(): SetFeatureFlagDenyAllCall__Outputs { + return new SetFeatureFlagDenyAllCall__Outputs(this); + } +} + +export class SetFeatureFlagDenyAllCall__Inputs { + _call: SetFeatureFlagDenyAllCall; + + constructor(call: SetFeatureFlagDenyAllCall) { + this._call = call; + } + + get feature(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get denyAll(): boolean { + return this._call.inputValues[1].value.toBoolean(); + } +} + +export class SetFeatureFlagDenyAllCall__Outputs { + _call: SetFeatureFlagDenyAllCall; + + constructor(call: SetFeatureFlagDenyAllCall) { + this._call = call; + } +} + +export class CreateAccountCall extends ethereum.Call { + get inputs(): CreateAccountCall__Inputs { + return new CreateAccountCall__Inputs(this); + } + + get outputs(): CreateAccountCall__Outputs { + return new CreateAccountCall__Outputs(this); + } +} + +export class CreateAccountCall__Inputs { + _call: CreateAccountCall; + + constructor(call: CreateAccountCall) { + this._call = call; + } +} + +export class CreateAccountCall__Outputs { + _call: CreateAccountCall; + + constructor(call: CreateAccountCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class CreateAccount1Call extends ethereum.Call { + get inputs(): CreateAccount1Call__Inputs { + return new CreateAccount1Call__Inputs(this); + } + + get outputs(): CreateAccount1Call__Outputs { + return new CreateAccount1Call__Outputs(this); + } +} + +export class CreateAccount1Call__Inputs { + _call: CreateAccount1Call; + + constructor(call: CreateAccount1Call) { + this._call = call; + } + + get requestedAccountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class CreateAccount1Call__Outputs { + _call: CreateAccount1Call; + + constructor(call: CreateAccount1Call) { + this._call = call; + } +} + +export class GrantPermissionCall extends ethereum.Call { + get inputs(): GrantPermissionCall__Inputs { + return new GrantPermissionCall__Inputs(this); + } + + get outputs(): GrantPermissionCall__Outputs { + return new GrantPermissionCall__Outputs(this); + } +} + +export class GrantPermissionCall__Inputs { + _call: GrantPermissionCall; + + constructor(call: GrantPermissionCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get permission(): Bytes { + return this._call.inputValues[1].value.toBytes(); + } + + get user(): Address { + return this._call.inputValues[2].value.toAddress(); + } +} + +export class GrantPermissionCall__Outputs { + _call: GrantPermissionCall; + + constructor(call: GrantPermissionCall) { + this._call = call; + } +} + +export class NotifyAccountTransferCall extends ethereum.Call { + get inputs(): NotifyAccountTransferCall__Inputs { + return new NotifyAccountTransferCall__Inputs(this); + } + + get outputs(): NotifyAccountTransferCall__Outputs { + return new NotifyAccountTransferCall__Outputs(this); + } +} + +export class NotifyAccountTransferCall__Inputs { + _call: NotifyAccountTransferCall; + + constructor(call: NotifyAccountTransferCall) { + this._call = call; + } + + get to(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get accountId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class NotifyAccountTransferCall__Outputs { + _call: NotifyAccountTransferCall; + + constructor(call: NotifyAccountTransferCall) { + this._call = call; + } +} + +export class RenouncePermissionCall extends ethereum.Call { + get inputs(): RenouncePermissionCall__Inputs { + return new RenouncePermissionCall__Inputs(this); + } + + get outputs(): RenouncePermissionCall__Outputs { + return new RenouncePermissionCall__Outputs(this); + } +} + +export class RenouncePermissionCall__Inputs { + _call: RenouncePermissionCall; + + constructor(call: RenouncePermissionCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get permission(): Bytes { + return this._call.inputValues[1].value.toBytes(); + } +} + +export class RenouncePermissionCall__Outputs { + _call: RenouncePermissionCall; + + constructor(call: RenouncePermissionCall) { + this._call = call; + } +} + +export class RevokePermissionCall extends ethereum.Call { + get inputs(): RevokePermissionCall__Inputs { + return new RevokePermissionCall__Inputs(this); + } + + get outputs(): RevokePermissionCall__Outputs { + return new RevokePermissionCall__Outputs(this); + } +} + +export class RevokePermissionCall__Inputs { + _call: RevokePermissionCall; + + constructor(call: RevokePermissionCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get permission(): Bytes { + return this._call.inputValues[1].value.toBytes(); + } + + get user(): Address { + return this._call.inputValues[2].value.toAddress(); + } +} + +export class RevokePermissionCall__Outputs { + _call: RevokePermissionCall; + + constructor(call: RevokePermissionCall) { + this._call = call; + } +} + +export class AssociateDebtCall extends ethereum.Call { + get inputs(): AssociateDebtCall__Inputs { + return new AssociateDebtCall__Inputs(this); + } + + get outputs(): AssociateDebtCall__Outputs { + return new AssociateDebtCall__Outputs(this); + } +} + +export class AssociateDebtCall__Inputs { + _call: AssociateDebtCall; + + constructor(call: AssociateDebtCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[2].value.toAddress(); + } + + get accountId(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } + + get amount(): BigInt { + return this._call.inputValues[4].value.toBigInt(); + } +} + +export class AssociateDebtCall__Outputs { + _call: AssociateDebtCall; + + constructor(call: AssociateDebtCall) { + this._call = call; + } + + get value0(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class InitOrUpgradeNftCall extends ethereum.Call { + get inputs(): InitOrUpgradeNftCall__Inputs { + return new InitOrUpgradeNftCall__Inputs(this); + } + + get outputs(): InitOrUpgradeNftCall__Outputs { + return new InitOrUpgradeNftCall__Outputs(this); + } +} + +export class InitOrUpgradeNftCall__Inputs { + _call: InitOrUpgradeNftCall; + + constructor(call: InitOrUpgradeNftCall) { + this._call = call; + } + + get id(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get name(): string { + return this._call.inputValues[1].value.toString(); + } + + get symbol(): string { + return this._call.inputValues[2].value.toString(); + } + + get uri(): string { + return this._call.inputValues[3].value.toString(); + } + + get impl(): Address { + return this._call.inputValues[4].value.toAddress(); + } +} + +export class InitOrUpgradeNftCall__Outputs { + _call: InitOrUpgradeNftCall; + + constructor(call: InitOrUpgradeNftCall) { + this._call = call; + } +} + +export class InitOrUpgradeTokenCall extends ethereum.Call { + get inputs(): InitOrUpgradeTokenCall__Inputs { + return new InitOrUpgradeTokenCall__Inputs(this); + } + + get outputs(): InitOrUpgradeTokenCall__Outputs { + return new InitOrUpgradeTokenCall__Outputs(this); + } +} + +export class InitOrUpgradeTokenCall__Inputs { + _call: InitOrUpgradeTokenCall; + + constructor(call: InitOrUpgradeTokenCall) { + this._call = call; + } + + get id(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get name(): string { + return this._call.inputValues[1].value.toString(); + } + + get symbol(): string { + return this._call.inputValues[2].value.toString(); + } + + get decimals(): i32 { + return this._call.inputValues[3].value.toI32(); + } + + get impl(): Address { + return this._call.inputValues[4].value.toAddress(); + } +} + +export class InitOrUpgradeTokenCall__Outputs { + _call: InitOrUpgradeTokenCall; + + constructor(call: InitOrUpgradeTokenCall) { + this._call = call; + } +} + +export class RegisterUnmanagedSystemCall extends ethereum.Call { + get inputs(): RegisterUnmanagedSystemCall__Inputs { + return new RegisterUnmanagedSystemCall__Inputs(this); + } + + get outputs(): RegisterUnmanagedSystemCall__Outputs { + return new RegisterUnmanagedSystemCall__Outputs(this); + } +} + +export class RegisterUnmanagedSystemCall__Inputs { + _call: RegisterUnmanagedSystemCall; + + constructor(call: RegisterUnmanagedSystemCall) { + this._call = call; + } + + get id(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get endpoint(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class RegisterUnmanagedSystemCall__Outputs { + _call: RegisterUnmanagedSystemCall; + + constructor(call: RegisterUnmanagedSystemCall) { + this._call = call; + } +} + +export class CcipReceiveCall extends ethereum.Call { + get inputs(): CcipReceiveCall__Inputs { + return new CcipReceiveCall__Inputs(this); + } + + get outputs(): CcipReceiveCall__Outputs { + return new CcipReceiveCall__Outputs(this); + } +} + +export class CcipReceiveCall__Inputs { + _call: CcipReceiveCall; + + constructor(call: CcipReceiveCall) { + this._call = call; + } + + get message(): CcipReceiveCallMessageStruct { + return changetype(this._call.inputValues[0].value.toTuple()); + } +} + +export class CcipReceiveCall__Outputs { + _call: CcipReceiveCall; + + constructor(call: CcipReceiveCall) { + this._call = call; + } +} + +export class CcipReceiveCallMessageStruct extends ethereum.Tuple { + get messageId(): Bytes { + return this[0].toBytes(); + } + + get sourceChainSelector(): BigInt { + return this[1].toBigInt(); + } + + get sender(): Bytes { + return this[2].toBytes(); + } + + get data(): Bytes { + return this[3].toBytes(); + } + + get tokenAmounts(): Array { + return this[4].toTupleArray(); + } +} + +export class CcipReceiveCallMessageTokenAmountsStruct extends ethereum.Tuple { + get token(): Address { + return this[0].toAddress(); + } + + get amount(): BigInt { + return this[1].toBigInt(); + } +} + +export class CleanExpiredLocksCall extends ethereum.Call { + get inputs(): CleanExpiredLocksCall__Inputs { + return new CleanExpiredLocksCall__Inputs(this); + } + + get outputs(): CleanExpiredLocksCall__Outputs { + return new CleanExpiredLocksCall__Outputs(this); + } +} + +export class CleanExpiredLocksCall__Inputs { + _call: CleanExpiredLocksCall; + + constructor(call: CleanExpiredLocksCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get offset(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get count(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } +} + +export class CleanExpiredLocksCall__Outputs { + _call: CleanExpiredLocksCall; + + constructor(call: CleanExpiredLocksCall) { + this._call = call; + } + + get cleared(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class CreateLockCall extends ethereum.Call { + get inputs(): CreateLockCall__Inputs { + return new CreateLockCall__Inputs(this); + } + + get outputs(): CreateLockCall__Outputs { + return new CreateLockCall__Outputs(this); + } +} + +export class CreateLockCall__Inputs { + _call: CreateLockCall; + + constructor(call: CreateLockCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get amount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get expireTimestamp(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } +} + +export class CreateLockCall__Outputs { + _call: CreateLockCall; + + constructor(call: CreateLockCall) { + this._call = call; + } +} + +export class DepositCall extends ethereum.Call { + get inputs(): DepositCall__Inputs { + return new DepositCall__Inputs(this); + } + + get outputs(): DepositCall__Outputs { + return new DepositCall__Outputs(this); + } +} + +export class DepositCall__Inputs { + _call: DepositCall; + + constructor(call: DepositCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get tokenAmount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class DepositCall__Outputs { + _call: DepositCall; + + constructor(call: DepositCall) { + this._call = call; + } +} + +export class WithdrawCall extends ethereum.Call { + get inputs(): WithdrawCall__Inputs { + return new WithdrawCall__Inputs(this); + } + + get outputs(): WithdrawCall__Outputs { + return new WithdrawCall__Outputs(this); + } +} + +export class WithdrawCall__Inputs { + _call: WithdrawCall; + + constructor(call: WithdrawCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get tokenAmount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class WithdrawCall__Outputs { + _call: WithdrawCall; + + constructor(call: WithdrawCall) { + this._call = call; + } +} + +export class ConfigureCollateralCall extends ethereum.Call { + get inputs(): ConfigureCollateralCall__Inputs { + return new ConfigureCollateralCall__Inputs(this); + } + + get outputs(): ConfigureCollateralCall__Outputs { + return new ConfigureCollateralCall__Outputs(this); + } +} + +export class ConfigureCollateralCall__Inputs { + _call: ConfigureCollateralCall; + + constructor(call: ConfigureCollateralCall) { + this._call = call; + } + + get config(): ConfigureCollateralCallConfigStruct { + return changetype( + this._call.inputValues[0].value.toTuple() + ); + } +} + +export class ConfigureCollateralCall__Outputs { + _call: ConfigureCollateralCall; + + constructor(call: ConfigureCollateralCall) { + this._call = call; + } +} + +export class ConfigureCollateralCallConfigStruct extends ethereum.Tuple { + get depositingEnabled(): boolean { + return this[0].toBoolean(); + } + + get issuanceRatioD18(): BigInt { + return this[1].toBigInt(); + } + + get liquidationRatioD18(): BigInt { + return this[2].toBigInt(); + } + + get liquidationRewardD18(): BigInt { + return this[3].toBigInt(); + } + + get oracleNodeId(): Bytes { + return this[4].toBytes(); + } + + get tokenAddress(): Address { + return this[5].toAddress(); + } + + get minDelegationD18(): BigInt { + return this[6].toBigInt(); + } +} + +export class TransferCrossChainCall extends ethereum.Call { + get inputs(): TransferCrossChainCall__Inputs { + return new TransferCrossChainCall__Inputs(this); + } + + get outputs(): TransferCrossChainCall__Outputs { + return new TransferCrossChainCall__Outputs(this); + } +} + +export class TransferCrossChainCall__Inputs { + _call: TransferCrossChainCall; + + constructor(call: TransferCrossChainCall) { + this._call = call; + } + + get destChainId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get amount(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class TransferCrossChainCall__Outputs { + _call: TransferCrossChainCall; + + constructor(call: TransferCrossChainCall) { + this._call = call; + } + + get gasTokenUsed(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class BurnUsdCall extends ethereum.Call { + get inputs(): BurnUsdCall__Inputs { + return new BurnUsdCall__Inputs(this); + } + + get outputs(): BurnUsdCall__Outputs { + return new BurnUsdCall__Outputs(this); + } +} + +export class BurnUsdCall__Inputs { + _call: BurnUsdCall; + + constructor(call: BurnUsdCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[2].value.toAddress(); + } + + get amount(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } +} + +export class BurnUsdCall__Outputs { + _call: BurnUsdCall; + + constructor(call: BurnUsdCall) { + this._call = call; + } +} + +export class MintUsdCall extends ethereum.Call { + get inputs(): MintUsdCall__Inputs { + return new MintUsdCall__Inputs(this); + } + + get outputs(): MintUsdCall__Outputs { + return new MintUsdCall__Outputs(this); + } +} + +export class MintUsdCall__Inputs { + _call: MintUsdCall; + + constructor(call: MintUsdCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[2].value.toAddress(); + } + + get amount(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } +} + +export class MintUsdCall__Outputs { + _call: MintUsdCall; + + constructor(call: MintUsdCall) { + this._call = call; + } +} + +export class IsPositionLiquidatableCall extends ethereum.Call { + get inputs(): IsPositionLiquidatableCall__Inputs { + return new IsPositionLiquidatableCall__Inputs(this); + } + + get outputs(): IsPositionLiquidatableCall__Outputs { + return new IsPositionLiquidatableCall__Outputs(this); + } +} + +export class IsPositionLiquidatableCall__Inputs { + _call: IsPositionLiquidatableCall; + + constructor(call: IsPositionLiquidatableCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[2].value.toAddress(); + } +} + +export class IsPositionLiquidatableCall__Outputs { + _call: IsPositionLiquidatableCall; + + constructor(call: IsPositionLiquidatableCall) { + this._call = call; + } + + get value0(): boolean { + return this._call.outputValues[0].value.toBoolean(); + } +} + +export class IsVaultLiquidatableCall extends ethereum.Call { + get inputs(): IsVaultLiquidatableCall__Inputs { + return new IsVaultLiquidatableCall__Inputs(this); + } + + get outputs(): IsVaultLiquidatableCall__Outputs { + return new IsVaultLiquidatableCall__Outputs(this); + } +} + +export class IsVaultLiquidatableCall__Inputs { + _call: IsVaultLiquidatableCall; + + constructor(call: IsVaultLiquidatableCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class IsVaultLiquidatableCall__Outputs { + _call: IsVaultLiquidatableCall; + + constructor(call: IsVaultLiquidatableCall) { + this._call = call; + } + + get value0(): boolean { + return this._call.outputValues[0].value.toBoolean(); + } +} + +export class LiquidateCall extends ethereum.Call { + get inputs(): LiquidateCall__Inputs { + return new LiquidateCall__Inputs(this); + } + + get outputs(): LiquidateCall__Outputs { + return new LiquidateCall__Outputs(this); + } +} + +export class LiquidateCall__Inputs { + _call: LiquidateCall; + + constructor(call: LiquidateCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[2].value.toAddress(); + } + + get liquidateAsAccountId(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } +} + +export class LiquidateCall__Outputs { + _call: LiquidateCall; + + constructor(call: LiquidateCall) { + this._call = call; + } + + get liquidationData(): LiquidateCallLiquidationDataStruct { + return changetype( + this._call.outputValues[0].value.toTuple() + ); + } +} + +export class LiquidateCallLiquidationDataStruct extends ethereum.Tuple { + get debtLiquidated(): BigInt { + return this[0].toBigInt(); + } + + get collateralLiquidated(): BigInt { + return this[1].toBigInt(); + } + + get amountRewarded(): BigInt { + return this[2].toBigInt(); + } +} + +export class LiquidateVaultCall extends ethereum.Call { + get inputs(): LiquidateVaultCall__Inputs { + return new LiquidateVaultCall__Inputs(this); + } + + get outputs(): LiquidateVaultCall__Outputs { + return new LiquidateVaultCall__Outputs(this); + } +} + +export class LiquidateVaultCall__Inputs { + _call: LiquidateVaultCall; + + constructor(call: LiquidateVaultCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get liquidateAsAccountId(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get maxUsd(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } +} + +export class LiquidateVaultCall__Outputs { + _call: LiquidateVaultCall; + + constructor(call: LiquidateVaultCall) { + this._call = call; + } + + get liquidationData(): LiquidateVaultCallLiquidationDataStruct { + return changetype( + this._call.outputValues[0].value.toTuple() + ); + } +} + +export class LiquidateVaultCallLiquidationDataStruct extends ethereum.Tuple { + get debtLiquidated(): BigInt { + return this[0].toBigInt(); + } + + get collateralLiquidated(): BigInt { + return this[1].toBigInt(); + } + + get amountRewarded(): BigInt { + return this[2].toBigInt(); + } +} + +export class ConfigureMaximumMarketCollateralCall extends ethereum.Call { + get inputs(): ConfigureMaximumMarketCollateralCall__Inputs { + return new ConfigureMaximumMarketCollateralCall__Inputs(this); + } + + get outputs(): ConfigureMaximumMarketCollateralCall__Outputs { + return new ConfigureMaximumMarketCollateralCall__Outputs(this); + } +} + +export class ConfigureMaximumMarketCollateralCall__Inputs { + _call: ConfigureMaximumMarketCollateralCall; + + constructor(call: ConfigureMaximumMarketCollateralCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get amount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class ConfigureMaximumMarketCollateralCall__Outputs { + _call: ConfigureMaximumMarketCollateralCall; + + constructor(call: ConfigureMaximumMarketCollateralCall) { + this._call = call; + } +} + +export class DepositMarketCollateralCall extends ethereum.Call { + get inputs(): DepositMarketCollateralCall__Inputs { + return new DepositMarketCollateralCall__Inputs(this); + } + + get outputs(): DepositMarketCollateralCall__Outputs { + return new DepositMarketCollateralCall__Outputs(this); + } +} + +export class DepositMarketCollateralCall__Inputs { + _call: DepositMarketCollateralCall; + + constructor(call: DepositMarketCollateralCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get tokenAmount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class DepositMarketCollateralCall__Outputs { + _call: DepositMarketCollateralCall; + + constructor(call: DepositMarketCollateralCall) { + this._call = call; + } +} + +export class WithdrawMarketCollateralCall extends ethereum.Call { + get inputs(): WithdrawMarketCollateralCall__Inputs { + return new WithdrawMarketCollateralCall__Inputs(this); + } + + get outputs(): WithdrawMarketCollateralCall__Outputs { + return new WithdrawMarketCollateralCall__Outputs(this); + } +} + +export class WithdrawMarketCollateralCall__Inputs { + _call: WithdrawMarketCollateralCall; + + constructor(call: WithdrawMarketCollateralCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get tokenAmount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class WithdrawMarketCollateralCall__Outputs { + _call: WithdrawMarketCollateralCall; + + constructor(call: WithdrawMarketCollateralCall) { + this._call = call; + } +} + +export class DepositMarketUsdCall extends ethereum.Call { + get inputs(): DepositMarketUsdCall__Inputs { + return new DepositMarketUsdCall__Inputs(this); + } + + get outputs(): DepositMarketUsdCall__Outputs { + return new DepositMarketUsdCall__Outputs(this); + } +} + +export class DepositMarketUsdCall__Inputs { + _call: DepositMarketUsdCall; + + constructor(call: DepositMarketUsdCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get target(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get amount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class DepositMarketUsdCall__Outputs { + _call: DepositMarketUsdCall; + + constructor(call: DepositMarketUsdCall) { + this._call = call; + } + + get feeAmount(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class DistributeDebtToPoolsCall extends ethereum.Call { + get inputs(): DistributeDebtToPoolsCall__Inputs { + return new DistributeDebtToPoolsCall__Inputs(this); + } + + get outputs(): DistributeDebtToPoolsCall__Outputs { + return new DistributeDebtToPoolsCall__Outputs(this); + } +} + +export class DistributeDebtToPoolsCall__Inputs { + _call: DistributeDebtToPoolsCall; + + constructor(call: DistributeDebtToPoolsCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get maxIter(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class DistributeDebtToPoolsCall__Outputs { + _call: DistributeDebtToPoolsCall; + + constructor(call: DistributeDebtToPoolsCall) { + this._call = call; + } + + get value0(): boolean { + return this._call.outputValues[0].value.toBoolean(); + } +} + +export class GetMarketDebtPerShareCall extends ethereum.Call { + get inputs(): GetMarketDebtPerShareCall__Inputs { + return new GetMarketDebtPerShareCall__Inputs(this); + } + + get outputs(): GetMarketDebtPerShareCall__Outputs { + return new GetMarketDebtPerShareCall__Outputs(this); + } +} + +export class GetMarketDebtPerShareCall__Inputs { + _call: GetMarketDebtPerShareCall; + + constructor(call: GetMarketDebtPerShareCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class GetMarketDebtPerShareCall__Outputs { + _call: GetMarketDebtPerShareCall; + + constructor(call: GetMarketDebtPerShareCall) { + this._call = call; + } + + get value0(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class GetMarketPoolDebtDistributionCall extends ethereum.Call { + get inputs(): GetMarketPoolDebtDistributionCall__Inputs { + return new GetMarketPoolDebtDistributionCall__Inputs(this); + } + + get outputs(): GetMarketPoolDebtDistributionCall__Outputs { + return new GetMarketPoolDebtDistributionCall__Outputs(this); + } +} + +export class GetMarketPoolDebtDistributionCall__Inputs { + _call: GetMarketPoolDebtDistributionCall; + + constructor(call: GetMarketPoolDebtDistributionCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class GetMarketPoolDebtDistributionCall__Outputs { + _call: GetMarketPoolDebtDistributionCall; + + constructor(call: GetMarketPoolDebtDistributionCall) { + this._call = call; + } + + get sharesD18(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } + + get totalSharesD18(): BigInt { + return this._call.outputValues[1].value.toBigInt(); + } + + get valuePerShareD27(): BigInt { + return this._call.outputValues[2].value.toBigInt(); + } +} + +export class GetMarketPoolsCall extends ethereum.Call { + get inputs(): GetMarketPoolsCall__Inputs { + return new GetMarketPoolsCall__Inputs(this); + } + + get outputs(): GetMarketPoolsCall__Outputs { + return new GetMarketPoolsCall__Outputs(this); + } +} + +export class GetMarketPoolsCall__Inputs { + _call: GetMarketPoolsCall; + + constructor(call: GetMarketPoolsCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class GetMarketPoolsCall__Outputs { + _call: GetMarketPoolsCall; + + constructor(call: GetMarketPoolsCall) { + this._call = call; + } + + get inRangePoolIds(): Array { + return this._call.outputValues[0].value.toBigIntArray(); + } + + get outRangePoolIds(): Array { + return this._call.outputValues[1].value.toBigIntArray(); + } +} + +export class RegisterMarketCall extends ethereum.Call { + get inputs(): RegisterMarketCall__Inputs { + return new RegisterMarketCall__Inputs(this); + } + + get outputs(): RegisterMarketCall__Outputs { + return new RegisterMarketCall__Outputs(this); + } +} + +export class RegisterMarketCall__Inputs { + _call: RegisterMarketCall; + + constructor(call: RegisterMarketCall) { + this._call = call; + } + + get market(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class RegisterMarketCall__Outputs { + _call: RegisterMarketCall; + + constructor(call: RegisterMarketCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class SetMarketMinDelegateTimeCall extends ethereum.Call { + get inputs(): SetMarketMinDelegateTimeCall__Inputs { + return new SetMarketMinDelegateTimeCall__Inputs(this); + } + + get outputs(): SetMarketMinDelegateTimeCall__Outputs { + return new SetMarketMinDelegateTimeCall__Outputs(this); + } +} + +export class SetMarketMinDelegateTimeCall__Inputs { + _call: SetMarketMinDelegateTimeCall; + + constructor(call: SetMarketMinDelegateTimeCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get minDelegateTime(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class SetMarketMinDelegateTimeCall__Outputs { + _call: SetMarketMinDelegateTimeCall; + + constructor(call: SetMarketMinDelegateTimeCall) { + this._call = call; + } +} + +export class SetMinLiquidityRatioCall extends ethereum.Call { + get inputs(): SetMinLiquidityRatioCall__Inputs { + return new SetMinLiquidityRatioCall__Inputs(this); + } + + get outputs(): SetMinLiquidityRatioCall__Outputs { + return new SetMinLiquidityRatioCall__Outputs(this); + } +} + +export class SetMinLiquidityRatioCall__Inputs { + _call: SetMinLiquidityRatioCall; + + constructor(call: SetMinLiquidityRatioCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get minLiquidityRatio(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class SetMinLiquidityRatioCall__Outputs { + _call: SetMinLiquidityRatioCall; + + constructor(call: SetMinLiquidityRatioCall) { + this._call = call; + } +} + +export class WithdrawMarketUsdCall extends ethereum.Call { + get inputs(): WithdrawMarketUsdCall__Inputs { + return new WithdrawMarketUsdCall__Inputs(this); + } + + get outputs(): WithdrawMarketUsdCall__Outputs { + return new WithdrawMarketUsdCall__Outputs(this); + } +} + +export class WithdrawMarketUsdCall__Inputs { + _call: WithdrawMarketUsdCall; + + constructor(call: WithdrawMarketUsdCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get target(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get amount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class WithdrawMarketUsdCall__Outputs { + _call: WithdrawMarketUsdCall; + + constructor(call: WithdrawMarketUsdCall) { + this._call = call; + } + + get feeAmount(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class MulticallCall extends ethereum.Call { + get inputs(): MulticallCall__Inputs { + return new MulticallCall__Inputs(this); + } + + get outputs(): MulticallCall__Outputs { + return new MulticallCall__Outputs(this); + } +} + +export class MulticallCall__Inputs { + _call: MulticallCall; + + constructor(call: MulticallCall) { + this._call = call; + } + + get data(): Array { + return this._call.inputValues[0].value.toBytesArray(); + } +} + +export class MulticallCall__Outputs { + _call: MulticallCall; + + constructor(call: MulticallCall) { + this._call = call; + } + + get results(): Array { + return this._call.outputValues[0].value.toBytesArray(); + } +} + +export class MulticallThroughCall extends ethereum.Call { + get inputs(): MulticallThroughCall__Inputs { + return new MulticallThroughCall__Inputs(this); + } + + get outputs(): MulticallThroughCall__Outputs { + return new MulticallThroughCall__Outputs(this); + } +} + +export class MulticallThroughCall__Inputs { + _call: MulticallThroughCall; + + constructor(call: MulticallThroughCall) { + this._call = call; + } + + get to(): Array
{ + return this._call.inputValues[0].value.toAddressArray(); + } + + get data(): Array { + return this._call.inputValues[1].value.toBytesArray(); + } + + get values(): Array { + return this._call.inputValues[2].value.toBigIntArray(); + } +} + +export class MulticallThroughCall__Outputs { + _call: MulticallThroughCall; + + constructor(call: MulticallThroughCall) { + this._call = call; + } + + get results(): Array { + return this._call.outputValues[0].value.toBytesArray(); + } +} + +export class SetAllowlistedMulticallTargetCall extends ethereum.Call { + get inputs(): SetAllowlistedMulticallTargetCall__Inputs { + return new SetAllowlistedMulticallTargetCall__Inputs(this); + } + + get outputs(): SetAllowlistedMulticallTargetCall__Outputs { + return new SetAllowlistedMulticallTargetCall__Outputs(this); + } +} + +export class SetAllowlistedMulticallTargetCall__Inputs { + _call: SetAllowlistedMulticallTargetCall; + + constructor(call: SetAllowlistedMulticallTargetCall) { + this._call = call; + } + + get target(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get allowlisted(): boolean { + return this._call.inputValues[1].value.toBoolean(); + } +} + +export class SetAllowlistedMulticallTargetCall__Outputs { + _call: SetAllowlistedMulticallTargetCall; + + constructor(call: SetAllowlistedMulticallTargetCall) { + this._call = call; + } +} + +export class AddApprovedPoolCall extends ethereum.Call { + get inputs(): AddApprovedPoolCall__Inputs { + return new AddApprovedPoolCall__Inputs(this); + } + + get outputs(): AddApprovedPoolCall__Outputs { + return new AddApprovedPoolCall__Outputs(this); + } +} + +export class AddApprovedPoolCall__Inputs { + _call: AddApprovedPoolCall; + + constructor(call: AddApprovedPoolCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class AddApprovedPoolCall__Outputs { + _call: AddApprovedPoolCall; + + constructor(call: AddApprovedPoolCall) { + this._call = call; + } +} + +export class RemoveApprovedPoolCall extends ethereum.Call { + get inputs(): RemoveApprovedPoolCall__Inputs { + return new RemoveApprovedPoolCall__Inputs(this); + } + + get outputs(): RemoveApprovedPoolCall__Outputs { + return new RemoveApprovedPoolCall__Outputs(this); + } +} + +export class RemoveApprovedPoolCall__Inputs { + _call: RemoveApprovedPoolCall; + + constructor(call: RemoveApprovedPoolCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class RemoveApprovedPoolCall__Outputs { + _call: RemoveApprovedPoolCall; + + constructor(call: RemoveApprovedPoolCall) { + this._call = call; + } +} + +export class SetPreferredPoolCall extends ethereum.Call { + get inputs(): SetPreferredPoolCall__Inputs { + return new SetPreferredPoolCall__Inputs(this); + } + + get outputs(): SetPreferredPoolCall__Outputs { + return new SetPreferredPoolCall__Outputs(this); + } +} + +export class SetPreferredPoolCall__Inputs { + _call: SetPreferredPoolCall; + + constructor(call: SetPreferredPoolCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class SetPreferredPoolCall__Outputs { + _call: SetPreferredPoolCall; + + constructor(call: SetPreferredPoolCall) { + this._call = call; + } +} + +export class AcceptPoolOwnershipCall extends ethereum.Call { + get inputs(): AcceptPoolOwnershipCall__Inputs { + return new AcceptPoolOwnershipCall__Inputs(this); + } + + get outputs(): AcceptPoolOwnershipCall__Outputs { + return new AcceptPoolOwnershipCall__Outputs(this); + } +} + +export class AcceptPoolOwnershipCall__Inputs { + _call: AcceptPoolOwnershipCall; + + constructor(call: AcceptPoolOwnershipCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class AcceptPoolOwnershipCall__Outputs { + _call: AcceptPoolOwnershipCall; + + constructor(call: AcceptPoolOwnershipCall) { + this._call = call; + } +} + +export class CreatePoolCall extends ethereum.Call { + get inputs(): CreatePoolCall__Inputs { + return new CreatePoolCall__Inputs(this); + } + + get outputs(): CreatePoolCall__Outputs { + return new CreatePoolCall__Outputs(this); + } +} + +export class CreatePoolCall__Inputs { + _call: CreatePoolCall; + + constructor(call: CreatePoolCall) { + this._call = call; + } + + get requestedPoolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get owner(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class CreatePoolCall__Outputs { + _call: CreatePoolCall; + + constructor(call: CreatePoolCall) { + this._call = call; + } +} + +export class NominatePoolOwnerCall extends ethereum.Call { + get inputs(): NominatePoolOwnerCall__Inputs { + return new NominatePoolOwnerCall__Inputs(this); + } + + get outputs(): NominatePoolOwnerCall__Outputs { + return new NominatePoolOwnerCall__Outputs(this); + } +} + +export class NominatePoolOwnerCall__Inputs { + _call: NominatePoolOwnerCall; + + constructor(call: NominatePoolOwnerCall) { + this._call = call; + } + + get nominatedOwner(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class NominatePoolOwnerCall__Outputs { + _call: NominatePoolOwnerCall; + + constructor(call: NominatePoolOwnerCall) { + this._call = call; + } +} + +export class RebalancePoolCall extends ethereum.Call { + get inputs(): RebalancePoolCall__Inputs { + return new RebalancePoolCall__Inputs(this); + } + + get outputs(): RebalancePoolCall__Outputs { + return new RebalancePoolCall__Outputs(this); + } +} + +export class RebalancePoolCall__Inputs { + _call: RebalancePoolCall; + + constructor(call: RebalancePoolCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get optionalCollateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class RebalancePoolCall__Outputs { + _call: RebalancePoolCall; + + constructor(call: RebalancePoolCall) { + this._call = call; + } +} + +export class RenouncePoolNominationCall extends ethereum.Call { + get inputs(): RenouncePoolNominationCall__Inputs { + return new RenouncePoolNominationCall__Inputs(this); + } + + get outputs(): RenouncePoolNominationCall__Outputs { + return new RenouncePoolNominationCall__Outputs(this); + } +} + +export class RenouncePoolNominationCall__Inputs { + _call: RenouncePoolNominationCall; + + constructor(call: RenouncePoolNominationCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class RenouncePoolNominationCall__Outputs { + _call: RenouncePoolNominationCall; + + constructor(call: RenouncePoolNominationCall) { + this._call = call; + } +} + +export class RevokePoolNominationCall extends ethereum.Call { + get inputs(): RevokePoolNominationCall__Inputs { + return new RevokePoolNominationCall__Inputs(this); + } + + get outputs(): RevokePoolNominationCall__Outputs { + return new RevokePoolNominationCall__Outputs(this); + } +} + +export class RevokePoolNominationCall__Inputs { + _call: RevokePoolNominationCall; + + constructor(call: RevokePoolNominationCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class RevokePoolNominationCall__Outputs { + _call: RevokePoolNominationCall; + + constructor(call: RevokePoolNominationCall) { + this._call = call; + } +} + +export class SetMinLiquidityRatio1Call extends ethereum.Call { + get inputs(): SetMinLiquidityRatio1Call__Inputs { + return new SetMinLiquidityRatio1Call__Inputs(this); + } + + get outputs(): SetMinLiquidityRatio1Call__Outputs { + return new SetMinLiquidityRatio1Call__Outputs(this); + } +} + +export class SetMinLiquidityRatio1Call__Inputs { + _call: SetMinLiquidityRatio1Call; + + constructor(call: SetMinLiquidityRatio1Call) { + this._call = call; + } + + get minLiquidityRatio(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class SetMinLiquidityRatio1Call__Outputs { + _call: SetMinLiquidityRatio1Call; + + constructor(call: SetMinLiquidityRatio1Call) { + this._call = call; + } +} + +export class SetPoolCollateralConfigurationCall extends ethereum.Call { + get inputs(): SetPoolCollateralConfigurationCall__Inputs { + return new SetPoolCollateralConfigurationCall__Inputs(this); + } + + get outputs(): SetPoolCollateralConfigurationCall__Outputs { + return new SetPoolCollateralConfigurationCall__Outputs(this); + } +} + +export class SetPoolCollateralConfigurationCall__Inputs { + _call: SetPoolCollateralConfigurationCall; + + constructor(call: SetPoolCollateralConfigurationCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get newConfig(): SetPoolCollateralConfigurationCallNewConfigStruct { + return changetype( + this._call.inputValues[2].value.toTuple() + ); + } +} + +export class SetPoolCollateralConfigurationCall__Outputs { + _call: SetPoolCollateralConfigurationCall; + + constructor(call: SetPoolCollateralConfigurationCall) { + this._call = call; + } +} + +export class SetPoolCollateralConfigurationCallNewConfigStruct extends ethereum.Tuple { + get collateralLimitD18(): BigInt { + return this[0].toBigInt(); + } + + get issuanceRatioD18(): BigInt { + return this[1].toBigInt(); + } +} + +export class SetPoolCollateralDisabledByDefaultCall extends ethereum.Call { + get inputs(): SetPoolCollateralDisabledByDefaultCall__Inputs { + return new SetPoolCollateralDisabledByDefaultCall__Inputs(this); + } + + get outputs(): SetPoolCollateralDisabledByDefaultCall__Outputs { + return new SetPoolCollateralDisabledByDefaultCall__Outputs(this); + } +} + +export class SetPoolCollateralDisabledByDefaultCall__Inputs { + _call: SetPoolCollateralDisabledByDefaultCall; + + constructor(call: SetPoolCollateralDisabledByDefaultCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get disabled(): boolean { + return this._call.inputValues[1].value.toBoolean(); + } +} + +export class SetPoolCollateralDisabledByDefaultCall__Outputs { + _call: SetPoolCollateralDisabledByDefaultCall; + + constructor(call: SetPoolCollateralDisabledByDefaultCall) { + this._call = call; + } +} + +export class SetPoolConfigurationCall extends ethereum.Call { + get inputs(): SetPoolConfigurationCall__Inputs { + return new SetPoolConfigurationCall__Inputs(this); + } + + get outputs(): SetPoolConfigurationCall__Outputs { + return new SetPoolConfigurationCall__Outputs(this); + } +} + +export class SetPoolConfigurationCall__Inputs { + _call: SetPoolConfigurationCall; + + constructor(call: SetPoolConfigurationCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get newMarketConfigurations(): Array { + return this._call.inputValues[1].value.toTupleArray(); + } +} + +export class SetPoolConfigurationCall__Outputs { + _call: SetPoolConfigurationCall; + + constructor(call: SetPoolConfigurationCall) { + this._call = call; + } +} + +export class SetPoolConfigurationCallNewMarketConfigurationsStruct extends ethereum.Tuple { + get marketId(): BigInt { + return this[0].toBigInt(); + } + + get weightD18(): BigInt { + return this[1].toBigInt(); + } + + get maxDebtShareValueD18(): BigInt { + return this[2].toBigInt(); + } +} + +export class SetPoolNameCall extends ethereum.Call { + get inputs(): SetPoolNameCall__Inputs { + return new SetPoolNameCall__Inputs(this); + } + + get outputs(): SetPoolNameCall__Outputs { + return new SetPoolNameCall__Outputs(this); + } +} + +export class SetPoolNameCall__Inputs { + _call: SetPoolNameCall; + + constructor(call: SetPoolNameCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get name(): string { + return this._call.inputValues[1].value.toString(); + } +} + +export class SetPoolNameCall__Outputs { + _call: SetPoolNameCall; + + constructor(call: SetPoolNameCall) { + this._call = call; + } +} + +export class ClaimRewardsCall extends ethereum.Call { + get inputs(): ClaimRewardsCall__Inputs { + return new ClaimRewardsCall__Inputs(this); + } + + get outputs(): ClaimRewardsCall__Outputs { + return new ClaimRewardsCall__Outputs(this); + } +} + +export class ClaimRewardsCall__Inputs { + _call: ClaimRewardsCall; + + constructor(call: ClaimRewardsCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[2].value.toAddress(); + } + + get distributor(): Address { + return this._call.inputValues[3].value.toAddress(); + } +} + +export class ClaimRewardsCall__Outputs { + _call: ClaimRewardsCall; + + constructor(call: ClaimRewardsCall) { + this._call = call; + } + + get value0(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class DistributeRewardsCall extends ethereum.Call { + get inputs(): DistributeRewardsCall__Inputs { + return new DistributeRewardsCall__Inputs(this); + } + + get outputs(): DistributeRewardsCall__Outputs { + return new DistributeRewardsCall__Outputs(this); + } +} + +export class DistributeRewardsCall__Inputs { + _call: DistributeRewardsCall; + + constructor(call: DistributeRewardsCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get amount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get start(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } + + get duration(): BigInt { + return this._call.inputValues[4].value.toBigInt(); + } +} + +export class DistributeRewardsCall__Outputs { + _call: DistributeRewardsCall; + + constructor(call: DistributeRewardsCall) { + this._call = call; + } +} + +export class RegisterRewardsDistributorCall extends ethereum.Call { + get inputs(): RegisterRewardsDistributorCall__Inputs { + return new RegisterRewardsDistributorCall__Inputs(this); + } + + get outputs(): RegisterRewardsDistributorCall__Outputs { + return new RegisterRewardsDistributorCall__Outputs(this); + } +} + +export class RegisterRewardsDistributorCall__Inputs { + _call: RegisterRewardsDistributorCall; + + constructor(call: RegisterRewardsDistributorCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get distributor(): Address { + return this._call.inputValues[2].value.toAddress(); + } +} + +export class RegisterRewardsDistributorCall__Outputs { + _call: RegisterRewardsDistributorCall; + + constructor(call: RegisterRewardsDistributorCall) { + this._call = call; + } +} + +export class RemoveRewardsDistributorCall extends ethereum.Call { + get inputs(): RemoveRewardsDistributorCall__Inputs { + return new RemoveRewardsDistributorCall__Inputs(this); + } + + get outputs(): RemoveRewardsDistributorCall__Outputs { + return new RemoveRewardsDistributorCall__Outputs(this); + } +} + +export class RemoveRewardsDistributorCall__Inputs { + _call: RemoveRewardsDistributorCall; + + constructor(call: RemoveRewardsDistributorCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get distributor(): Address { + return this._call.inputValues[2].value.toAddress(); + } +} + +export class RemoveRewardsDistributorCall__Outputs { + _call: RemoveRewardsDistributorCall; + + constructor(call: RemoveRewardsDistributorCall) { + this._call = call; + } +} + +export class UpdateRewardsCall extends ethereum.Call { + get inputs(): UpdateRewardsCall__Inputs { + return new UpdateRewardsCall__Inputs(this); + } + + get outputs(): UpdateRewardsCall__Outputs { + return new UpdateRewardsCall__Outputs(this); + } +} + +export class UpdateRewardsCall__Inputs { + _call: UpdateRewardsCall; + + constructor(call: UpdateRewardsCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get accountId(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class UpdateRewardsCall__Outputs { + _call: UpdateRewardsCall; + + constructor(call: UpdateRewardsCall) { + this._call = call; + } + + get value0(): Array { + return this._call.outputValues[0].value.toBigIntArray(); + } + + get value1(): Array
{ + return this._call.outputValues[1].value.toAddressArray(); + } +} + +export class ConfigureChainlinkCrossChainCall extends ethereum.Call { + get inputs(): ConfigureChainlinkCrossChainCall__Inputs { + return new ConfigureChainlinkCrossChainCall__Inputs(this); + } + + get outputs(): ConfigureChainlinkCrossChainCall__Outputs { + return new ConfigureChainlinkCrossChainCall__Outputs(this); + } +} + +export class ConfigureChainlinkCrossChainCall__Inputs { + _call: ConfigureChainlinkCrossChainCall; + + constructor(call: ConfigureChainlinkCrossChainCall) { + this._call = call; + } + + get ccipRouter(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get ccipTokenPool(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class ConfigureChainlinkCrossChainCall__Outputs { + _call: ConfigureChainlinkCrossChainCall; + + constructor(call: ConfigureChainlinkCrossChainCall) { + this._call = call; + } +} + +export class ConfigureOracleManagerCall extends ethereum.Call { + get inputs(): ConfigureOracleManagerCall__Inputs { + return new ConfigureOracleManagerCall__Inputs(this); + } + + get outputs(): ConfigureOracleManagerCall__Outputs { + return new ConfigureOracleManagerCall__Outputs(this); + } +} + +export class ConfigureOracleManagerCall__Inputs { + _call: ConfigureOracleManagerCall; + + constructor(call: ConfigureOracleManagerCall) { + this._call = call; + } + + get oracleManagerAddress(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class ConfigureOracleManagerCall__Outputs { + _call: ConfigureOracleManagerCall; + + constructor(call: ConfigureOracleManagerCall) { + this._call = call; + } +} + +export class SetConfigCall extends ethereum.Call { + get inputs(): SetConfigCall__Inputs { + return new SetConfigCall__Inputs(this); + } + + get outputs(): SetConfigCall__Outputs { + return new SetConfigCall__Outputs(this); + } +} + +export class SetConfigCall__Inputs { + _call: SetConfigCall; + + constructor(call: SetConfigCall) { + this._call = call; + } + + get k(): Bytes { + return this._call.inputValues[0].value.toBytes(); + } + + get v(): Bytes { + return this._call.inputValues[1].value.toBytes(); + } +} + +export class SetConfigCall__Outputs { + _call: SetConfigCall; + + constructor(call: SetConfigCall) { + this._call = call; + } +} + +export class SetSupportedCrossChainNetworksCall extends ethereum.Call { + get inputs(): SetSupportedCrossChainNetworksCall__Inputs { + return new SetSupportedCrossChainNetworksCall__Inputs(this); + } + + get outputs(): SetSupportedCrossChainNetworksCall__Outputs { + return new SetSupportedCrossChainNetworksCall__Outputs(this); + } +} + +export class SetSupportedCrossChainNetworksCall__Inputs { + _call: SetSupportedCrossChainNetworksCall; + + constructor(call: SetSupportedCrossChainNetworksCall) { + this._call = call; + } + + get supportedNetworks(): Array { + return this._call.inputValues[0].value.toBigIntArray(); + } + + get ccipSelectors(): Array { + return this._call.inputValues[1].value.toBigIntArray(); + } +} + +export class SetSupportedCrossChainNetworksCall__Outputs { + _call: SetSupportedCrossChainNetworksCall; + + constructor(call: SetSupportedCrossChainNetworksCall) { + this._call = call; + } + + get numRegistered(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class DelegateCollateralCall extends ethereum.Call { + get inputs(): DelegateCollateralCall__Inputs { + return new DelegateCollateralCall__Inputs(this); + } + + get outputs(): DelegateCollateralCall__Outputs { + return new DelegateCollateralCall__Outputs(this); + } +} + +export class DelegateCollateralCall__Inputs { + _call: DelegateCollateralCall; + + constructor(call: DelegateCollateralCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[2].value.toAddress(); + } + + get newCollateralAmountD18(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } + + get leverage(): BigInt { + return this._call.inputValues[4].value.toBigInt(); + } +} + +export class DelegateCollateralCall__Outputs { + _call: DelegateCollateralCall; + + constructor(call: DelegateCollateralCall) { + this._call = call; + } +} + +export class GetPositionCall extends ethereum.Call { + get inputs(): GetPositionCall__Inputs { + return new GetPositionCall__Inputs(this); + } + + get outputs(): GetPositionCall__Outputs { + return new GetPositionCall__Outputs(this); + } +} + +export class GetPositionCall__Inputs { + _call: GetPositionCall; + + constructor(call: GetPositionCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[2].value.toAddress(); + } +} + +export class GetPositionCall__Outputs { + _call: GetPositionCall; + + constructor(call: GetPositionCall) { + this._call = call; + } + + get collateralAmount(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } + + get collateralValue(): BigInt { + return this._call.outputValues[1].value.toBigInt(); + } + + get debt(): BigInt { + return this._call.outputValues[2].value.toBigInt(); + } + + get collateralizationRatio(): BigInt { + return this._call.outputValues[3].value.toBigInt(); + } +} + +export class GetPositionCollateralRatioCall extends ethereum.Call { + get inputs(): GetPositionCollateralRatioCall__Inputs { + return new GetPositionCollateralRatioCall__Inputs(this); + } + + get outputs(): GetPositionCollateralRatioCall__Outputs { + return new GetPositionCollateralRatioCall__Outputs(this); + } +} + +export class GetPositionCollateralRatioCall__Inputs { + _call: GetPositionCollateralRatioCall; + + constructor(call: GetPositionCollateralRatioCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[2].value.toAddress(); + } +} + +export class GetPositionCollateralRatioCall__Outputs { + _call: GetPositionCollateralRatioCall; + + constructor(call: GetPositionCollateralRatioCall) { + this._call = call; + } + + get value0(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class GetPositionDebtCall extends ethereum.Call { + get inputs(): GetPositionDebtCall__Inputs { + return new GetPositionDebtCall__Inputs(this); + } + + get outputs(): GetPositionDebtCall__Outputs { + return new GetPositionDebtCall__Outputs(this); + } +} + +export class GetPositionDebtCall__Inputs { + _call: GetPositionDebtCall; + + constructor(call: GetPositionDebtCall) { + this._call = call; + } + + get accountId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[2].value.toAddress(); + } +} + +export class GetPositionDebtCall__Outputs { + _call: GetPositionDebtCall; + + constructor(call: GetPositionDebtCall) { + this._call = call; + } + + get debt(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class GetVaultCollateralRatioCall extends ethereum.Call { + get inputs(): GetVaultCollateralRatioCall__Inputs { + return new GetVaultCollateralRatioCall__Inputs(this); + } + + get outputs(): GetVaultCollateralRatioCall__Outputs { + return new GetVaultCollateralRatioCall__Outputs(this); + } +} + +export class GetVaultCollateralRatioCall__Inputs { + _call: GetVaultCollateralRatioCall; + + constructor(call: GetVaultCollateralRatioCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class GetVaultCollateralRatioCall__Outputs { + _call: GetVaultCollateralRatioCall; + + constructor(call: GetVaultCollateralRatioCall) { + this._call = call; + } + + get value0(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class GetVaultDebtCall extends ethereum.Call { + get inputs(): GetVaultDebtCall__Inputs { + return new GetVaultDebtCall__Inputs(this); + } + + get outputs(): GetVaultDebtCall__Outputs { + return new GetVaultDebtCall__Outputs(this); + } +} + +export class GetVaultDebtCall__Inputs { + _call: GetVaultDebtCall; + + constructor(call: GetVaultDebtCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } +} + +export class GetVaultDebtCall__Outputs { + _call: GetVaultDebtCall; + + constructor(call: GetVaultDebtCall) { + this._call = call; + } + + get value0(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} diff --git a/protocol/synthetix/subgraph/base-goerli/generated/schema.ts b/protocol/synthetix/subgraph/base-goerli/generated/schema.ts new file mode 100644 index 0000000000..e60007852f --- /dev/null +++ b/protocol/synthetix/subgraph/base-goerli/generated/schema.ts @@ -0,0 +1,2621 @@ +// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. + +import { + TypedMap, + Entity, + Value, + ValueKind, + store, + Bytes, + BigInt, + BigDecimal, +} from '@graphprotocol/graph-ts'; + +export class Pool extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save Pool entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type Pool must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('Pool', id.toString(), this); + } + } + + static loadInBlock(id: string): Pool | null { + return changetype(store.get_in_block('Pool', id)); + } + + static load(id: string): Pool | null { + return changetype(store.get('Pool', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get owner(): Bytes { + let value = this.get('owner'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set owner(value: Bytes) { + this.set('owner', Value.fromBytes(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt | null { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt | null) { + if (!value) { + this.unset('updated_at'); + } else { + this.set('updated_at', Value.fromBigInt(value)); + } + } + + get updated_at_block(): BigInt | null { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt | null) { + if (!value) { + this.unset('updated_at_block'); + } else { + this.set('updated_at_block', Value.fromBigInt(value)); + } + } + + get nominated_owner(): Bytes | null { + let value = this.get('nominated_owner'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBytes(); + } + } + + set nominated_owner(value: Bytes | null) { + if (!value) { + this.unset('nominated_owner'); + } else { + this.set('nominated_owner', Value.fromBytes(value)); + } + } + + get name(): string | null { + let value = this.get('name'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set name(value: string | null) { + if (!value) { + this.unset('name'); + } else { + this.set('name', Value.fromString(value)); + } + } + + get total_weight(): BigInt | null { + let value = this.get('total_weight'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigInt(); + } + } + + set total_weight(value: BigInt | null) { + if (!value) { + this.unset('total_weight'); + } else { + this.set('total_weight', Value.fromBigInt(value)); + } + } + + get registered_distributors(): Array | null { + let value = this.get('registered_distributors'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toStringArray(); + } + } + + get market_ids(): Array | null { + let value = this.get('market_ids'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toStringArray(); + } + } + + set market_ids(value: Array | null) { + if (!value) { + this.unset('market_ids'); + } else { + this.set('market_ids', Value.fromStringArray(>value)); + } + } + + get configurations(): Array | null { + let value = this.get('configurations'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toStringArray(); + } + } +} + +export class Market extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save Market entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type Market must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('Market', id.toString(), this); + } + } + + static loadInBlock(id: string): Market | null { + return changetype(store.get_in_block('Market', id)); + } + + static load(id: string): Market | null { + return changetype(store.get('Market', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get address(): Bytes { + let value = this.get('address'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set address(value: Bytes) { + this.set('address', Value.fromBytes(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get configurations(): Array | null { + let value = this.get('configurations'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toStringArray(); + } + } + + get market_snapshots_by_day(): Array | null { + let value = this.get('market_snapshots_by_day'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toStringArray(); + } + } + + get market_snapshots_by_week(): Array | null { + let value = this.get('market_snapshots_by_week'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toStringArray(); + } + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } + + get usd_deposited(): BigDecimal { + let value = this.get('usd_deposited'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set usd_deposited(value: BigDecimal) { + this.set('usd_deposited', Value.fromBigDecimal(value)); + } + + get usd_withdrawn(): BigDecimal { + let value = this.get('usd_withdrawn'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set usd_withdrawn(value: BigDecimal) { + this.set('usd_withdrawn', Value.fromBigDecimal(value)); + } + + get net_issuance(): BigDecimal { + let value = this.get('net_issuance'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set net_issuance(value: BigDecimal) { + this.set('net_issuance', Value.fromBigDecimal(value)); + } + + get reported_debt(): BigDecimal { + let value = this.get('reported_debt'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set reported_debt(value: BigDecimal) { + this.set('reported_debt', Value.fromBigDecimal(value)); + } +} + +export class MarketSnapshotByDay extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save MarketSnapshotByDay entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type MarketSnapshotByDay must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('MarketSnapshotByDay', id.toString(), this); + } + } + + static loadInBlock(id: string): MarketSnapshotByDay | null { + return changetype(store.get_in_block('MarketSnapshotByDay', id)); + } + + static load(id: string): MarketSnapshotByDay | null { + return changetype(store.get('MarketSnapshotByDay', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updates_in_period(): BigInt { + let value = this.get('updates_in_period'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updates_in_period(value: BigInt) { + this.set('updates_in_period', Value.fromBigInt(value)); + } + + get market(): string { + let value = this.get('market'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set market(value: string) { + this.set('market', Value.fromString(value)); + } + + get usd_deposited(): BigDecimal { + let value = this.get('usd_deposited'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set usd_deposited(value: BigDecimal) { + this.set('usd_deposited', Value.fromBigDecimal(value)); + } + + get usd_withdrawn(): BigDecimal { + let value = this.get('usd_withdrawn'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set usd_withdrawn(value: BigDecimal) { + this.set('usd_withdrawn', Value.fromBigDecimal(value)); + } + + get net_issuance(): BigDecimal { + let value = this.get('net_issuance'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set net_issuance(value: BigDecimal) { + this.set('net_issuance', Value.fromBigDecimal(value)); + } + + get reported_debt(): BigDecimal { + let value = this.get('reported_debt'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set reported_debt(value: BigDecimal) { + this.set('reported_debt', Value.fromBigDecimal(value)); + } +} + +export class MarketSnapshotByWeek extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save MarketSnapshotByWeek entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type MarketSnapshotByWeek must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('MarketSnapshotByWeek', id.toString(), this); + } + } + + static loadInBlock(id: string): MarketSnapshotByWeek | null { + return changetype(store.get_in_block('MarketSnapshotByWeek', id)); + } + + static load(id: string): MarketSnapshotByWeek | null { + return changetype(store.get('MarketSnapshotByWeek', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updates_in_period(): BigInt { + let value = this.get('updates_in_period'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updates_in_period(value: BigInt) { + this.set('updates_in_period', Value.fromBigInt(value)); + } + + get market(): string { + let value = this.get('market'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set market(value: string) { + this.set('market', Value.fromString(value)); + } + + get usd_deposited(): BigDecimal { + let value = this.get('usd_deposited'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set usd_deposited(value: BigDecimal) { + this.set('usd_deposited', Value.fromBigDecimal(value)); + } + + get usd_withdrawn(): BigDecimal { + let value = this.get('usd_withdrawn'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set usd_withdrawn(value: BigDecimal) { + this.set('usd_withdrawn', Value.fromBigDecimal(value)); + } + + get net_issuance(): BigDecimal { + let value = this.get('net_issuance'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set net_issuance(value: BigDecimal) { + this.set('net_issuance', Value.fromBigDecimal(value)); + } + + get reported_debt(): BigDecimal { + let value = this.get('reported_debt'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set reported_debt(value: BigDecimal) { + this.set('reported_debt', Value.fromBigDecimal(value)); + } +} + +export class MarketConfiguration extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save MarketConfiguration entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type MarketConfiguration must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('MarketConfiguration', id.toString(), this); + } + } + + static loadInBlock(id: string): MarketConfiguration | null { + return changetype(store.get_in_block('MarketConfiguration', id)); + } + + static load(id: string): MarketConfiguration | null { + return changetype(store.get('MarketConfiguration', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get pool(): string { + let value = this.get('pool'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set pool(value: string) { + this.set('pool', Value.fromString(value)); + } + + get market(): string { + let value = this.get('market'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set market(value: string) { + this.set('market', Value.fromString(value)); + } + + get weight(): BigInt { + let value = this.get('weight'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set weight(value: BigInt) { + this.set('weight', Value.fromBigInt(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get max_debt_share_value(): BigDecimal { + let value = this.get('max_debt_share_value'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set max_debt_share_value(value: BigDecimal) { + this.set('max_debt_share_value', Value.fromBigDecimal(value)); + } +} + +export class CollateralType extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save CollateralType entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type CollateralType must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('CollateralType', id.toString(), this); + } + } + + static loadInBlock(id: string): CollateralType | null { + return changetype(store.get_in_block('CollateralType', id)); + } + + static load(id: string): CollateralType | null { + return changetype(store.get('CollateralType', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get oracle_node_id(): BigInt { + let value = this.get('oracle_node_id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set oracle_node_id(value: BigInt) { + this.set('oracle_node_id', Value.fromBigInt(value)); + } + + get depositing_enabled(): boolean { + let value = this.get('depositing_enabled'); + if (!value || value.kind == ValueKind.NULL) { + return false; + } else { + return value.toBoolean(); + } + } + + set depositing_enabled(value: boolean) { + this.set('depositing_enabled', Value.fromBoolean(value)); + } + + get issuance_ratio(): BigDecimal { + let value = this.get('issuance_ratio'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set issuance_ratio(value: BigDecimal) { + this.set('issuance_ratio', Value.fromBigDecimal(value)); + } + + get liquidation_ratio(): BigDecimal { + let value = this.get('liquidation_ratio'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set liquidation_ratio(value: BigDecimal) { + this.set('liquidation_ratio', Value.fromBigDecimal(value)); + } + + get liquidation_reward(): BigDecimal { + let value = this.get('liquidation_reward'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set liquidation_reward(value: BigDecimal) { + this.set('liquidation_reward', Value.fromBigDecimal(value)); + } + + get min_delegation(): BigDecimal { + let value = this.get('min_delegation'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set min_delegation(value: BigDecimal) { + this.set('min_delegation', Value.fromBigDecimal(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } + + get total_amount_deposited(): BigDecimal | null { + let value = this.get('total_amount_deposited'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigDecimal(); + } + } + + set total_amount_deposited(value: BigDecimal | null) { + if (!value) { + this.unset('total_amount_deposited'); + } else { + this.set('total_amount_deposited', Value.fromBigDecimal(value)); + } + } +} + +export class Account extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save Account entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type Account must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('Account', id.toString(), this); + } + } + + static loadInBlock(id: string): Account | null { + return changetype(store.get_in_block('Account', id)); + } + + static load(id: string): Account | null { + return changetype(store.get('Account', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get owner(): Bytes { + let value = this.get('owner'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set owner(value: Bytes) { + this.set('owner', Value.fromBytes(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } + + get permissions(): Array | null { + let value = this.get('permissions'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toStringArray(); + } + } + + set permissions(value: Array | null) { + if (!value) { + this.unset('permissions'); + } else { + this.set('permissions', Value.fromStringArray(>value)); + } + } +} + +export class AccountPermissionUsers extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save AccountPermissionUsers entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type AccountPermissionUsers must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('AccountPermissionUsers', id.toString(), this); + } + } + + static loadInBlock(id: string): AccountPermissionUsers | null { + return changetype( + store.get_in_block('AccountPermissionUsers', id) + ); + } + + static load(id: string): AccountPermissionUsers | null { + return changetype(store.get('AccountPermissionUsers', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get address(): Bytes { + let value = this.get('address'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set address(value: Bytes) { + this.set('address', Value.fromBytes(value)); + } + + get account(): string { + let value = this.get('account'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set account(value: string) { + this.set('account', Value.fromString(value)); + } + + get permissions(): Array { + let value = this.get('permissions'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytesArray(); + } + } + + set permissions(value: Array) { + this.set('permissions', Value.fromBytesArray(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } +} + +export class Position extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save Position entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type Position must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('Position', id.toString(), this); + } + } + + static loadInBlock(id: string): Position | null { + return changetype(store.get_in_block('Position', id)); + } + + static load(id: string): Position | null { + return changetype(store.get('Position', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get collateral_amount(): BigDecimal { + let value = this.get('collateral_amount'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set collateral_amount(value: BigDecimal) { + this.set('collateral_amount', Value.fromBigDecimal(value)); + } + + get leverage(): BigDecimal { + let value = this.get('leverage'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set leverage(value: BigDecimal) { + this.set('leverage', Value.fromBigDecimal(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } + + get account(): string { + let value = this.get('account'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set account(value: string) { + this.set('account', Value.fromString(value)); + } + + get pool(): string { + let value = this.get('pool'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set pool(value: string) { + this.set('pool', Value.fromString(value)); + } + + get collateral_type(): string { + let value = this.get('collateral_type'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set collateral_type(value: string) { + this.set('collateral_type', Value.fromString(value)); + } + + get net_issuance(): BigDecimal | null { + let value = this.get('net_issuance'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigDecimal(); + } + } + + set net_issuance(value: BigDecimal | null) { + if (!value) { + this.unset('net_issuance'); + } else { + this.set('net_issuance', Value.fromBigDecimal(value)); + } + } + + get total_minted(): BigDecimal | null { + let value = this.get('total_minted'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigDecimal(); + } + } + + set total_minted(value: BigDecimal | null) { + if (!value) { + this.unset('total_minted'); + } else { + this.set('total_minted', Value.fromBigDecimal(value)); + } + } + + get total_burned(): BigDecimal | null { + let value = this.get('total_burned'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigDecimal(); + } + } + + set total_burned(value: BigDecimal | null) { + if (!value) { + this.unset('total_burned'); + } else { + this.set('total_burned', Value.fromBigDecimal(value)); + } + } +} + +export class Vault extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save Vault entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type Vault must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('Vault', id.toString(), this); + } + } + + static loadInBlock(id: string): Vault | null { + return changetype(store.get_in_block('Vault', id)); + } + + static load(id: string): Vault | null { + return changetype(store.get('Vault', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get collateral_amount(): BigDecimal { + let value = this.get('collateral_amount'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set collateral_amount(value: BigDecimal) { + this.set('collateral_amount', Value.fromBigDecimal(value)); + } + + get collateral_type(): string { + let value = this.get('collateral_type'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set collateral_type(value: string) { + this.set('collateral_type', Value.fromString(value)); + } + + get pool(): string { + let value = this.get('pool'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set pool(value: string) { + this.set('pool', Value.fromString(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } +} + +export class RewardsDistributor extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save RewardsDistributor entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type RewardsDistributor must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('RewardsDistributor', id.toString(), this); + } + } + + static loadInBlock(id: string): RewardsDistributor | null { + return changetype(store.get_in_block('RewardsDistributor', id)); + } + + static load(id: string): RewardsDistributor | null { + return changetype(store.get('RewardsDistributor', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get total_distributed(): BigDecimal { + let value = this.get('total_distributed'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set total_distributed(value: BigDecimal) { + this.set('total_distributed', Value.fromBigDecimal(value)); + } + + get total_claimed(): BigDecimal { + let value = this.get('total_claimed'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set total_claimed(value: BigDecimal) { + this.set('total_claimed', Value.fromBigDecimal(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } + + get pool(): string { + let value = this.get('pool'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set pool(value: string) { + this.set('pool', Value.fromString(value)); + } +} + +export class RewardsDistribution extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save RewardsDistribution entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type RewardsDistribution must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('RewardsDistribution', id.toString(), this); + } + } + + static loadInBlock(id: string): RewardsDistribution | null { + return changetype(store.get_in_block('RewardsDistribution', id)); + } + + static load(id: string): RewardsDistribution | null { + return changetype(store.get('RewardsDistribution', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get collateral_type(): Bytes { + let value = this.get('collateral_type'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set collateral_type(value: Bytes) { + this.set('collateral_type', Value.fromBytes(value)); + } + + get pool(): string { + let value = this.get('pool'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set pool(value: string) { + this.set('pool', Value.fromString(value)); + } + + get amount(): BigDecimal { + let value = this.get('amount'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set amount(value: BigDecimal) { + this.set('amount', Value.fromBigDecimal(value)); + } + + get start(): BigInt { + let value = this.get('start'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set start(value: BigInt) { + this.set('start', Value.fromBigInt(value)); + } + + get duration(): BigInt { + let value = this.get('duration'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set duration(value: BigInt) { + this.set('duration', Value.fromBigInt(value)); + } + + get distributor(): string { + let value = this.get('distributor'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set distributor(value: string) { + this.set('distributor', Value.fromString(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } +} + +export class AccountRewardsDistributor extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save AccountRewardsDistributor entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type AccountRewardsDistributor must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('AccountRewardsDistributor', id.toString(), this); + } + } + + static loadInBlock(id: string): AccountRewardsDistributor | null { + return changetype( + store.get_in_block('AccountRewardsDistributor', id) + ); + } + + static load(id: string): AccountRewardsDistributor | null { + return changetype(store.get('AccountRewardsDistributor', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get distributor(): string { + let value = this.get('distributor'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set distributor(value: string) { + this.set('distributor', Value.fromString(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } + + get total_claimed(): BigDecimal | null { + let value = this.get('total_claimed'); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigDecimal(); + } + } + + set total_claimed(value: BigDecimal | null) { + if (!value) { + this.unset('total_claimed'); + } else { + this.set('total_claimed', Value.fromBigDecimal(value)); + } + } +} + +export class RewardsClaimed extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save RewardsClaimed entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type RewardsClaimed must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('RewardsClaimed', id.toString(), this); + } + } + + static loadInBlock(id: string): RewardsClaimed | null { + return changetype(store.get_in_block('RewardsClaimed', id)); + } + + static load(id: string): RewardsClaimed | null { + return changetype(store.get('RewardsClaimed', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get account(): string { + let value = this.get('account'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set account(value: string) { + this.set('account', Value.fromString(value)); + } + + get pool(): string { + let value = this.get('pool'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set pool(value: string) { + this.set('pool', Value.fromString(value)); + } + + get collateral_type(): Bytes { + let value = this.get('collateral_type'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set collateral_type(value: Bytes) { + this.set('collateral_type', Value.fromBytes(value)); + } + + get distributor(): string { + let value = this.get('distributor'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set distributor(value: string) { + this.set('distributor', Value.fromString(value)); + } + + get amount(): BigDecimal { + let value = this.get('amount'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set amount(value: BigDecimal) { + this.set('amount', Value.fromBigDecimal(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } +} + +export class Liquidation extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save Liquidation entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type Liquidation must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('Liquidation', id.toString(), this); + } + } + + static loadInBlock(id: string): Liquidation | null { + return changetype(store.get_in_block('Liquidation', id)); + } + + static load(id: string): Liquidation | null { + return changetype(store.get('Liquidation', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get account(): string { + let value = this.get('account'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set account(value: string) { + this.set('account', Value.fromString(value)); + } + + get pool(): string { + let value = this.get('pool'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set pool(value: string) { + this.set('pool', Value.fromString(value)); + } + + get collateral_type(): Bytes { + let value = this.get('collateral_type'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set collateral_type(value: Bytes) { + this.set('collateral_type', Value.fromBytes(value)); + } + + get debt_liquidated(): BigDecimal { + let value = this.get('debt_liquidated'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set debt_liquidated(value: BigDecimal) { + this.set('debt_liquidated', Value.fromBigDecimal(value)); + } + + get collateral_liquidated(): BigDecimal { + let value = this.get('collateral_liquidated'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set collateral_liquidated(value: BigDecimal) { + this.set('collateral_liquidated', Value.fromBigDecimal(value)); + } + + get amount_rewarded(): BigDecimal { + let value = this.get('amount_rewarded'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set amount_rewarded(value: BigDecimal) { + this.set('amount_rewarded', Value.fromBigDecimal(value)); + } + + get liquidate_as_account_id(): string { + let value = this.get('liquidate_as_account_id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set liquidate_as_account_id(value: string) { + this.set('liquidate_as_account_id', Value.fromString(value)); + } + + get sender(): Bytes { + let value = this.get('sender'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set sender(value: Bytes) { + this.set('sender', Value.fromBytes(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } +} + +export class VaultLiquidation extends Entity { + constructor(id: string) { + super(); + this.set('id', Value.fromString(id)); + } + + save(): void { + let id = this.get('id'); + assert(id != null, 'Cannot save VaultLiquidation entity without an ID'); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type VaultLiquidation must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set('VaultLiquidation', id.toString(), this); + } + } + + static loadInBlock(id: string): VaultLiquidation | null { + return changetype(store.get_in_block('VaultLiquidation', id)); + } + + static load(id: string): VaultLiquidation | null { + return changetype(store.get('VaultLiquidation', id)); + } + + get id(): string { + let value = this.get('id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set('id', Value.fromString(value)); + } + + get pool(): string { + let value = this.get('pool'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set pool(value: string) { + this.set('pool', Value.fromString(value)); + } + + get collateral_type(): Bytes { + let value = this.get('collateral_type'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set collateral_type(value: Bytes) { + this.set('collateral_type', Value.fromBytes(value)); + } + + get amount_rewarded(): BigDecimal { + let value = this.get('amount_rewarded'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set amount_rewarded(value: BigDecimal) { + this.set('amount_rewarded', Value.fromBigDecimal(value)); + } + + get amount_liquidated(): BigDecimal { + let value = this.get('amount_liquidated'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set amount_liquidated(value: BigDecimal) { + this.set('amount_liquidated', Value.fromBigDecimal(value)); + } + + get collateral_liquidated(): BigDecimal { + let value = this.get('collateral_liquidated'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigDecimal(); + } + } + + set collateral_liquidated(value: BigDecimal) { + this.set('collateral_liquidated', Value.fromBigDecimal(value)); + } + + get liquidate_as_account_id(): string { + let value = this.get('liquidate_as_account_id'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toString(); + } + } + + set liquidate_as_account_id(value: string) { + this.set('liquidate_as_account_id', Value.fromString(value)); + } + + get sender(): Bytes { + let value = this.get('sender'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBytes(); + } + } + + set sender(value: Bytes) { + this.set('sender', Value.fromBytes(value)); + } + + get created_at(): BigInt { + let value = this.get('created_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at(value: BigInt) { + this.set('created_at', Value.fromBigInt(value)); + } + + get created_at_block(): BigInt { + let value = this.get('created_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set created_at_block(value: BigInt) { + this.set('created_at_block', Value.fromBigInt(value)); + } + + get updated_at(): BigInt { + let value = this.get('updated_at'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at(value: BigInt) { + this.set('updated_at', Value.fromBigInt(value)); + } + + get updated_at_block(): BigInt { + let value = this.get('updated_at_block'); + if (!value || value.kind == ValueKind.NULL) { + throw new Error('Cannot return null for a required field.'); + } else { + return value.toBigInt(); + } + } + + set updated_at_block(value: BigInt) { + this.set('updated_at_block', Value.fromBigInt(value)); + } +} diff --git a/protocol/synthetix/subgraph/base-goerli/index.ts b/protocol/synthetix/subgraph/base-goerli/index.ts new file mode 100644 index 0000000000..9b7aa5617d --- /dev/null +++ b/protocol/synthetix/subgraph/base-goerli/index.ts @@ -0,0 +1,29 @@ +// base-goerli has exactly same deployments as mainnet (in theory lol), so we reuse all the handlers +// If some handlers need to be different - we copy-paste them into base-goerli folder and make adjustments. Later when aligned with mainnet -- revert import +export * from '../mainnet/getISOWeekNumber'; +export * from '../mainnet/handleAccountCreated'; +export * from '../mainnet/handleCollateralConfigured'; +export * from '../mainnet/handleCollateralDeposited'; +export * from '../mainnet/handleCollateralWithdrawn'; +export * from '../mainnet/handleDelegationUpdated'; +export * from '../mainnet/handleLiquidation'; +export * from '../mainnet/handleMarketCreated'; +export * from '../mainnet/handleMarketUsdDeposited'; +export * from '../mainnet/handleMarketUsdWithdrawn'; +export * from '../mainnet/handlePermissionGranted'; +export * from '../mainnet/handlePermissionRevoked'; +export * from '../mainnet/handlePoolConfigurationSet'; +export * from '../mainnet/handlePoolCreated'; +export * from '../mainnet/handlePoolNameUpdated'; +export * from '../mainnet/handlePoolNominationRenounced'; +export * from '../mainnet/handlePoolNominationRevoked'; +export * from '../mainnet/handlePoolOwnerNominated'; +export * from '../mainnet/handlePoolOwnershipAccepted'; +export * from '../mainnet/handleRewardsClaimed'; +export * from '../mainnet/handleRewardsDistributed'; +export * from '../mainnet/handleRewardsDistributorRegistered'; +export * from '../mainnet/handleUSDBurned'; +export * from '../mainnet/handleUSDMinted'; +export * from '../mainnet/handleVaultLiquidation'; +export * from '../mainnet/marketSnapshotByDay'; +export * from '../mainnet/marketSnapshotByWeek'; diff --git a/protocol/synthetix/subgraph/base-goerli/schema.graphql b/protocol/synthetix/subgraph/base-goerli/schema.graphql new file mode 100644 index 0000000000..73878cae44 --- /dev/null +++ b/protocol/synthetix/subgraph/base-goerli/schema.graphql @@ -0,0 +1,239 @@ +type Pool @entity { + id: ID! + owner: Bytes! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt + updated_at_block: BigInt + "Defined when a owner is nominated and empty if he revoked, or got revoked" + nominated_owner: Bytes + "Only set when name of the pool got updated" + name: String + total_weight: BigInt + "Registered rewards distributors" + registered_distributors: [RewardsDistributor!] @derivedFrom(field: "pool") + "This is an internal field, needed to keep configurations in sync. The reason for this is due to derived fields are no readable from event handlers. Consumers should look up markets by the configurations field" + market_ids: [String!] + configurations: [MarketConfiguration!] @derivedFrom(field: "pool") +} + +type Market @entity { + id: ID! + address: Bytes! + created_at: BigInt! + created_at_block: BigInt! + configurations: [MarketConfiguration!] @derivedFrom(field: "market") + market_snapshots_by_day: [MarketSnapshotByDay!] @derivedFrom(field: "market") + market_snapshots_by_week: [MarketSnapshotByWeek!] + @derivedFrom(field: "market") + updated_at: BigInt! + updated_at_block: BigInt! + usd_deposited: BigDecimal! + usd_withdrawn: BigDecimal! + "withdrawn - deposited" + net_issuance: BigDecimal! + reported_debt: BigDecimal! +} + +type MarketSnapshotByDay @entity { + "marketId-YYYY-MM-DD" + id: ID! + updated_at: BigInt! + updated_at_block: BigInt! + created_at: BigInt! + created_at_block: BigInt! + updates_in_period: BigInt! + market: Market! + usd_deposited: BigDecimal! + usd_withdrawn: BigDecimal! + "withdrawn - deposited" + net_issuance: BigDecimal! + reported_debt: BigDecimal! +} + +type MarketSnapshotByWeek @entity { + "marketId-YYYY-WeekNumber" + id: ID! + updated_at: BigInt! + updated_at_block: BigInt! + created_at: BigInt! + created_at_block: BigInt! + updates_in_period: BigInt! + market: Market! + usd_deposited: BigDecimal! + usd_withdrawn: BigDecimal! + "withdrawn - deposited" + net_issuance: BigDecimal! + reported_debt: BigDecimal! +} + +type MarketConfiguration @entity { + "PoolId-MarketId" + id: ID! + pool: Pool! + market: Market! + weight: BigInt! + created_at: BigInt! + created_at_block: BigInt! + updated_at_block: BigInt! + updated_at: BigInt! + max_debt_share_value: BigDecimal! +} + +type CollateralType @entity { + "Address of the ERC20 contract" + id: ID! + oracle_node_id: BigInt! + depositing_enabled: Boolean! + issuance_ratio: BigDecimal! + liquidation_ratio: BigDecimal! + liquidation_reward: BigDecimal! + min_delegation: BigDecimal! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt! + updated_at_block: BigInt! + total_amount_deposited: BigDecimal +} + +type Account @entity { + "NFT token id" + id: ID! + owner: Bytes! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt! + updated_at_block: BigInt! + permissions: [AccountPermissionUsers!] +} + +type AccountPermissionUsers @entity { + "NFT token id + user address" + id: ID! + address: Bytes! + account: Account! + permissions: [Bytes!]! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt! + updated_at_block: BigInt! +} + +type Position @entity { + "NFT token id + pool id + collateral type address" + id: ID! + collateral_amount: BigDecimal! + leverage: BigDecimal! + # TODO @dev find a way to calculate that without a contract call + # c_ratio: BigDecimal! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt! + updated_at_block: BigInt! + account: Account! + pool: Pool! + collateral_type: CollateralType! + "total-minted - total_burned" + net_issuance: BigDecimal + total_minted: BigDecimal + total_burned: BigDecimal +} + +type Vault @entity { + "Pool id + collateral type address" + id: ID! + collateral_amount: BigDecimal! + collateral_type: CollateralType! + pool: Pool! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt! + updated_at_block: BigInt! +} + +type RewardsDistributor @entity { + "Address of the distributor" + id: ID! + "Total amount of to be or already distributions" + total_distributed: BigDecimal! + "Total amount of claimed distributions" + total_claimed: BigDecimal! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt! + updated_at_block: BigInt! + pool: Pool! +} + +type RewardsDistribution @entity { + "Rewards distributor address + timestamp + log index" + id: ID! + collateral_type: Bytes! + pool: Pool! + amount: BigDecimal! + start: BigInt! + duration: BigInt! + distributor: RewardsDistributor! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt! + updated_at_block: BigInt! +} + +type AccountRewardsDistributor @entity { + "Pool id + collateral type + distributor" + id: ID! + distributor: RewardsDistributor! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt! + updated_at_block: BigInt! + total_claimed: BigDecimal +} + +type RewardsClaimed @entity { + "Rewards distributor id + timestamp + log index" + id: ID! + account: Account! + pool: Pool! + collateral_type: Bytes! + distributor: RewardsDistributor! + amount: BigDecimal! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt! + updated_at_block: BigInt! +} + +type Liquidation @entity { + "NFT token id + pool id + collateral_type + log index (number of occurence)" + id: ID! + account: Account! + pool: Pool! + collateral_type: Bytes! + debt_liquidated: BigDecimal! + collateral_liquidated: BigDecimal! + amount_rewarded: BigDecimal! + liquidate_as_account_id: Account! + sender: Bytes! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt! + updated_at_block: BigInt! +} + +type VaultLiquidation @entity { + "Pool id + collateral type + log index (number of occurence)" + id: ID! + pool: Pool! + collateral_type: Bytes! + amount_rewarded: BigDecimal! + amount_liquidated: BigDecimal! + collateral_liquidated: BigDecimal! + liquidate_as_account_id: Account! + sender: Bytes! + created_at: BigInt! + created_at_block: BigInt! + updated_at: BigInt! + updated_at_block: BigInt! +} diff --git a/protocol/synthetix/subgraph/codegen.sh b/protocol/synthetix/subgraph/codegen.sh new file mode 100755 index 0000000000..898fb8c223 --- /dev/null +++ b/protocol/synthetix/subgraph/codegen.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +codegen() { + namespace=$1 + chainId=$2 + cannonPackage=$3 + cannonPreset=$4 + + echo + echo + echo + echo '>' cannon inspect "$cannonPackage" --preset $cannonPreset --chain-id "$chainId" --write-deployments "./$namespace/deployments" + yarn cannon inspect "$cannonPackage" --preset $cannonPreset --chain-id "$chainId" --write-deployments "./$namespace/deployments" + + echo + echo + echo + echo '>' graph codegen "subgraph.$namespace.yaml" --output-dir "$namespace/generated" + yarn graph codegen "subgraph.$namespace.yaml" --output-dir "$namespace/generated" + yarn prettier --write "$namespace/generated" + + echo + echo + echo + echo '>' graph build "subgraph.$namespace.yaml" --output-dir "./build/$namespace" + yarn graph build "subgraph.$namespace.yaml" --output-dir "./build/$namespace" + yarn prettier --write "subgraph.$namespace.yaml" +} + + +releaseVersion=$(yarn workspace "@synthetixio/main" node -p 'require(`./package.json`).version') + +codegen mainnet 1 "synthetix:$releaseVersion" main +codegen goerli 5 "synthetix:$releaseVersion" main +codegen optimism-mainnet 10 "synthetix:$releaseVersion" main +codegen optimism-goerli 420 "synthetix:$releaseVersion" main +codegen base-goerli 84531 "synthetix:$releaseVersion" main +codegen base-goerli-competition 84531 "synthetix:latest" competition diff --git a/protocol/synthetix/subgraph/goerli/generated/CoreProxy/CoreProxy.ts b/protocol/synthetix/subgraph/goerli/generated/CoreProxy/CoreProxy.ts index 2c5297168b..bc2341f8cc 100644 --- a/protocol/synthetix/subgraph/goerli/generated/CoreProxy/CoreProxy.ts +++ b/protocol/synthetix/subgraph/goerli/generated/CoreProxy/CoreProxy.ts @@ -1026,6 +1026,66 @@ export class PreferredPoolSet__Params { } } +export class PoolCollateralConfigurationUpdated extends ethereum.Event { + get params(): PoolCollateralConfigurationUpdated__Params { + return new PoolCollateralConfigurationUpdated__Params(this); + } +} + +export class PoolCollateralConfigurationUpdated__Params { + _event: PoolCollateralConfigurationUpdated; + + constructor(event: PoolCollateralConfigurationUpdated) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get config(): PoolCollateralConfigurationUpdatedConfigStruct { + return changetype( + this._event.parameters[2].value.toTuple() + ); + } +} + +export class PoolCollateralConfigurationUpdatedConfigStruct extends ethereum.Tuple { + get collateralLimitD18(): BigInt { + return this[0].toBigInt(); + } + + get issuanceRatioD18(): BigInt { + return this[1].toBigInt(); + } +} + +export class PoolCollateralDisabledByDefaultSet extends ethereum.Event { + get params(): PoolCollateralDisabledByDefaultSet__Params { + return new PoolCollateralDisabledByDefaultSet__Params(this); + } +} + +export class PoolCollateralDisabledByDefaultSet__Params { + _event: PoolCollateralDisabledByDefaultSet; + + constructor(event: PoolCollateralDisabledByDefaultSet) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get disabled(): boolean { + return this._event.parameters[1].value.toBoolean(); + } +} + export class PoolConfigurationSet extends ethereum.Event { get params(): PoolConfigurationSet__Params { return new PoolConfigurationSet__Params(this); @@ -1598,6 +1658,63 @@ export class CoreProxy__getMarketFeesResult { } } +export class CoreProxy__getMarketPoolDebtDistributionResult { + value0: BigInt; + value1: BigInt; + value2: BigInt; + + constructor(value0: BigInt, value1: BigInt, value2: BigInt) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + map.set('value2', ethereum.Value.fromSignedBigInt(this.value2)); + return map; + } + + getSharesD18(): BigInt { + return this.value0; + } + + getTotalSharesD18(): BigInt { + return this.value1; + } + + getValuePerShareD27(): BigInt { + return this.value2; + } +} + +export class CoreProxy__getMarketPoolsResult { + value0: Array; + value1: Array; + + constructor(value0: Array, value1: Array) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigIntArray(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigIntArray(this.value1)); + return map; + } + + getInRangePoolIds(): Array { + return this.value0; + } + + getOutRangePoolIds(): Array { + return this.value1; + } +} + export class CoreProxy__getPoolConfigurationResultValue0Struct extends ethereum.Tuple { get marketId(): BigInt { return this[0].toBigInt(); @@ -2614,6 +2731,25 @@ export class CoreProxy extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBoolean()); } + getMarketAddress(marketId: BigInt): Address { + let result = super.call('getMarketAddress', 'getMarketAddress(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toAddress(); + } + + try_getMarketAddress(marketId: BigInt): ethereum.CallResult
{ + let result = super.tryCall('getMarketAddress', 'getMarketAddress(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + getMarketCollateral(marketId: BigInt): BigInt { let result = super.call('getMarketCollateral', 'getMarketCollateral(uint128):(uint256)', [ ethereum.Value.fromUnsignedBigInt(marketId), @@ -2721,6 +2857,69 @@ export class CoreProxy extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } + getMarketPoolDebtDistribution( + marketId: BigInt, + poolId: BigInt + ): CoreProxy__getMarketPoolDebtDistributionResult { + let result = super.call( + 'getMarketPoolDebtDistribution', + 'getMarketPoolDebtDistribution(uint128,uint128):(uint256,uint128,int128)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(poolId)] + ); + + return new CoreProxy__getMarketPoolDebtDistributionResult( + result[0].toBigInt(), + result[1].toBigInt(), + result[2].toBigInt() + ); + } + + try_getMarketPoolDebtDistribution( + marketId: BigInt, + poolId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'getMarketPoolDebtDistribution', + 'getMarketPoolDebtDistribution(uint128,uint128):(uint256,uint128,int128)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(poolId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__getMarketPoolDebtDistributionResult( + value[0].toBigInt(), + value[1].toBigInt(), + value[2].toBigInt() + ) + ); + } + + getMarketPools(marketId: BigInt): CoreProxy__getMarketPoolsResult { + let result = super.call('getMarketPools', 'getMarketPools(uint128):(uint128[],uint128[])', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return new CoreProxy__getMarketPoolsResult( + result[0].toBigIntArray(), + result[1].toBigIntArray() + ); + } + + try_getMarketPools(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('getMarketPools', 'getMarketPools(uint128):(uint128[],uint128[])', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__getMarketPoolsResult(value[0].toBigIntArray(), value[1].toBigIntArray()) + ); + } + getMarketReportedDebt(marketId: BigInt): BigInt { let result = super.call('getMarketReportedDebt', 'getMarketReportedDebt(uint128):(uint256)', [ ethereum.Value.fromUnsignedBigInt(marketId), @@ -2906,6 +3105,40 @@ export class CoreProxy extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } + getMessageSender(): Address { + let result = super.call('getMessageSender', 'getMessageSender():(address)', []); + + return result[0].toAddress(); + } + + try_getMessageSender(): ethereum.CallResult
{ + let result = super.tryCall('getMessageSender', 'getMessageSender():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + multicall(data: Array): Array { + let result = super.call('multicall', 'multicall(bytes[]):(bytes[])', [ + ethereum.Value.fromBytesArray(data), + ]); + + return result[0].toBytesArray(); + } + + try_multicall(data: Array): ethereum.CallResult> { + let result = super.tryCall('multicall', 'multicall(bytes[]):(bytes[])', [ + ethereum.Value.fromBytesArray(data), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBytesArray()); + } + getApprovedPools(): Array { let result = super.call('getApprovedPools', 'getApprovedPools():(uint256[])', []); @@ -2972,6 +3205,32 @@ export class CoreProxy extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toAddress()); } + getPoolCollateralIssuanceRatio(poolId: BigInt, collateral: Address): BigInt { + let result = super.call( + 'getPoolCollateralIssuanceRatio', + 'getPoolCollateralIssuanceRatio(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(poolId), ethereum.Value.fromAddress(collateral)] + ); + + return result[0].toBigInt(); + } + + try_getPoolCollateralIssuanceRatio( + poolId: BigInt, + collateral: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getPoolCollateralIssuanceRatio', + 'getPoolCollateralIssuanceRatio(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(poolId), ethereum.Value.fromAddress(collateral)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + getPoolConfiguration(poolId: BigInt): Array { let result = super.call( 'getPoolConfiguration', @@ -5038,6 +5297,90 @@ export class GetMarketDebtPerShareCall__Outputs { } } +export class GetMarketPoolDebtDistributionCall extends ethereum.Call { + get inputs(): GetMarketPoolDebtDistributionCall__Inputs { + return new GetMarketPoolDebtDistributionCall__Inputs(this); + } + + get outputs(): GetMarketPoolDebtDistributionCall__Outputs { + return new GetMarketPoolDebtDistributionCall__Outputs(this); + } +} + +export class GetMarketPoolDebtDistributionCall__Inputs { + _call: GetMarketPoolDebtDistributionCall; + + constructor(call: GetMarketPoolDebtDistributionCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class GetMarketPoolDebtDistributionCall__Outputs { + _call: GetMarketPoolDebtDistributionCall; + + constructor(call: GetMarketPoolDebtDistributionCall) { + this._call = call; + } + + get sharesD18(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } + + get totalSharesD18(): BigInt { + return this._call.outputValues[1].value.toBigInt(); + } + + get valuePerShareD27(): BigInt { + return this._call.outputValues[2].value.toBigInt(); + } +} + +export class GetMarketPoolsCall extends ethereum.Call { + get inputs(): GetMarketPoolsCall__Inputs { + return new GetMarketPoolsCall__Inputs(this); + } + + get outputs(): GetMarketPoolsCall__Outputs { + return new GetMarketPoolsCall__Outputs(this); + } +} + +export class GetMarketPoolsCall__Inputs { + _call: GetMarketPoolsCall; + + constructor(call: GetMarketPoolsCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class GetMarketPoolsCall__Outputs { + _call: GetMarketPoolsCall; + + constructor(call: GetMarketPoolsCall) { + this._call = call; + } + + get inRangePoolIds(): Array { + return this._call.outputValues[0].value.toBigIntArray(); + } + + get outRangePoolIds(): Array { + return this._call.outputValues[1].value.toBigIntArray(); + } +} + export class RegisterMarketCall extends ethereum.Call { get inputs(): RegisterMarketCall__Inputs { return new RegisterMarketCall__Inputs(this); @@ -5216,6 +5559,82 @@ export class MulticallCall__Outputs { } } +export class MulticallThroughCall extends ethereum.Call { + get inputs(): MulticallThroughCall__Inputs { + return new MulticallThroughCall__Inputs(this); + } + + get outputs(): MulticallThroughCall__Outputs { + return new MulticallThroughCall__Outputs(this); + } +} + +export class MulticallThroughCall__Inputs { + _call: MulticallThroughCall; + + constructor(call: MulticallThroughCall) { + this._call = call; + } + + get to(): Array
{ + return this._call.inputValues[0].value.toAddressArray(); + } + + get data(): Array { + return this._call.inputValues[1].value.toBytesArray(); + } + + get values(): Array { + return this._call.inputValues[2].value.toBigIntArray(); + } +} + +export class MulticallThroughCall__Outputs { + _call: MulticallThroughCall; + + constructor(call: MulticallThroughCall) { + this._call = call; + } + + get results(): Array { + return this._call.outputValues[0].value.toBytesArray(); + } +} + +export class SetAllowlistedMulticallTargetCall extends ethereum.Call { + get inputs(): SetAllowlistedMulticallTargetCall__Inputs { + return new SetAllowlistedMulticallTargetCall__Inputs(this); + } + + get outputs(): SetAllowlistedMulticallTargetCall__Outputs { + return new SetAllowlistedMulticallTargetCall__Outputs(this); + } +} + +export class SetAllowlistedMulticallTargetCall__Inputs { + _call: SetAllowlistedMulticallTargetCall; + + constructor(call: SetAllowlistedMulticallTargetCall) { + this._call = call; + } + + get target(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get allowlisted(): boolean { + return this._call.inputValues[1].value.toBoolean(); + } +} + +export class SetAllowlistedMulticallTargetCall__Outputs { + _call: SetAllowlistedMulticallTargetCall; + + constructor(call: SetAllowlistedMulticallTargetCall) { + this._call = call; + } +} + export class AddApprovedPoolCall extends ethereum.Call { get inputs(): AddApprovedPoolCall__Inputs { return new AddApprovedPoolCall__Inputs(this); @@ -5528,6 +5947,90 @@ export class SetMinLiquidityRatio1Call__Outputs { } } +export class SetPoolCollateralConfigurationCall extends ethereum.Call { + get inputs(): SetPoolCollateralConfigurationCall__Inputs { + return new SetPoolCollateralConfigurationCall__Inputs(this); + } + + get outputs(): SetPoolCollateralConfigurationCall__Outputs { + return new SetPoolCollateralConfigurationCall__Outputs(this); + } +} + +export class SetPoolCollateralConfigurationCall__Inputs { + _call: SetPoolCollateralConfigurationCall; + + constructor(call: SetPoolCollateralConfigurationCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get newConfig(): SetPoolCollateralConfigurationCallNewConfigStruct { + return changetype( + this._call.inputValues[2].value.toTuple() + ); + } +} + +export class SetPoolCollateralConfigurationCall__Outputs { + _call: SetPoolCollateralConfigurationCall; + + constructor(call: SetPoolCollateralConfigurationCall) { + this._call = call; + } +} + +export class SetPoolCollateralConfigurationCallNewConfigStruct extends ethereum.Tuple { + get collateralLimitD18(): BigInt { + return this[0].toBigInt(); + } + + get issuanceRatioD18(): BigInt { + return this[1].toBigInt(); + } +} + +export class SetPoolCollateralDisabledByDefaultCall extends ethereum.Call { + get inputs(): SetPoolCollateralDisabledByDefaultCall__Inputs { + return new SetPoolCollateralDisabledByDefaultCall__Inputs(this); + } + + get outputs(): SetPoolCollateralDisabledByDefaultCall__Outputs { + return new SetPoolCollateralDisabledByDefaultCall__Outputs(this); + } +} + +export class SetPoolCollateralDisabledByDefaultCall__Inputs { + _call: SetPoolCollateralDisabledByDefaultCall; + + constructor(call: SetPoolCollateralDisabledByDefaultCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get disabled(): boolean { + return this._call.inputValues[1].value.toBoolean(); + } +} + +export class SetPoolCollateralDisabledByDefaultCall__Outputs { + _call: SetPoolCollateralDisabledByDefaultCall; + + constructor(call: SetPoolCollateralDisabledByDefaultCall) { + this._call = call; + } +} + export class SetPoolConfigurationCall extends ethereum.Call { get inputs(): SetPoolConfigurationCall__Inputs { return new SetPoolConfigurationCall__Inputs(this); diff --git a/protocol/synthetix/subgraph/mainnet/generated/CoreProxy/CoreProxy.ts b/protocol/synthetix/subgraph/mainnet/generated/CoreProxy/CoreProxy.ts index 2c5297168b..bc2341f8cc 100644 --- a/protocol/synthetix/subgraph/mainnet/generated/CoreProxy/CoreProxy.ts +++ b/protocol/synthetix/subgraph/mainnet/generated/CoreProxy/CoreProxy.ts @@ -1026,6 +1026,66 @@ export class PreferredPoolSet__Params { } } +export class PoolCollateralConfigurationUpdated extends ethereum.Event { + get params(): PoolCollateralConfigurationUpdated__Params { + return new PoolCollateralConfigurationUpdated__Params(this); + } +} + +export class PoolCollateralConfigurationUpdated__Params { + _event: PoolCollateralConfigurationUpdated; + + constructor(event: PoolCollateralConfigurationUpdated) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get config(): PoolCollateralConfigurationUpdatedConfigStruct { + return changetype( + this._event.parameters[2].value.toTuple() + ); + } +} + +export class PoolCollateralConfigurationUpdatedConfigStruct extends ethereum.Tuple { + get collateralLimitD18(): BigInt { + return this[0].toBigInt(); + } + + get issuanceRatioD18(): BigInt { + return this[1].toBigInt(); + } +} + +export class PoolCollateralDisabledByDefaultSet extends ethereum.Event { + get params(): PoolCollateralDisabledByDefaultSet__Params { + return new PoolCollateralDisabledByDefaultSet__Params(this); + } +} + +export class PoolCollateralDisabledByDefaultSet__Params { + _event: PoolCollateralDisabledByDefaultSet; + + constructor(event: PoolCollateralDisabledByDefaultSet) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get disabled(): boolean { + return this._event.parameters[1].value.toBoolean(); + } +} + export class PoolConfigurationSet extends ethereum.Event { get params(): PoolConfigurationSet__Params { return new PoolConfigurationSet__Params(this); @@ -1598,6 +1658,63 @@ export class CoreProxy__getMarketFeesResult { } } +export class CoreProxy__getMarketPoolDebtDistributionResult { + value0: BigInt; + value1: BigInt; + value2: BigInt; + + constructor(value0: BigInt, value1: BigInt, value2: BigInt) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + map.set('value2', ethereum.Value.fromSignedBigInt(this.value2)); + return map; + } + + getSharesD18(): BigInt { + return this.value0; + } + + getTotalSharesD18(): BigInt { + return this.value1; + } + + getValuePerShareD27(): BigInt { + return this.value2; + } +} + +export class CoreProxy__getMarketPoolsResult { + value0: Array; + value1: Array; + + constructor(value0: Array, value1: Array) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigIntArray(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigIntArray(this.value1)); + return map; + } + + getInRangePoolIds(): Array { + return this.value0; + } + + getOutRangePoolIds(): Array { + return this.value1; + } +} + export class CoreProxy__getPoolConfigurationResultValue0Struct extends ethereum.Tuple { get marketId(): BigInt { return this[0].toBigInt(); @@ -2614,6 +2731,25 @@ export class CoreProxy extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBoolean()); } + getMarketAddress(marketId: BigInt): Address { + let result = super.call('getMarketAddress', 'getMarketAddress(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toAddress(); + } + + try_getMarketAddress(marketId: BigInt): ethereum.CallResult
{ + let result = super.tryCall('getMarketAddress', 'getMarketAddress(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + getMarketCollateral(marketId: BigInt): BigInt { let result = super.call('getMarketCollateral', 'getMarketCollateral(uint128):(uint256)', [ ethereum.Value.fromUnsignedBigInt(marketId), @@ -2721,6 +2857,69 @@ export class CoreProxy extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } + getMarketPoolDebtDistribution( + marketId: BigInt, + poolId: BigInt + ): CoreProxy__getMarketPoolDebtDistributionResult { + let result = super.call( + 'getMarketPoolDebtDistribution', + 'getMarketPoolDebtDistribution(uint128,uint128):(uint256,uint128,int128)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(poolId)] + ); + + return new CoreProxy__getMarketPoolDebtDistributionResult( + result[0].toBigInt(), + result[1].toBigInt(), + result[2].toBigInt() + ); + } + + try_getMarketPoolDebtDistribution( + marketId: BigInt, + poolId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'getMarketPoolDebtDistribution', + 'getMarketPoolDebtDistribution(uint128,uint128):(uint256,uint128,int128)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(poolId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__getMarketPoolDebtDistributionResult( + value[0].toBigInt(), + value[1].toBigInt(), + value[2].toBigInt() + ) + ); + } + + getMarketPools(marketId: BigInt): CoreProxy__getMarketPoolsResult { + let result = super.call('getMarketPools', 'getMarketPools(uint128):(uint128[],uint128[])', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return new CoreProxy__getMarketPoolsResult( + result[0].toBigIntArray(), + result[1].toBigIntArray() + ); + } + + try_getMarketPools(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('getMarketPools', 'getMarketPools(uint128):(uint128[],uint128[])', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__getMarketPoolsResult(value[0].toBigIntArray(), value[1].toBigIntArray()) + ); + } + getMarketReportedDebt(marketId: BigInt): BigInt { let result = super.call('getMarketReportedDebt', 'getMarketReportedDebt(uint128):(uint256)', [ ethereum.Value.fromUnsignedBigInt(marketId), @@ -2906,6 +3105,40 @@ export class CoreProxy extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } + getMessageSender(): Address { + let result = super.call('getMessageSender', 'getMessageSender():(address)', []); + + return result[0].toAddress(); + } + + try_getMessageSender(): ethereum.CallResult
{ + let result = super.tryCall('getMessageSender', 'getMessageSender():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + multicall(data: Array): Array { + let result = super.call('multicall', 'multicall(bytes[]):(bytes[])', [ + ethereum.Value.fromBytesArray(data), + ]); + + return result[0].toBytesArray(); + } + + try_multicall(data: Array): ethereum.CallResult> { + let result = super.tryCall('multicall', 'multicall(bytes[]):(bytes[])', [ + ethereum.Value.fromBytesArray(data), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBytesArray()); + } + getApprovedPools(): Array { let result = super.call('getApprovedPools', 'getApprovedPools():(uint256[])', []); @@ -2972,6 +3205,32 @@ export class CoreProxy extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toAddress()); } + getPoolCollateralIssuanceRatio(poolId: BigInt, collateral: Address): BigInt { + let result = super.call( + 'getPoolCollateralIssuanceRatio', + 'getPoolCollateralIssuanceRatio(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(poolId), ethereum.Value.fromAddress(collateral)] + ); + + return result[0].toBigInt(); + } + + try_getPoolCollateralIssuanceRatio( + poolId: BigInt, + collateral: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getPoolCollateralIssuanceRatio', + 'getPoolCollateralIssuanceRatio(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(poolId), ethereum.Value.fromAddress(collateral)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + getPoolConfiguration(poolId: BigInt): Array { let result = super.call( 'getPoolConfiguration', @@ -5038,6 +5297,90 @@ export class GetMarketDebtPerShareCall__Outputs { } } +export class GetMarketPoolDebtDistributionCall extends ethereum.Call { + get inputs(): GetMarketPoolDebtDistributionCall__Inputs { + return new GetMarketPoolDebtDistributionCall__Inputs(this); + } + + get outputs(): GetMarketPoolDebtDistributionCall__Outputs { + return new GetMarketPoolDebtDistributionCall__Outputs(this); + } +} + +export class GetMarketPoolDebtDistributionCall__Inputs { + _call: GetMarketPoolDebtDistributionCall; + + constructor(call: GetMarketPoolDebtDistributionCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class GetMarketPoolDebtDistributionCall__Outputs { + _call: GetMarketPoolDebtDistributionCall; + + constructor(call: GetMarketPoolDebtDistributionCall) { + this._call = call; + } + + get sharesD18(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } + + get totalSharesD18(): BigInt { + return this._call.outputValues[1].value.toBigInt(); + } + + get valuePerShareD27(): BigInt { + return this._call.outputValues[2].value.toBigInt(); + } +} + +export class GetMarketPoolsCall extends ethereum.Call { + get inputs(): GetMarketPoolsCall__Inputs { + return new GetMarketPoolsCall__Inputs(this); + } + + get outputs(): GetMarketPoolsCall__Outputs { + return new GetMarketPoolsCall__Outputs(this); + } +} + +export class GetMarketPoolsCall__Inputs { + _call: GetMarketPoolsCall; + + constructor(call: GetMarketPoolsCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class GetMarketPoolsCall__Outputs { + _call: GetMarketPoolsCall; + + constructor(call: GetMarketPoolsCall) { + this._call = call; + } + + get inRangePoolIds(): Array { + return this._call.outputValues[0].value.toBigIntArray(); + } + + get outRangePoolIds(): Array { + return this._call.outputValues[1].value.toBigIntArray(); + } +} + export class RegisterMarketCall extends ethereum.Call { get inputs(): RegisterMarketCall__Inputs { return new RegisterMarketCall__Inputs(this); @@ -5216,6 +5559,82 @@ export class MulticallCall__Outputs { } } +export class MulticallThroughCall extends ethereum.Call { + get inputs(): MulticallThroughCall__Inputs { + return new MulticallThroughCall__Inputs(this); + } + + get outputs(): MulticallThroughCall__Outputs { + return new MulticallThroughCall__Outputs(this); + } +} + +export class MulticallThroughCall__Inputs { + _call: MulticallThroughCall; + + constructor(call: MulticallThroughCall) { + this._call = call; + } + + get to(): Array
{ + return this._call.inputValues[0].value.toAddressArray(); + } + + get data(): Array { + return this._call.inputValues[1].value.toBytesArray(); + } + + get values(): Array { + return this._call.inputValues[2].value.toBigIntArray(); + } +} + +export class MulticallThroughCall__Outputs { + _call: MulticallThroughCall; + + constructor(call: MulticallThroughCall) { + this._call = call; + } + + get results(): Array { + return this._call.outputValues[0].value.toBytesArray(); + } +} + +export class SetAllowlistedMulticallTargetCall extends ethereum.Call { + get inputs(): SetAllowlistedMulticallTargetCall__Inputs { + return new SetAllowlistedMulticallTargetCall__Inputs(this); + } + + get outputs(): SetAllowlistedMulticallTargetCall__Outputs { + return new SetAllowlistedMulticallTargetCall__Outputs(this); + } +} + +export class SetAllowlistedMulticallTargetCall__Inputs { + _call: SetAllowlistedMulticallTargetCall; + + constructor(call: SetAllowlistedMulticallTargetCall) { + this._call = call; + } + + get target(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get allowlisted(): boolean { + return this._call.inputValues[1].value.toBoolean(); + } +} + +export class SetAllowlistedMulticallTargetCall__Outputs { + _call: SetAllowlistedMulticallTargetCall; + + constructor(call: SetAllowlistedMulticallTargetCall) { + this._call = call; + } +} + export class AddApprovedPoolCall extends ethereum.Call { get inputs(): AddApprovedPoolCall__Inputs { return new AddApprovedPoolCall__Inputs(this); @@ -5528,6 +5947,90 @@ export class SetMinLiquidityRatio1Call__Outputs { } } +export class SetPoolCollateralConfigurationCall extends ethereum.Call { + get inputs(): SetPoolCollateralConfigurationCall__Inputs { + return new SetPoolCollateralConfigurationCall__Inputs(this); + } + + get outputs(): SetPoolCollateralConfigurationCall__Outputs { + return new SetPoolCollateralConfigurationCall__Outputs(this); + } +} + +export class SetPoolCollateralConfigurationCall__Inputs { + _call: SetPoolCollateralConfigurationCall; + + constructor(call: SetPoolCollateralConfigurationCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get newConfig(): SetPoolCollateralConfigurationCallNewConfigStruct { + return changetype( + this._call.inputValues[2].value.toTuple() + ); + } +} + +export class SetPoolCollateralConfigurationCall__Outputs { + _call: SetPoolCollateralConfigurationCall; + + constructor(call: SetPoolCollateralConfigurationCall) { + this._call = call; + } +} + +export class SetPoolCollateralConfigurationCallNewConfigStruct extends ethereum.Tuple { + get collateralLimitD18(): BigInt { + return this[0].toBigInt(); + } + + get issuanceRatioD18(): BigInt { + return this[1].toBigInt(); + } +} + +export class SetPoolCollateralDisabledByDefaultCall extends ethereum.Call { + get inputs(): SetPoolCollateralDisabledByDefaultCall__Inputs { + return new SetPoolCollateralDisabledByDefaultCall__Inputs(this); + } + + get outputs(): SetPoolCollateralDisabledByDefaultCall__Outputs { + return new SetPoolCollateralDisabledByDefaultCall__Outputs(this); + } +} + +export class SetPoolCollateralDisabledByDefaultCall__Inputs { + _call: SetPoolCollateralDisabledByDefaultCall; + + constructor(call: SetPoolCollateralDisabledByDefaultCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get disabled(): boolean { + return this._call.inputValues[1].value.toBoolean(); + } +} + +export class SetPoolCollateralDisabledByDefaultCall__Outputs { + _call: SetPoolCollateralDisabledByDefaultCall; + + constructor(call: SetPoolCollateralDisabledByDefaultCall) { + this._call = call; + } +} + export class SetPoolConfigurationCall extends ethereum.Call { get inputs(): SetPoolConfigurationCall__Inputs { return new SetPoolConfigurationCall__Inputs(this); diff --git a/protocol/synthetix/subgraph/optimism-goerli/generated/CoreProxy/CoreProxy.ts b/protocol/synthetix/subgraph/optimism-goerli/generated/CoreProxy/CoreProxy.ts index 8aacea1100..bc2341f8cc 100644 --- a/protocol/synthetix/subgraph/optimism-goerli/generated/CoreProxy/CoreProxy.ts +++ b/protocol/synthetix/subgraph/optimism-goerli/generated/CoreProxy/CoreProxy.ts @@ -1026,6 +1026,66 @@ export class PreferredPoolSet__Params { } } +export class PoolCollateralConfigurationUpdated extends ethereum.Event { + get params(): PoolCollateralConfigurationUpdated__Params { + return new PoolCollateralConfigurationUpdated__Params(this); + } +} + +export class PoolCollateralConfigurationUpdated__Params { + _event: PoolCollateralConfigurationUpdated; + + constructor(event: PoolCollateralConfigurationUpdated) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get config(): PoolCollateralConfigurationUpdatedConfigStruct { + return changetype( + this._event.parameters[2].value.toTuple() + ); + } +} + +export class PoolCollateralConfigurationUpdatedConfigStruct extends ethereum.Tuple { + get collateralLimitD18(): BigInt { + return this[0].toBigInt(); + } + + get issuanceRatioD18(): BigInt { + return this[1].toBigInt(); + } +} + +export class PoolCollateralDisabledByDefaultSet extends ethereum.Event { + get params(): PoolCollateralDisabledByDefaultSet__Params { + return new PoolCollateralDisabledByDefaultSet__Params(this); + } +} + +export class PoolCollateralDisabledByDefaultSet__Params { + _event: PoolCollateralDisabledByDefaultSet; + + constructor(event: PoolCollateralDisabledByDefaultSet) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get disabled(): boolean { + return this._event.parameters[1].value.toBoolean(); + } +} + export class PoolConfigurationSet extends ethereum.Event { get params(): PoolConfigurationSet__Params { return new PoolConfigurationSet__Params(this); @@ -2671,6 +2731,25 @@ export class CoreProxy extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBoolean()); } + getMarketAddress(marketId: BigInt): Address { + let result = super.call('getMarketAddress', 'getMarketAddress(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toAddress(); + } + + try_getMarketAddress(marketId: BigInt): ethereum.CallResult
{ + let result = super.tryCall('getMarketAddress', 'getMarketAddress(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + getMarketCollateral(marketId: BigInt): BigInt { let result = super.call('getMarketCollateral', 'getMarketCollateral(uint128):(uint256)', [ ethereum.Value.fromUnsignedBigInt(marketId), @@ -3026,6 +3105,40 @@ export class CoreProxy extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } + getMessageSender(): Address { + let result = super.call('getMessageSender', 'getMessageSender():(address)', []); + + return result[0].toAddress(); + } + + try_getMessageSender(): ethereum.CallResult
{ + let result = super.tryCall('getMessageSender', 'getMessageSender():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + multicall(data: Array): Array { + let result = super.call('multicall', 'multicall(bytes[]):(bytes[])', [ + ethereum.Value.fromBytesArray(data), + ]); + + return result[0].toBytesArray(); + } + + try_multicall(data: Array): ethereum.CallResult> { + let result = super.tryCall('multicall', 'multicall(bytes[]):(bytes[])', [ + ethereum.Value.fromBytesArray(data), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBytesArray()); + } + getApprovedPools(): Array { let result = super.call('getApprovedPools', 'getApprovedPools():(uint256[])', []); @@ -3092,6 +3205,32 @@ export class CoreProxy extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toAddress()); } + getPoolCollateralIssuanceRatio(poolId: BigInt, collateral: Address): BigInt { + let result = super.call( + 'getPoolCollateralIssuanceRatio', + 'getPoolCollateralIssuanceRatio(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(poolId), ethereum.Value.fromAddress(collateral)] + ); + + return result[0].toBigInt(); + } + + try_getPoolCollateralIssuanceRatio( + poolId: BigInt, + collateral: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getPoolCollateralIssuanceRatio', + 'getPoolCollateralIssuanceRatio(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(poolId), ethereum.Value.fromAddress(collateral)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + getPoolConfiguration(poolId: BigInt): Array { let result = super.call( 'getPoolConfiguration', @@ -5420,6 +5559,82 @@ export class MulticallCall__Outputs { } } +export class MulticallThroughCall extends ethereum.Call { + get inputs(): MulticallThroughCall__Inputs { + return new MulticallThroughCall__Inputs(this); + } + + get outputs(): MulticallThroughCall__Outputs { + return new MulticallThroughCall__Outputs(this); + } +} + +export class MulticallThroughCall__Inputs { + _call: MulticallThroughCall; + + constructor(call: MulticallThroughCall) { + this._call = call; + } + + get to(): Array
{ + return this._call.inputValues[0].value.toAddressArray(); + } + + get data(): Array { + return this._call.inputValues[1].value.toBytesArray(); + } + + get values(): Array { + return this._call.inputValues[2].value.toBigIntArray(); + } +} + +export class MulticallThroughCall__Outputs { + _call: MulticallThroughCall; + + constructor(call: MulticallThroughCall) { + this._call = call; + } + + get results(): Array { + return this._call.outputValues[0].value.toBytesArray(); + } +} + +export class SetAllowlistedMulticallTargetCall extends ethereum.Call { + get inputs(): SetAllowlistedMulticallTargetCall__Inputs { + return new SetAllowlistedMulticallTargetCall__Inputs(this); + } + + get outputs(): SetAllowlistedMulticallTargetCall__Outputs { + return new SetAllowlistedMulticallTargetCall__Outputs(this); + } +} + +export class SetAllowlistedMulticallTargetCall__Inputs { + _call: SetAllowlistedMulticallTargetCall; + + constructor(call: SetAllowlistedMulticallTargetCall) { + this._call = call; + } + + get target(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get allowlisted(): boolean { + return this._call.inputValues[1].value.toBoolean(); + } +} + +export class SetAllowlistedMulticallTargetCall__Outputs { + _call: SetAllowlistedMulticallTargetCall; + + constructor(call: SetAllowlistedMulticallTargetCall) { + this._call = call; + } +} + export class AddApprovedPoolCall extends ethereum.Call { get inputs(): AddApprovedPoolCall__Inputs { return new AddApprovedPoolCall__Inputs(this); @@ -5732,6 +5947,90 @@ export class SetMinLiquidityRatio1Call__Outputs { } } +export class SetPoolCollateralConfigurationCall extends ethereum.Call { + get inputs(): SetPoolCollateralConfigurationCall__Inputs { + return new SetPoolCollateralConfigurationCall__Inputs(this); + } + + get outputs(): SetPoolCollateralConfigurationCall__Outputs { + return new SetPoolCollateralConfigurationCall__Outputs(this); + } +} + +export class SetPoolCollateralConfigurationCall__Inputs { + _call: SetPoolCollateralConfigurationCall; + + constructor(call: SetPoolCollateralConfigurationCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get newConfig(): SetPoolCollateralConfigurationCallNewConfigStruct { + return changetype( + this._call.inputValues[2].value.toTuple() + ); + } +} + +export class SetPoolCollateralConfigurationCall__Outputs { + _call: SetPoolCollateralConfigurationCall; + + constructor(call: SetPoolCollateralConfigurationCall) { + this._call = call; + } +} + +export class SetPoolCollateralConfigurationCallNewConfigStruct extends ethereum.Tuple { + get collateralLimitD18(): BigInt { + return this[0].toBigInt(); + } + + get issuanceRatioD18(): BigInt { + return this[1].toBigInt(); + } +} + +export class SetPoolCollateralDisabledByDefaultCall extends ethereum.Call { + get inputs(): SetPoolCollateralDisabledByDefaultCall__Inputs { + return new SetPoolCollateralDisabledByDefaultCall__Inputs(this); + } + + get outputs(): SetPoolCollateralDisabledByDefaultCall__Outputs { + return new SetPoolCollateralDisabledByDefaultCall__Outputs(this); + } +} + +export class SetPoolCollateralDisabledByDefaultCall__Inputs { + _call: SetPoolCollateralDisabledByDefaultCall; + + constructor(call: SetPoolCollateralDisabledByDefaultCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get disabled(): boolean { + return this._call.inputValues[1].value.toBoolean(); + } +} + +export class SetPoolCollateralDisabledByDefaultCall__Outputs { + _call: SetPoolCollateralDisabledByDefaultCall; + + constructor(call: SetPoolCollateralDisabledByDefaultCall) { + this._call = call; + } +} + export class SetPoolConfigurationCall extends ethereum.Call { get inputs(): SetPoolConfigurationCall__Inputs { return new SetPoolConfigurationCall__Inputs(this); diff --git a/protocol/synthetix/subgraph/optimism-mainnet/generated/CoreProxy/CoreProxy.ts b/protocol/synthetix/subgraph/optimism-mainnet/generated/CoreProxy/CoreProxy.ts index 2c5297168b..bc2341f8cc 100644 --- a/protocol/synthetix/subgraph/optimism-mainnet/generated/CoreProxy/CoreProxy.ts +++ b/protocol/synthetix/subgraph/optimism-mainnet/generated/CoreProxy/CoreProxy.ts @@ -1026,6 +1026,66 @@ export class PreferredPoolSet__Params { } } +export class PoolCollateralConfigurationUpdated extends ethereum.Event { + get params(): PoolCollateralConfigurationUpdated__Params { + return new PoolCollateralConfigurationUpdated__Params(this); + } +} + +export class PoolCollateralConfigurationUpdated__Params { + _event: PoolCollateralConfigurationUpdated; + + constructor(event: PoolCollateralConfigurationUpdated) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._event.parameters[1].value.toAddress(); + } + + get config(): PoolCollateralConfigurationUpdatedConfigStruct { + return changetype( + this._event.parameters[2].value.toTuple() + ); + } +} + +export class PoolCollateralConfigurationUpdatedConfigStruct extends ethereum.Tuple { + get collateralLimitD18(): BigInt { + return this[0].toBigInt(); + } + + get issuanceRatioD18(): BigInt { + return this[1].toBigInt(); + } +} + +export class PoolCollateralDisabledByDefaultSet extends ethereum.Event { + get params(): PoolCollateralDisabledByDefaultSet__Params { + return new PoolCollateralDisabledByDefaultSet__Params(this); + } +} + +export class PoolCollateralDisabledByDefaultSet__Params { + _event: PoolCollateralDisabledByDefaultSet; + + constructor(event: PoolCollateralDisabledByDefaultSet) { + this._event = event; + } + + get poolId(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get disabled(): boolean { + return this._event.parameters[1].value.toBoolean(); + } +} + export class PoolConfigurationSet extends ethereum.Event { get params(): PoolConfigurationSet__Params { return new PoolConfigurationSet__Params(this); @@ -1598,6 +1658,63 @@ export class CoreProxy__getMarketFeesResult { } } +export class CoreProxy__getMarketPoolDebtDistributionResult { + value0: BigInt; + value1: BigInt; + value2: BigInt; + + constructor(value0: BigInt, value1: BigInt, value2: BigInt) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigInt(this.value1)); + map.set('value2', ethereum.Value.fromSignedBigInt(this.value2)); + return map; + } + + getSharesD18(): BigInt { + return this.value0; + } + + getTotalSharesD18(): BigInt { + return this.value1; + } + + getValuePerShareD27(): BigInt { + return this.value2; + } +} + +export class CoreProxy__getMarketPoolsResult { + value0: Array; + value1: Array; + + constructor(value0: Array, value1: Array) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set('value0', ethereum.Value.fromUnsignedBigIntArray(this.value0)); + map.set('value1', ethereum.Value.fromUnsignedBigIntArray(this.value1)); + return map; + } + + getInRangePoolIds(): Array { + return this.value0; + } + + getOutRangePoolIds(): Array { + return this.value1; + } +} + export class CoreProxy__getPoolConfigurationResultValue0Struct extends ethereum.Tuple { get marketId(): BigInt { return this[0].toBigInt(); @@ -2614,6 +2731,25 @@ export class CoreProxy extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBoolean()); } + getMarketAddress(marketId: BigInt): Address { + let result = super.call('getMarketAddress', 'getMarketAddress(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return result[0].toAddress(); + } + + try_getMarketAddress(marketId: BigInt): ethereum.CallResult
{ + let result = super.tryCall('getMarketAddress', 'getMarketAddress(uint128):(address)', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + getMarketCollateral(marketId: BigInt): BigInt { let result = super.call('getMarketCollateral', 'getMarketCollateral(uint128):(uint256)', [ ethereum.Value.fromUnsignedBigInt(marketId), @@ -2721,6 +2857,69 @@ export class CoreProxy extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } + getMarketPoolDebtDistribution( + marketId: BigInt, + poolId: BigInt + ): CoreProxy__getMarketPoolDebtDistributionResult { + let result = super.call( + 'getMarketPoolDebtDistribution', + 'getMarketPoolDebtDistribution(uint128,uint128):(uint256,uint128,int128)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(poolId)] + ); + + return new CoreProxy__getMarketPoolDebtDistributionResult( + result[0].toBigInt(), + result[1].toBigInt(), + result[2].toBigInt() + ); + } + + try_getMarketPoolDebtDistribution( + marketId: BigInt, + poolId: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + 'getMarketPoolDebtDistribution', + 'getMarketPoolDebtDistribution(uint128,uint128):(uint256,uint128,int128)', + [ethereum.Value.fromUnsignedBigInt(marketId), ethereum.Value.fromUnsignedBigInt(poolId)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__getMarketPoolDebtDistributionResult( + value[0].toBigInt(), + value[1].toBigInt(), + value[2].toBigInt() + ) + ); + } + + getMarketPools(marketId: BigInt): CoreProxy__getMarketPoolsResult { + let result = super.call('getMarketPools', 'getMarketPools(uint128):(uint128[],uint128[])', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + + return new CoreProxy__getMarketPoolsResult( + result[0].toBigIntArray(), + result[1].toBigIntArray() + ); + } + + try_getMarketPools(marketId: BigInt): ethereum.CallResult { + let result = super.tryCall('getMarketPools', 'getMarketPools(uint128):(uint128[],uint128[])', [ + ethereum.Value.fromUnsignedBigInt(marketId), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new CoreProxy__getMarketPoolsResult(value[0].toBigIntArray(), value[1].toBigIntArray()) + ); + } + getMarketReportedDebt(marketId: BigInt): BigInt { let result = super.call('getMarketReportedDebt', 'getMarketReportedDebt(uint128):(uint256)', [ ethereum.Value.fromUnsignedBigInt(marketId), @@ -2906,6 +3105,40 @@ export class CoreProxy extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBigInt()); } + getMessageSender(): Address { + let result = super.call('getMessageSender', 'getMessageSender():(address)', []); + + return result[0].toAddress(); + } + + try_getMessageSender(): ethereum.CallResult
{ + let result = super.tryCall('getMessageSender', 'getMessageSender():(address)', []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + multicall(data: Array): Array { + let result = super.call('multicall', 'multicall(bytes[]):(bytes[])', [ + ethereum.Value.fromBytesArray(data), + ]); + + return result[0].toBytesArray(); + } + + try_multicall(data: Array): ethereum.CallResult> { + let result = super.tryCall('multicall', 'multicall(bytes[]):(bytes[])', [ + ethereum.Value.fromBytesArray(data), + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBytesArray()); + } + getApprovedPools(): Array { let result = super.call('getApprovedPools', 'getApprovedPools():(uint256[])', []); @@ -2972,6 +3205,32 @@ export class CoreProxy extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toAddress()); } + getPoolCollateralIssuanceRatio(poolId: BigInt, collateral: Address): BigInt { + let result = super.call( + 'getPoolCollateralIssuanceRatio', + 'getPoolCollateralIssuanceRatio(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(poolId), ethereum.Value.fromAddress(collateral)] + ); + + return result[0].toBigInt(); + } + + try_getPoolCollateralIssuanceRatio( + poolId: BigInt, + collateral: Address + ): ethereum.CallResult { + let result = super.tryCall( + 'getPoolCollateralIssuanceRatio', + 'getPoolCollateralIssuanceRatio(uint128,address):(uint256)', + [ethereum.Value.fromUnsignedBigInt(poolId), ethereum.Value.fromAddress(collateral)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + getPoolConfiguration(poolId: BigInt): Array { let result = super.call( 'getPoolConfiguration', @@ -5038,6 +5297,90 @@ export class GetMarketDebtPerShareCall__Outputs { } } +export class GetMarketPoolDebtDistributionCall extends ethereum.Call { + get inputs(): GetMarketPoolDebtDistributionCall__Inputs { + return new GetMarketPoolDebtDistributionCall__Inputs(this); + } + + get outputs(): GetMarketPoolDebtDistributionCall__Outputs { + return new GetMarketPoolDebtDistributionCall__Outputs(this); + } +} + +export class GetMarketPoolDebtDistributionCall__Inputs { + _call: GetMarketPoolDebtDistributionCall; + + constructor(call: GetMarketPoolDebtDistributionCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get poolId(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class GetMarketPoolDebtDistributionCall__Outputs { + _call: GetMarketPoolDebtDistributionCall; + + constructor(call: GetMarketPoolDebtDistributionCall) { + this._call = call; + } + + get sharesD18(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } + + get totalSharesD18(): BigInt { + return this._call.outputValues[1].value.toBigInt(); + } + + get valuePerShareD27(): BigInt { + return this._call.outputValues[2].value.toBigInt(); + } +} + +export class GetMarketPoolsCall extends ethereum.Call { + get inputs(): GetMarketPoolsCall__Inputs { + return new GetMarketPoolsCall__Inputs(this); + } + + get outputs(): GetMarketPoolsCall__Outputs { + return new GetMarketPoolsCall__Outputs(this); + } +} + +export class GetMarketPoolsCall__Inputs { + _call: GetMarketPoolsCall; + + constructor(call: GetMarketPoolsCall) { + this._call = call; + } + + get marketId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class GetMarketPoolsCall__Outputs { + _call: GetMarketPoolsCall; + + constructor(call: GetMarketPoolsCall) { + this._call = call; + } + + get inRangePoolIds(): Array { + return this._call.outputValues[0].value.toBigIntArray(); + } + + get outRangePoolIds(): Array { + return this._call.outputValues[1].value.toBigIntArray(); + } +} + export class RegisterMarketCall extends ethereum.Call { get inputs(): RegisterMarketCall__Inputs { return new RegisterMarketCall__Inputs(this); @@ -5216,6 +5559,82 @@ export class MulticallCall__Outputs { } } +export class MulticallThroughCall extends ethereum.Call { + get inputs(): MulticallThroughCall__Inputs { + return new MulticallThroughCall__Inputs(this); + } + + get outputs(): MulticallThroughCall__Outputs { + return new MulticallThroughCall__Outputs(this); + } +} + +export class MulticallThroughCall__Inputs { + _call: MulticallThroughCall; + + constructor(call: MulticallThroughCall) { + this._call = call; + } + + get to(): Array
{ + return this._call.inputValues[0].value.toAddressArray(); + } + + get data(): Array { + return this._call.inputValues[1].value.toBytesArray(); + } + + get values(): Array { + return this._call.inputValues[2].value.toBigIntArray(); + } +} + +export class MulticallThroughCall__Outputs { + _call: MulticallThroughCall; + + constructor(call: MulticallThroughCall) { + this._call = call; + } + + get results(): Array { + return this._call.outputValues[0].value.toBytesArray(); + } +} + +export class SetAllowlistedMulticallTargetCall extends ethereum.Call { + get inputs(): SetAllowlistedMulticallTargetCall__Inputs { + return new SetAllowlistedMulticallTargetCall__Inputs(this); + } + + get outputs(): SetAllowlistedMulticallTargetCall__Outputs { + return new SetAllowlistedMulticallTargetCall__Outputs(this); + } +} + +export class SetAllowlistedMulticallTargetCall__Inputs { + _call: SetAllowlistedMulticallTargetCall; + + constructor(call: SetAllowlistedMulticallTargetCall) { + this._call = call; + } + + get target(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get allowlisted(): boolean { + return this._call.inputValues[1].value.toBoolean(); + } +} + +export class SetAllowlistedMulticallTargetCall__Outputs { + _call: SetAllowlistedMulticallTargetCall; + + constructor(call: SetAllowlistedMulticallTargetCall) { + this._call = call; + } +} + export class AddApprovedPoolCall extends ethereum.Call { get inputs(): AddApprovedPoolCall__Inputs { return new AddApprovedPoolCall__Inputs(this); @@ -5528,6 +5947,90 @@ export class SetMinLiquidityRatio1Call__Outputs { } } +export class SetPoolCollateralConfigurationCall extends ethereum.Call { + get inputs(): SetPoolCollateralConfigurationCall__Inputs { + return new SetPoolCollateralConfigurationCall__Inputs(this); + } + + get outputs(): SetPoolCollateralConfigurationCall__Outputs { + return new SetPoolCollateralConfigurationCall__Outputs(this); + } +} + +export class SetPoolCollateralConfigurationCall__Inputs { + _call: SetPoolCollateralConfigurationCall; + + constructor(call: SetPoolCollateralConfigurationCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get collateralType(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get newConfig(): SetPoolCollateralConfigurationCallNewConfigStruct { + return changetype( + this._call.inputValues[2].value.toTuple() + ); + } +} + +export class SetPoolCollateralConfigurationCall__Outputs { + _call: SetPoolCollateralConfigurationCall; + + constructor(call: SetPoolCollateralConfigurationCall) { + this._call = call; + } +} + +export class SetPoolCollateralConfigurationCallNewConfigStruct extends ethereum.Tuple { + get collateralLimitD18(): BigInt { + return this[0].toBigInt(); + } + + get issuanceRatioD18(): BigInt { + return this[1].toBigInt(); + } +} + +export class SetPoolCollateralDisabledByDefaultCall extends ethereum.Call { + get inputs(): SetPoolCollateralDisabledByDefaultCall__Inputs { + return new SetPoolCollateralDisabledByDefaultCall__Inputs(this); + } + + get outputs(): SetPoolCollateralDisabledByDefaultCall__Outputs { + return new SetPoolCollateralDisabledByDefaultCall__Outputs(this); + } +} + +export class SetPoolCollateralDisabledByDefaultCall__Inputs { + _call: SetPoolCollateralDisabledByDefaultCall; + + constructor(call: SetPoolCollateralDisabledByDefaultCall) { + this._call = call; + } + + get poolId(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get disabled(): boolean { + return this._call.inputValues[1].value.toBoolean(); + } +} + +export class SetPoolCollateralDisabledByDefaultCall__Outputs { + _call: SetPoolCollateralDisabledByDefaultCall; + + constructor(call: SetPoolCollateralDisabledByDefaultCall) { + this._call = call; + } +} + export class SetPoolConfigurationCall extends ethereum.Call { get inputs(): SetPoolConfigurationCall__Inputs { return new SetPoolConfigurationCall__Inputs(this); diff --git a/protocol/synthetix/subgraph/package.json b/protocol/synthetix/subgraph/package.json index 2658913894..574ee844fe 100644 --- a/protocol/synthetix/subgraph/package.json +++ b/protocol/synthetix/subgraph/package.json @@ -4,27 +4,17 @@ "private": true, "version": "1.0.0", "scripts": { - "subgraphgen": "yarn subgraph:deployments && yarn subgraph:codegen && yarn subgraph:build", - "subgraph:deployments": "yarn deployments:mainnet && yarn deployments:optimism-mainnet && yarn deployments:goerli && yarn deployments:optimism-goerli", - "subgraph:codegen": "yarn codegen:mainnet && yarn codegen:optimism-mainnet && yarn codegen:goerli && yarn codegen:optimism-goerli", - "subgraph:build": "yarn build:mainnet && yarn build:optimism-mainnet && yarn build:goerli && yarn build:optimism-goerli", + "cannon": "cannon", + "prettier": "prettier", + "graph": "graph", + "subgraphgen": "./codegen.sh", "auth": "graph auth --product hosted-service $V3_GRAPH_KEY", - "deployments:mainnet": "cannon inspect synthetix:latest --chain-id 1 --write-deployments ./deployments/mainnet", - "deployments:optimism-mainnet": "cannon inspect synthetix:latest --chain-id 10 --write-deployments ./deployments/optimism-mainnet", - "deployments:goerli": "cannon inspect synthetix:latest --chain-id 5 --write-deployments ./deployments/goerli", - "deployments:optimism-goerli": "cannon inspect synthetix:latest --chain-id 420 --write-deployments ./deployments/optimism-goerli", - "codegen:mainnet": "node ./codegen mainnet && graph codegen subgraph.mainnet.yaml --output-dir=mainnet/generated && prettier --write mainnet/generated", - "build:mainnet": "graph build subgraph.mainnet.yaml --output-dir ./build/mainnet --network mainnet", "deploy:mainnet": "graph deploy snx-v3/mainnet subgraph.mainnet.yaml --output-dir ./build/mainnet --network mainnet --product hosted-service", - "codegen:goerli": "node ./codegen goerli && graph codegen subgraph.goerli.yaml --output-dir=goerli/generated && prettier --write goerli/generated", - "build:goerli": "graph build subgraph.goerli.yaml --output-dir ./build/goerli --network goerli", "deploy:goerli": "graph deploy snx-v3/goerli subgraph.goerli.yaml --output-dir ./build/goerli --network goerli --product hosted-service", - "codegen:optimism-mainnet": "node ./codegen optimism-mainnet && graph codegen subgraph.optimism-mainnet.yaml --output-dir=optimism-mainnet/generated && prettier --write optimism-mainnet/generated", - "build:optimism-mainnet": "graph build subgraph.optimism-mainnet.yaml --output-dir ./build/optimism-mainnet --network optimism", "deploy:optimism-mainnet": "graph deploy snx-v3/optimism-mainnet subgraph.optimism-mainnet.yaml --output-dir ./build/optimism-mainnet --network optimism --product hosted-service", - "codegen:optimism-goerli": "node ./codegen optimism-goerli && graph codegen subgraph.optimism-goerli.yaml --output-dir=optimism-goerli/generated && prettier --write optimism-goerli/generated", - "build:optimism-goerli": "graph build subgraph.optimism-goerli.yaml --output-dir ./build/optimism-goerli --network optimism-goerli", "deploy:optimism-goerli": "graph deploy snx-v3/optimism-goerli subgraph.optimism-goerli.yaml --output-dir ./build/optimism-goerli --network optimism-goerli --product hosted-service", + "deploy:base-goerli": "graph deploy synthetix-base-goerli subgraph.base-goerli.yaml --output-dir ./build/base-goerli --network base-testnet --version-label v0.0.1 --node https://app.satsuma.xyz/api/subgraphs/deploy --deploy-key $SATSUMA_KEY --ipfs https://ipfs.satsuma.xyz", + "deploy:base-goerli-competition": "graph deploy synthetix-base-testnet subgraph.base-goerli-competition.yaml --output-dir ./build/base-goerli-competition --network base-testnet --version-label v0.0.1 --node https://app.satsuma.xyz/api/subgraphs/deploy --deploy-key $SATSUMA_KEY --ipfs https://ipfs.satsuma.xyz", "test": "graph test", "coverage": "yarn deployments:optimism-goerli && yarn codegen:optimism-goerli && git diff --exit-code && yarn test --coverage", "create-local": "graph create --node http://localhost:8020/ snx-v3/goerli", @@ -34,9 +24,9 @@ "devDependencies": { "@graphprotocol/graph-cli": "^0.50.1", "@graphprotocol/graph-ts": "^0.30.0", - "@usecannon/cli": "^2.5.1", + "@usecannon/cli": "^2.7.1", "ethers": "^5.7.2", "matchstick-as": "^0.5.2", - "prettier": "^2.8.8" + "prettier": "^3.0.3" } } diff --git a/protocol/synthetix/subgraph/startBlock.js b/protocol/synthetix/subgraph/startBlock.js new file mode 100755 index 0000000000..4ff4ed0978 --- /dev/null +++ b/protocol/synthetix/subgraph/startBlock.js @@ -0,0 +1,43 @@ +#!/usr/bin/env node + +const ethers = require('ethers'); + +async function getStartBlock({ namespace, networkName }) { + const provider = new ethers.providers.JsonRpcProvider( + `https://${networkName}.infura.io/v3/${process.env.INFURA_KEY}` + ); + const address = require(`./${namespace}/deployments/CoreProxy.json`).address; + const deployTx = require(`./${namespace}/deployments/InitialCoreProxy.json`).deployTxnHash; + const tx = await provider.getTransactionReceipt(deployTx); + return { namespace, networkName, address, startBlock: tx.blockNumber }; +} +exports.findDeploymentBlock = getStartBlock; + +async function findAll() { + const data = await Promise.all([ + getStartBlock({ namespace: 'mainnet', networkName: 'mainnet' }), + getStartBlock({ namespace: 'goerli', networkName: 'goerli' }), + getStartBlock({ namespace: 'optimism-mainnet', networkName: 'optimism-mainnet' }), + getStartBlock({ namespace: 'optimism-goerli', networkName: 'optimism-goerli' }), + getStartBlock({ namespace: 'base-goerli', networkName: 'base-goerli' }), + getStartBlock({ namespace: 'base-goerli-competition', networkName: 'base-goerli' }), + ]); + + return Object.fromEntries( + data.map(({ namespace, address, startBlock }) => [ + namespace, + { CoreProxy: { address, startBlock } }, + ]) + ); +} + +if (require.main === module) { + const [namespace, networkName] = process.argv.slice(2); + if (namespace && networkName) { + getStartBlock({ namespace, networkName }).then(({ address, startBlock }) => + console.log({ CoreProxy: { address, startBlock } }) + ); + } else { + findAll().then((data) => console.log(data)); + } +} diff --git a/protocol/synthetix/subgraph/subgraph.base-goerli-competition.yaml b/protocol/synthetix/subgraph/subgraph.base-goerli-competition.yaml new file mode 100644 index 0000000000..88760be878 --- /dev/null +++ b/protocol/synthetix/subgraph/subgraph.base-goerli-competition.yaml @@ -0,0 +1,104 @@ +specVersion: 0.0.4 +schema: + file: ./base-goerli-competition/schema.graphql +dataSources: + - kind: ethereum + network: base-testnet + name: CoreProxy + source: + abi: CoreProxy + address: "0xa53346A1684DAB73EFfd048fA40Fb1fA9327fDe9" + startBlock: 9243584 + mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + file: ./base-goerli-competition/index.ts + abis: + - name: CoreProxy + file: ./base-goerli-competition/deployments/CoreProxy.json + entities: + - PoolModule + - MarketManagerModule + - CollateralType + - AccountModule + - AccountPermissionUsers + - VaultModule + - Position + - IssueUSDModule + - RewardsClaimed + - RewardsDistribution + - AccountRewardsDistributor + - RewardsDistributor + - Liquidation + - VaultLiquidation + - CollateralType + eventHandlers: + - event: PoolCreated(indexed uint128,indexed address,indexed address) + handler: handlePoolCreated + - event: PoolNameUpdated(indexed uint128,string,indexed address) + handler: handlePoolNameUpdated + - event: PoolOwnershipAccepted(indexed uint128,indexed address) + handler: handlePoolOwnershipAccepted + - event: PoolNominationRenounced(indexed uint128,indexed address) + handler: handlePoolNominationRenounced + - event: PoolNominationRevoked(indexed uint128,indexed address) + handler: handlePoolNominationRevoked + - event: PoolOwnerNominated(indexed uint128,indexed address,indexed address) + handler: handlePoolOwnerNominated + - event: + PoolConfigurationSet(indexed uint128,(uint128,uint128,int128)[],indexed + address) + handler: handlePoolConfigurationSet + - event: MarketRegistered(indexed address,indexed uint128,indexed address) + handler: handleMarketCreated + - event: + MarketUsdDeposited(indexed uint128,indexed address,uint256,indexed + address) + handler: handleMarketUsdDeposited + - event: + MarketUsdWithdrawn(indexed uint128,indexed address,uint256,indexed + address) + handler: handleMarketUsdWithdrawn + - event: Deposited(indexed uint128,indexed address,uint256,indexed address) + handler: handleCollateralDeposited + - event: Withdrawn(indexed uint128,indexed address,uint256,indexed address) + handler: handleCollateralWithdrawn + - event: AccountCreated(indexed uint128,indexed address) + handler: handleAccountCreated + - event: PermissionGranted(indexed uint128,indexed bytes32,indexed + address,address) + handler: handlePermissionGranted + - event: PermissionRevoked(indexed uint128,indexed bytes32,indexed + address,address) + handler: handlePermissionRevoked + - event: DelegationUpdated(indexed uint128,indexed + uint128,address,uint256,uint256,indexed address) + handler: handleDelegationUpdated + - event: + UsdMinted(indexed uint128,indexed uint128,address,uint256,indexed + address) + handler: handleUSDMinted + - event: + UsdBurned(indexed uint128,indexed uint128,address,uint256,indexed + address) + handler: handleUSDBurned + - event: RewardsDistributed(indexed uint128,indexed + address,address,uint256,uint256,uint256) + handler: handleRewardsDistributed + - event: RewardsClaimed(indexed uint128,indexed uint128,indexed + address,address,uint256) + handler: handleRewardsClaimed + - event: + RewardsDistributorRegistered(indexed uint128,indexed address,indexed + address) + handler: handleRewardsDistributorRegistered + - event: Liquidation(indexed uint128,indexed uint128,indexed + address,(uint256,uint256,uint256),uint128,address) + handler: handleLiquidation + - event: VaultLiquidation(indexed uint128,indexed + address,(uint256,uint256,uint256),uint128,address) + handler: handleVaultLiquidation + - event: CollateralConfigured(indexed + address,(bool,uint256,uint256,uint256,bytes32,address,uint256)) + handler: handleCollateralConfigured diff --git a/protocol/synthetix/subgraph/subgraph.base-goerli.yaml b/protocol/synthetix/subgraph/subgraph.base-goerli.yaml new file mode 100644 index 0000000000..5052396c14 --- /dev/null +++ b/protocol/synthetix/subgraph/subgraph.base-goerli.yaml @@ -0,0 +1,104 @@ +specVersion: 0.0.4 +schema: + file: ./base-goerli/schema.graphql +dataSources: + - kind: ethereum + network: base-testnet + name: CoreProxy + source: + abi: CoreProxy + address: "0x76490713314fCEC173f44e99346F54c6e92a8E42" + startBlock: 3109083 + mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + file: ./base-goerli/index.ts + abis: + - name: CoreProxy + file: ./base-goerli/deployments/CoreProxy.json + entities: + - PoolModule + - MarketManagerModule + - CollateralType + - AccountModule + - AccountPermissionUsers + - VaultModule + - Position + - IssueUSDModule + - RewardsClaimed + - RewardsDistribution + - AccountRewardsDistributor + - RewardsDistributor + - Liquidation + - VaultLiquidation + - CollateralType + eventHandlers: + - event: PoolCreated(indexed uint128,indexed address,indexed address) + handler: handlePoolCreated + - event: PoolNameUpdated(indexed uint128,string,indexed address) + handler: handlePoolNameUpdated + - event: PoolOwnershipAccepted(indexed uint128,indexed address) + handler: handlePoolOwnershipAccepted + - event: PoolNominationRenounced(indexed uint128,indexed address) + handler: handlePoolNominationRenounced + - event: PoolNominationRevoked(indexed uint128,indexed address) + handler: handlePoolNominationRevoked + - event: PoolOwnerNominated(indexed uint128,indexed address,indexed address) + handler: handlePoolOwnerNominated + - event: + PoolConfigurationSet(indexed uint128,(uint128,uint128,int128)[],indexed + address) + handler: handlePoolConfigurationSet + - event: MarketRegistered(indexed address,indexed uint128,indexed address) + handler: handleMarketCreated + - event: + MarketUsdDeposited(indexed uint128,indexed address,uint256,indexed + address) + handler: handleMarketUsdDeposited + - event: + MarketUsdWithdrawn(indexed uint128,indexed address,uint256,indexed + address) + handler: handleMarketUsdWithdrawn + - event: Deposited(indexed uint128,indexed address,uint256,indexed address) + handler: handleCollateralDeposited + - event: Withdrawn(indexed uint128,indexed address,uint256,indexed address) + handler: handleCollateralWithdrawn + - event: AccountCreated(indexed uint128,indexed address) + handler: handleAccountCreated + - event: PermissionGranted(indexed uint128,indexed bytes32,indexed + address,address) + handler: handlePermissionGranted + - event: PermissionRevoked(indexed uint128,indexed bytes32,indexed + address,address) + handler: handlePermissionRevoked + - event: DelegationUpdated(indexed uint128,indexed + uint128,address,uint256,uint256,indexed address) + handler: handleDelegationUpdated + - event: + UsdMinted(indexed uint128,indexed uint128,address,uint256,indexed + address) + handler: handleUSDMinted + - event: + UsdBurned(indexed uint128,indexed uint128,address,uint256,indexed + address) + handler: handleUSDBurned + - event: RewardsDistributed(indexed uint128,indexed + address,address,uint256,uint256,uint256) + handler: handleRewardsDistributed + - event: RewardsClaimed(indexed uint128,indexed uint128,indexed + address,address,uint256) + handler: handleRewardsClaimed + - event: + RewardsDistributorRegistered(indexed uint128,indexed address,indexed + address) + handler: handleRewardsDistributorRegistered + - event: Liquidation(indexed uint128,indexed uint128,indexed + address,(uint256,uint256,uint256),uint128,address) + handler: handleLiquidation + - event: VaultLiquidation(indexed uint128,indexed + address,(uint256,uint256,uint256),uint128,address) + handler: handleVaultLiquidation + - event: CollateralConfigured(indexed + address,(bool,uint256,uint256,uint256,bytes32,address,uint256)) + handler: handleCollateralConfigured diff --git a/protocol/synthetix/subgraph/subgraph.goerli.yaml b/protocol/synthetix/subgraph/subgraph.goerli.yaml index beaa5a7e6d..c979650ee1 100644 --- a/protocol/synthetix/subgraph/subgraph.goerli.yaml +++ b/protocol/synthetix/subgraph/subgraph.goerli.yaml @@ -16,7 +16,7 @@ dataSources: file: ./goerli/index.ts abis: - name: CoreProxy - file: ./deployments/goerli/CoreProxy.json + file: ./goerli/deployments/CoreProxy.json entities: - PoolModule - MarketManagerModule @@ -46,15 +46,18 @@ dataSources: handler: handlePoolNominationRevoked - event: PoolOwnerNominated(indexed uint128,indexed address,indexed address) handler: handlePoolOwnerNominated - - event: PoolConfigurationSet(indexed uint128,(uint128,uint128,int128)[],indexed + - event: + PoolConfigurationSet(indexed uint128,(uint128,uint128,int128)[],indexed address) handler: handlePoolConfigurationSet - event: MarketRegistered(indexed address,indexed uint128,indexed address) handler: handleMarketCreated - - event: MarketUsdDeposited(indexed uint128,indexed address,uint256,indexed + - event: + MarketUsdDeposited(indexed uint128,indexed address,uint256,indexed address) handler: handleMarketUsdDeposited - - event: MarketUsdWithdrawn(indexed uint128,indexed address,uint256,indexed + - event: + MarketUsdWithdrawn(indexed uint128,indexed address,uint256,indexed address) handler: handleMarketUsdWithdrawn - event: Deposited(indexed uint128,indexed address,uint256,indexed address) @@ -72,10 +75,12 @@ dataSources: - event: DelegationUpdated(indexed uint128,indexed uint128,address,uint256,uint256,indexed address) handler: handleDelegationUpdated - - event: UsdMinted(indexed uint128,indexed uint128,address,uint256,indexed + - event: + UsdMinted(indexed uint128,indexed uint128,address,uint256,indexed address) handler: handleUSDMinted - - event: UsdBurned(indexed uint128,indexed uint128,address,uint256,indexed + - event: + UsdBurned(indexed uint128,indexed uint128,address,uint256,indexed address) handler: handleUSDBurned - event: RewardsDistributed(indexed uint128,indexed @@ -84,7 +89,8 @@ dataSources: - event: RewardsClaimed(indexed uint128,indexed uint128,indexed address,address,uint256) handler: handleRewardsClaimed - - event: RewardsDistributorRegistered(indexed uint128,indexed address,indexed + - event: + RewardsDistributorRegistered(indexed uint128,indexed address,indexed address) handler: handleRewardsDistributorRegistered - event: Liquidation(indexed uint128,indexed uint128,indexed diff --git a/protocol/synthetix/subgraph/subgraph.mainnet.yaml b/protocol/synthetix/subgraph/subgraph.mainnet.yaml index f6faa89db6..bc16d2f45a 100644 --- a/protocol/synthetix/subgraph/subgraph.mainnet.yaml +++ b/protocol/synthetix/subgraph/subgraph.mainnet.yaml @@ -16,7 +16,7 @@ dataSources: file: ./mainnet/index.ts abis: - name: CoreProxy - file: ./deployments/mainnet/CoreProxy.json + file: ./mainnet/deployments/CoreProxy.json entities: - PoolModule - MarketManagerModule @@ -46,15 +46,18 @@ dataSources: handler: handlePoolNominationRevoked - event: PoolOwnerNominated(indexed uint128,indexed address,indexed address) handler: handlePoolOwnerNominated - - event: PoolConfigurationSet(indexed uint128,(uint128,uint128,int128)[],indexed + - event: + PoolConfigurationSet(indexed uint128,(uint128,uint128,int128)[],indexed address) handler: handlePoolConfigurationSet - event: MarketRegistered(indexed address,indexed uint128,indexed address) handler: handleMarketCreated - - event: MarketUsdDeposited(indexed uint128,indexed address,uint256,indexed + - event: + MarketUsdDeposited(indexed uint128,indexed address,uint256,indexed address) handler: handleMarketUsdDeposited - - event: MarketUsdWithdrawn(indexed uint128,indexed address,uint256,indexed + - event: + MarketUsdWithdrawn(indexed uint128,indexed address,uint256,indexed address) handler: handleMarketUsdWithdrawn - event: Deposited(indexed uint128,indexed address,uint256,indexed address) @@ -72,10 +75,12 @@ dataSources: - event: DelegationUpdated(indexed uint128,indexed uint128,address,uint256,uint256,indexed address) handler: handleDelegationUpdated - - event: UsdMinted(indexed uint128,indexed uint128,address,uint256,indexed + - event: + UsdMinted(indexed uint128,indexed uint128,address,uint256,indexed address) handler: handleUSDMinted - - event: UsdBurned(indexed uint128,indexed uint128,address,uint256,indexed + - event: + UsdBurned(indexed uint128,indexed uint128,address,uint256,indexed address) handler: handleUSDBurned - event: RewardsDistributed(indexed uint128,indexed @@ -84,7 +89,8 @@ dataSources: - event: RewardsClaimed(indexed uint128,indexed uint128,indexed address,address,uint256) handler: handleRewardsClaimed - - event: RewardsDistributorRegistered(indexed uint128,indexed address,indexed + - event: + RewardsDistributorRegistered(indexed uint128,indexed address,indexed address) handler: handleRewardsDistributorRegistered - event: Liquidation(indexed uint128,indexed uint128,indexed diff --git a/protocol/synthetix/subgraph/subgraph.optimism-mainnet.yaml b/protocol/synthetix/subgraph/subgraph.optimism-mainnet.yaml index 69141d7553..ed13a6bcf1 100644 --- a/protocol/synthetix/subgraph/subgraph.optimism-mainnet.yaml +++ b/protocol/synthetix/subgraph/subgraph.optimism-mainnet.yaml @@ -16,7 +16,7 @@ dataSources: file: ./optimism-mainnet/index.ts abis: - name: CoreProxy - file: ./deployments/optimism-mainnet/CoreProxy.json + file: ./optimism-mainnet/deployments/CoreProxy.json entities: - PoolModule - MarketManagerModule @@ -46,15 +46,18 @@ dataSources: handler: handlePoolNominationRevoked - event: PoolOwnerNominated(indexed uint128,indexed address,indexed address) handler: handlePoolOwnerNominated - - event: PoolConfigurationSet(indexed uint128,(uint128,uint128,int128)[],indexed + - event: + PoolConfigurationSet(indexed uint128,(uint128,uint128,int128)[],indexed address) handler: handlePoolConfigurationSet - event: MarketRegistered(indexed address,indexed uint128,indexed address) handler: handleMarketCreated - - event: MarketUsdDeposited(indexed uint128,indexed address,uint256,indexed + - event: + MarketUsdDeposited(indexed uint128,indexed address,uint256,indexed address) handler: handleMarketUsdDeposited - - event: MarketUsdWithdrawn(indexed uint128,indexed address,uint256,indexed + - event: + MarketUsdWithdrawn(indexed uint128,indexed address,uint256,indexed address) handler: handleMarketUsdWithdrawn - event: Deposited(indexed uint128,indexed address,uint256,indexed address) @@ -72,10 +75,12 @@ dataSources: - event: DelegationUpdated(indexed uint128,indexed uint128,address,uint256,uint256,indexed address) handler: handleDelegationUpdated - - event: UsdMinted(indexed uint128,indexed uint128,address,uint256,indexed + - event: + UsdMinted(indexed uint128,indexed uint128,address,uint256,indexed address) handler: handleUSDMinted - - event: UsdBurned(indexed uint128,indexed uint128,address,uint256,indexed + - event: + UsdBurned(indexed uint128,indexed uint128,address,uint256,indexed address) handler: handleUSDBurned - event: RewardsDistributed(indexed uint128,indexed @@ -84,7 +89,8 @@ dataSources: - event: RewardsClaimed(indexed uint128,indexed uint128,indexed address,address,uint256) handler: handleRewardsClaimed - - event: RewardsDistributorRegistered(indexed uint128,indexed address,indexed + - event: + RewardsDistributorRegistered(indexed uint128,indexed address,indexed address) handler: handleRewardsDistributorRegistered - event: Liquidation(indexed uint128,indexed uint128,indexed diff --git a/protocol/synthetix/subgraph/tests/CoreProxy.test.ts b/protocol/synthetix/subgraph/tests/CoreProxy.test.ts index 2a803dd2e6..54e98f9857 100644 --- a/protocol/synthetix/subgraph/tests/CoreProxy.test.ts +++ b/protocol/synthetix/subgraph/tests/CoreProxy.test.ts @@ -1,4 +1,4 @@ -import { beforeEach, clearStore, describe, test } from 'matchstick-as'; +import { afterEach, beforeEach, clearStore, describe, logStore, test } from 'matchstick-as'; import handleAccountCreatedTest from './handleAccountCreated'; import handleCollateralConfiguredTest from './handleCollateralConfigured'; @@ -32,6 +32,10 @@ describe('CoreProxy', () => { clearStore(); }); + afterEach(() => { + logStore(); + }); + test('handleAccountCreated', handleAccountCreatedTest); test('handleCollateralConfigured', handleCollateralConfiguredTest); test('handleCollateralDeposit', handleCollateralDepositTest); diff --git a/protocol/synthetix/subgraph/tests/event-factories.ts b/protocol/synthetix/subgraph/tests/event-factories.ts index 28fb89cea7..5b20d20d54 100644 --- a/protocol/synthetix/subgraph/tests/event-factories.ts +++ b/protocol/synthetix/subgraph/tests/event-factories.ts @@ -1,5 +1,5 @@ import { Address, BigInt, Bytes, ethereum } from '@graphprotocol/graph-ts'; -import { newMockEvent } from 'matchstick-as'; +import { newTypedMockEvent } from 'matchstick-as'; import { AccountCreated, CollateralConfigured, @@ -41,7 +41,7 @@ export function createPoolCreatedEvent( timestamp: i64, blockNumber: i64 ): PoolCreated { - const newPoolCreatedEvent = changetype(newMockEvent()); + const newPoolCreatedEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newPoolCreatedEvent.parameters = []; newPoolCreatedEvent.parameters.push(new ethereum.EventParam('id', ethereum.Value.fromI32(id))); @@ -60,7 +60,7 @@ export function createPoolOwnerNominatedEvent( timestamp: i64, blockNumber: i64 ): PoolOwnerNominated { - const newCreateNominatedPoolOwnerEvent = changetype(newMockEvent()); + const newCreateNominatedPoolOwnerEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newCreateNominatedPoolOwnerEvent.parameters = []; newCreateNominatedPoolOwnerEvent.parameters.push( @@ -86,7 +86,7 @@ export function createPoolNameUpdatedEvent( timestamp: i64, blockNumber: i64 ): PoolNameUpdated { - const newPoolNameUpdatedEvent = changetype(newMockEvent()); + const newPoolNameUpdatedEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newPoolNameUpdatedEvent.parameters = []; newPoolNameUpdatedEvent.parameters.push( @@ -106,7 +106,7 @@ export function createPoolOwnershipAcceptedEvent( timestamp: i64, blockNumber: i64 ): PoolOwnershipAccepted { - const newPoolOwnershipAcceptedEvent = changetype(newMockEvent()); + const newPoolOwnershipAcceptedEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newPoolOwnershipAcceptedEvent.parameters = []; newPoolOwnershipAcceptedEvent.parameters.push( @@ -125,7 +125,7 @@ export function createPoolNominationRevokedEvent( timestamp: i64, blockNumber: i64 ): PoolNominationRevoked { - const newPoolNominationRevokedEvent = changetype(newMockEvent()); + const newPoolNominationRevokedEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newPoolNominationRevokedEvent.parameters = []; newPoolNominationRevokedEvent.parameters.push( @@ -141,7 +141,7 @@ export function createPoolOwnershipRenouncedEvent( timestamp: i64, blockNumber: i64 ): PoolNominationRenounced { - const newPoolOwnerNominationRenouncedEvent = changetype(newMockEvent()); + const newPoolOwnerNominationRenouncedEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newPoolOwnerNominationRenouncedEvent.parameters = []; newPoolOwnerNominationRenouncedEvent.parameters.push( @@ -158,7 +158,7 @@ export function createMarketCreatedEvent( timestamp: i64, blockNumber: i64 ): MarketRegistered { - const newMarketRegisteredEvent = changetype(newMockEvent()); + const newMarketRegisteredEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newMarketRegisteredEvent.parameters = []; newMarketRegisteredEvent.parameters.push( @@ -178,7 +178,7 @@ export function createAccountCreatedEvent( timestamp: i64, blockNumber: i64 ): AccountCreated { - const newMarketRegisteredEvent = changetype(newMockEvent()); + const newMarketRegisteredEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newMarketRegisteredEvent.parameters = []; @@ -199,7 +199,7 @@ export function createPoolConfigurationSetEvent( timestamp: i64, blockNumber: i64 ): PoolConfigurationSet { - const newMarketRegisteredEvent = changetype(newMockEvent()); + const newMarketRegisteredEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newMarketRegisteredEvent.parameters = []; newMarketRegisteredEvent.parameters.push( @@ -221,7 +221,7 @@ export function createMarketUsdDepositedEvent( timestamp: i64, blockNumber: i64 ): MarketUsdDeposited { - const newUsdMintedEvent = changetype(newMockEvent()); + const newUsdMintedEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newUsdMintedEvent.parameters = []; newUsdMintedEvent.parameters.push( @@ -245,7 +245,7 @@ export function createMarketUsdWithdrawnEvent( timestamp: i64, blockNumber: i64 ): MarketUsdWithdrawn { - const newUsdWithdrawnEvent = changetype(newMockEvent()); + const newUsdWithdrawnEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newUsdWithdrawnEvent.parameters = []; newUsdWithdrawnEvent.parameters.push( @@ -273,7 +273,7 @@ export function createCollateralConfiguredEvent( timestamp: i64, blockNumber: i64 ): CollateralConfigured { - const newUsdWithdrawnEvent = changetype(newMockEvent()); + const newUsdWithdrawnEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newUsdWithdrawnEvent.parameters = []; newUsdWithdrawnEvent.parameters.push( @@ -303,7 +303,7 @@ export function createDepositEvent( timestamp: i64, blockNumber: i64 ): Deposited { - const newUsdWithdrawnEvent = changetype(newMockEvent()); + const newUsdWithdrawnEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newUsdWithdrawnEvent.parameters = []; newUsdWithdrawnEvent.parameters.push( @@ -327,7 +327,7 @@ export function createWithdrawnEvent( timestamp: i64, blockNumber: i64 ): Withdrawn { - const newUsdWithdrawnEvent = changetype(newMockEvent()); + const newUsdWithdrawnEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newUsdWithdrawnEvent.parameters = []; newUsdWithdrawnEvent.parameters.push( @@ -351,7 +351,7 @@ export function createPermissionGrantedEvent( timestamp: i64, blockNumber: i64 ): PermissionGranted { - const newUsdWithdrawnEvent = changetype(newMockEvent()); + const newUsdWithdrawnEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newUsdWithdrawnEvent.parameters = []; newUsdWithdrawnEvent.parameters.push( @@ -375,7 +375,7 @@ export function createPermissionRevokedEvent( timestamp: i64, blockNumber: i64 ): PermissionRevoked { - const newUsdWithdrawnEvent = changetype(newMockEvent()); + const newUsdWithdrawnEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newUsdWithdrawnEvent.parameters = []; newUsdWithdrawnEvent.parameters.push( @@ -401,7 +401,7 @@ export function createDelegationUpdateEvent( timestamp: i64, blockNumber: i64 ): DelegationUpdated { - const newDelegationUpdatedEvent = changetype(newMockEvent()); + const newDelegationUpdatedEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newDelegationUpdatedEvent.parameters = []; newDelegationUpdatedEvent.parameters.push( @@ -432,7 +432,7 @@ export function createUSDMintedEvent( timestamp: i64, blockNumber: i64 ): UsdMinted { - const newUSDMintedEvent = changetype(newMockEvent()); + const newUSDMintedEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newUSDMintedEvent.parameters = []; newUSDMintedEvent.parameters.push( @@ -460,7 +460,7 @@ export function createUSDBurnedEvent( timestamp: i64, blockNumber: i64 ): UsdBurned { - const newUSDBurnedEvent = changetype(newMockEvent()); + const newUSDBurnedEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newUSDBurnedEvent.parameters = []; newUSDBurnedEvent.parameters.push( @@ -487,9 +487,7 @@ export function createRewardsDistributorRegisteredEvent( timestamp: i64, blockNumber: i64 ): RewardsDistributorRegistered { - const newRewardsDistributorRegisteredEvent = changetype( - newMockEvent() - ); + const newRewardsDistributorRegisteredEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newRewardsDistributorRegisteredEvent.parameters = []; newRewardsDistributorRegisteredEvent.parameters.push( @@ -517,7 +515,7 @@ export function createRewardsDistributedEvent( blockNumber: i64, logIndex: i32 = 1 ): RewardsDistributed { - const newRewardsDistributedEvent = changetype(newMockEvent()); + const newRewardsDistributedEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newRewardsDistributedEvent.logIndex = BigInt.fromI32(logIndex); newRewardsDistributedEvent.parameters = []; @@ -554,7 +552,7 @@ export function createRewardsClaimedEvent( blockNumber: i64, logIndex: i32 = 1 ): RewardsClaimed { - const newRewardsClaimedEvent = changetype(newMockEvent()); + const newRewardsClaimedEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newRewardsClaimedEvent.logIndex = BigInt.fromI32(logIndex); newRewardsClaimedEvent.parameters = []; @@ -591,7 +589,7 @@ export function createLiquidationEvent( blockNumber: i64, logIndex: i32 = 1 ): Liquidation { - const newLiquidatedEvent = changetype(newMockEvent()); + const newLiquidatedEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newLiquidatedEvent.logIndex = BigInt.fromI32(logIndex); newLiquidatedEvent.parameters = []; @@ -638,7 +636,7 @@ export function createVaultLiquidationEvent( blockNumber: i64, logIndex: i32 = 1 ): VaultLiquidation { - const newVaultLiquidationEvent = changetype(newMockEvent()); + const newVaultLiquidationEvent = newTypedMockEvent(); const block = createBlock(timestamp, blockNumber); newVaultLiquidationEvent.logIndex = BigInt.fromI32(logIndex); newVaultLiquidationEvent.parameters = []; diff --git a/protocol/synthetix/test/common/stakedPool.ts b/protocol/synthetix/test/common/stakedPool.ts index 33d55afd7e..2faab86cf5 100644 --- a/protocol/synthetix/test/common/stakedPool.ts +++ b/protocol/synthetix/test/common/stakedPool.ts @@ -38,17 +38,15 @@ export const createStakedPool = ( before('configure collateral', async () => { // add collateral - await ( - await r.systems().Core.connect(r.owner()).configureCollateral({ - tokenAddress: r.systems().CollateralMock.address, - oracleNodeId, - issuanceRatioD18: '5000000000000000000', - liquidationRatioD18: '1500000000000000000', - liquidationRewardD18: '20000000000000000000', - minDelegationD18: '20000000000000000000', - depositingEnabled: true, - }) - ).wait(); + await r.systems().Core.connect(r.owner()).configureCollateral({ + tokenAddress: r.systems().CollateralMock.address, + oracleNodeId, + issuanceRatioD18: '5000000000000000000', + liquidationRatioD18: '1500000000000000000', + liquidationRewardD18: '20000000000000000000', + minDelegationD18: '20000000000000000000', + depositingEnabled: true, + }); }); before('create pool', async () => { diff --git a/protocol/synthetix/test/common/stakers.ts b/protocol/synthetix/test/common/stakers.ts index 61b5bd07d6..e9ef9d3c68 100644 --- a/protocol/synthetix/test/common/stakers.ts +++ b/protocol/synthetix/test/common/stakers.ts @@ -36,12 +36,21 @@ export function bootstrapStakers( await systems() .Core.connect(staker1) .mintUsd(1000, 2, collateralAddress, delegateAmount.mul(200)); + await systems() + .Core.connect(staker1) + .withdraw(1000, await systems().Core.getUsdToken(), delegateAmount.mul(200)); await systems() .Core.connect(staker2) .mintUsd(1001, 2, collateralAddress, delegateAmount.mul(200)); + await systems() + .Core.connect(staker2) + .withdraw(1001, await systems().Core.getUsdToken(), delegateAmount.mul(200)); await systems() .Core.connect(staker3) .mintUsd(1002, 2, collateralAddress, delegateAmount.mul(200)); + await systems() + .Core.connect(staker3) + .withdraw(1002, await systems().Core.getUsdToken(), delegateAmount.mul(200)); }); } @@ -59,10 +68,10 @@ export const stake = async ( await Core.connect(user)['createAccount(uint128)'](accountId); // approve - await CollateralMock.connect(user).approve(Core.address, delegateAmount.mul(10)); + await CollateralMock.connect(user).approve(Core.address, delegateAmount.mul(300)); // stake collateral - await Core.connect(user).deposit(accountId, CollateralMock.address, delegateAmount.mul(10)); + await Core.connect(user).deposit(accountId, CollateralMock.address, delegateAmount.mul(300)); // invest in the pool await Core.connect(user).delegateCollateral( diff --git a/protocol/synthetix/test/integration/bootstrap.ts b/protocol/synthetix/test/integration/bootstrap.ts index f240351779..d60188e094 100644 --- a/protocol/synthetix/test/integration/bootstrap.ts +++ b/protocol/synthetix/test/integration/bootstrap.ts @@ -1,13 +1,13 @@ import { snapshotCheckpoint } from '@synthetixio/core-utils/utils/mocha/snapshot'; import { Proxy as OracleManagerProxy } from '@synthetixio/oracle-manager/test/generated/typechain'; -import { coreBootstrap } from '@synthetixio/router/dist/utils/tests'; +import { coreBootstrap } from '@synthetixio/router/utils/tests'; import { wei } from '@synthetixio/wei'; import { ethers } from 'ethers'; import hre from 'hardhat'; -import type { AccountProxy, CoreProxy, USDProxy, CollateralMock } from '../generated/typechain'; import { MockMarket } from '../../typechain-types'; import { createStakedPool } from '../common'; +import type { AccountProxy, CoreProxy, USDProxy, CollateralMock } from '../generated/typechain'; const MARKET_FEATURE_FLAG = ethers.utils.formatBytes32String('registerMarket'); export interface Proxies { @@ -107,6 +107,14 @@ export function bootstrapWithMockMarketAndPool() { maxDebtShareValueD18: ethers.utils.parseEther('1'), }, ]); + + await r + .systems() + .Core.connect(owner) + .setPoolCollateralConfiguration(r.poolId, r.collateralAddress(), { + collateralLimitD18: bn(1000000000), + issuanceRatioD18: bn(1), + }); }); const restore = snapshotCheckpoint(r.provider); diff --git a/protocol/synthetix/test/integration/mixins/AccountRBACMixin.permissions.ts b/protocol/synthetix/test/integration/mixins/AccountRBACMixin.permissions.ts index bfd32eabd4..368e589c59 100644 --- a/protocol/synthetix/test/integration/mixins/AccountRBACMixin.permissions.ts +++ b/protocol/synthetix/test/integration/mixins/AccountRBACMixin.permissions.ts @@ -6,4 +6,5 @@ export default { MINT: ethers.utils.formatBytes32String('MINT'), DELEGATE: ethers.utils.formatBytes32String('DELEGATE'), REWARDS: ethers.utils.formatBytes32String('REWARDS'), + BURN: ethers.utils.formatBytes32String('BURN'), }; diff --git a/protocol/synthetix/test/integration/modules/core/CollateralConfigurationModule/CollateralConfigurationModule.config.test.ts b/protocol/synthetix/test/integration/modules/core/CollateralConfigurationModule/CollateralConfigurationModule.config.test.ts index 5312ace9f5..24b4c3eb62 100644 --- a/protocol/synthetix/test/integration/modules/core/CollateralConfigurationModule/CollateralConfigurationModule.config.test.ts +++ b/protocol/synthetix/test/integration/modules/core/CollateralConfigurationModule/CollateralConfigurationModule.config.test.ts @@ -1,21 +1,24 @@ import assertRevert from '@synthetixio/core-utils/utils/assertions/assert-revert'; import { ethers as Ethers } from 'ethers'; -import { bootstrap } from '../../../bootstrap'; +import { bn, bootstrap } from '../../../bootstrap'; import { addCollateral, verifyCollateral, verifyCollateralListed, } from '../CollateralModule/CollateralModule.helper'; import assertBn from '@synthetixio/core-utils/utils/assertions/assert-bignumber'; +import { snapshotCheckpoint } from '@synthetixio/core-utils/utils/mocha/snapshot'; describe('CollateralModule', function () { - const { signers, systems } = bootstrap(); + const { signers, systems, provider } = bootstrap(); let systemOwner: Ethers.Signer, user1: Ethers.Signer, collateralPrice: number; let Collateral: Ethers.Contract, AnotherCollateral: Ethers.Contract; let oracleNodeId: string, oracleNodeId2: string; + const restore = snapshotCheckpoint(provider); + describe('CollateralModule - Collateral configuration', function () { before('identify signers', async () => { [systemOwner, user1] = signers(); @@ -26,8 +29,8 @@ describe('CollateralModule', function () { ({ Collateral, oracleNodeId, collateralPrice } = await addCollateral( 'Synthetix Token', 'SNX', - 400, - 200, + bn(4), + bn(2), systemOwner, systems().Core, systems().OracleManager @@ -35,7 +38,7 @@ describe('CollateralModule', function () { }); it('is well configured', async () => { - await verifyCollateral(1, Collateral, oracleNodeId, 400, 200, true, systems().Core); + await verifyCollateral(1, Collateral, oracleNodeId, bn(4), bn(2), true, systems().Core); }); it('shows in the collateral list', async function () { @@ -47,8 +50,8 @@ describe('CollateralModule', function () { ({ Collateral: AnotherCollateral, oracleNodeId: oracleNodeId2 } = await addCollateral( 'Another Token', 'ANT', - 400, - 200, + bn(4), + bn(2), systemOwner, systems().Core, systems().OracleManager @@ -60,8 +63,8 @@ describe('CollateralModule', function () { 2, AnotherCollateral, oracleNodeId2, - 400, - 200, + bn(4), + bn(2), true, systems().Core ); @@ -74,15 +77,17 @@ describe('CollateralModule', function () { describe('when a regular user attempts to update the second collateral', function () { it('reverts', async () => { await assertRevert( - systems().Core.connect(user1).configureCollateral({ - tokenAddress: AnotherCollateral.address, - oracleNodeId: oracleNodeId2, - issuanceRatioD18: 200, - liquidationRatioD18: 100, - liquidationRewardD18: 0, - minDelegationD18: 0, - depositingEnabled: false, - }), + systems() + .Core.connect(user1) + .configureCollateral({ + tokenAddress: AnotherCollateral.address, + oracleNodeId: oracleNodeId2, + issuanceRatioD18: bn(2), + liquidationRatioD18: bn(1), + liquidationRewardD18: 0, + minDelegationD18: 0, + depositingEnabled: false, + }), `Unauthorized("${await user1.getAddress()}")`, systems().Core ); @@ -91,15 +96,17 @@ describe('CollateralModule', function () { describe('when the second collateral is updated', () => { before('update the collateral', async () => { - const tx = await systems().Core.connect(systemOwner).configureCollateral({ - tokenAddress: AnotherCollateral.address, - oracleNodeId: oracleNodeId2, - issuanceRatioD18: 300, - liquidationRatioD18: 250, - liquidationRewardD18: 0, - minDelegationD18: 0, - depositingEnabled: true, - }); + const tx = await systems() + .Core.connect(systemOwner) + .configureCollateral({ + tokenAddress: AnotherCollateral.address, + oracleNodeId: oracleNodeId2, + issuanceRatioD18: bn(3), + liquidationRatioD18: bn(2.5), + liquidationRewardD18: 0, + minDelegationD18: 0, + depositingEnabled: true, + }); await tx.wait(); }); @@ -108,8 +115,8 @@ describe('CollateralModule', function () { 2, AnotherCollateral, oracleNodeId2, - 300, - 250, + bn(3), + bn(2.5), true, systems().Core ); @@ -122,15 +129,17 @@ describe('CollateralModule', function () { describe('when the second collateral is disabled', () => { before('disable the collateral', async () => { - const tx = await systems().Core.connect(systemOwner).configureCollateral({ - tokenAddress: AnotherCollateral.address, - oracleNodeId: oracleNodeId2, - issuanceRatioD18: 300, - liquidationRatioD18: 250, - liquidationRewardD18: 0, - minDelegationD18: 0, - depositingEnabled: false, - }); + const tx = await systems() + .Core.connect(systemOwner) + .configureCollateral({ + tokenAddress: AnotherCollateral.address, + oracleNodeId: oracleNodeId2, + issuanceRatioD18: bn(3), + liquidationRatioD18: bn(2.5), + liquidationRewardD18: 0, + minDelegationD18: 0, + depositingEnabled: false, + }); await tx.wait(); }); @@ -139,8 +148,8 @@ describe('CollateralModule', function () { 2, AnotherCollateral, oracleNodeId2, - 300, - 250, + bn(3), + bn(2.5), false, systems().Core ); @@ -166,19 +175,76 @@ describe('CollateralModule', function () { const dummyAddress = await user1.getAddress(); await assertRevert( - systems().Core.connect(user1).configureCollateral({ - tokenAddress: dummyAddress, - oracleNodeId: oracleNodeId2, - issuanceRatioD18: 400, - liquidationRatioD18: 200, - liquidationRewardD18: 0, - minDelegationD18: 0, - depositingEnabled: false, - }), + systems() + .Core.connect(user1) + .configureCollateral({ + tokenAddress: dummyAddress, + oracleNodeId: oracleNodeId2, + issuanceRatioD18: bn(4), + liquidationRatioD18: bn(2), + liquidationRewardD18: 0, + minDelegationD18: 0, + depositingEnabled: false, + }), `Unauthorized("${await user1.getAddress()}")`, systems().Core ); }); }); + + describe('fails at sanity checks', () => { + before(restore); + + it('issuanceRatioD18 is below 100%', async () => { + await assertRevert( + systems() + .Core.connect(systemOwner) + .configureCollateral({ + tokenAddress: AnotherCollateral.address, + oracleNodeId: oracleNodeId2, + issuanceRatioD18: bn(0.99), + liquidationRatioD18: bn(2.5), + liquidationRewardD18: 0, + minDelegationD18: 0, + depositingEnabled: false, + }), + 'InvalidParameter("issuanceRatioD18", "must be greater than 100%")' + ); + }); + + it('liquidationRatioD18 is below 100%', async () => { + await assertRevert( + systems() + .Core.connect(systemOwner) + .configureCollateral({ + tokenAddress: AnotherCollateral.address, + oracleNodeId: oracleNodeId2, + issuanceRatioD18: bn(2), + liquidationRatioD18: bn(0.99), + liquidationRewardD18: 0, + minDelegationD18: 0, + depositingEnabled: false, + }), + 'InvalidParameter("liquidationRatioD18", "must be greater than 100%")' + ); + }); + + it('issuanceRatioD18 is smaller than liquidationRatioD18', async () => { + await assertRevert( + systems() + .Core.connect(systemOwner) + .configureCollateral({ + tokenAddress: AnotherCollateral.address, + oracleNodeId: oracleNodeId2, + issuanceRatioD18: bn(2), + liquidationRatioD18: bn(2.5), + liquidationRewardD18: 0, + minDelegationD18: 0, + depositingEnabled: false, + }), + 'InvalidParameter("issuanceRatioD18", "must be greater than liquidationRatioD18")' + ); + }); + }); }); }); diff --git a/protocol/synthetix/test/integration/modules/core/CollateralModule/CollateralModule.access.test.ts b/protocol/synthetix/test/integration/modules/core/CollateralModule/CollateralModule.access.test.ts index 127e0f6b95..15b3c7ec63 100644 --- a/protocol/synthetix/test/integration/modules/core/CollateralModule/CollateralModule.access.test.ts +++ b/protocol/synthetix/test/integration/modules/core/CollateralModule/CollateralModule.access.test.ts @@ -3,7 +3,7 @@ import assertRevert from '@synthetixio/core-utils/utils/assertions/assert-revert import { ethers, Contract, Signer } from 'ethers'; import { addCollateral, verifyCollateral } from './CollateralModule.helper'; import Permissions from '../../../mixins/AccountRBACMixin.permissions'; -import { bootstrap } from '../../../bootstrap'; +import { bn, bootstrap } from '../../../bootstrap'; describe('CollateralModule', function () { const { signers, systems } = bootstrap(); @@ -30,8 +30,8 @@ describe('CollateralModule', function () { ({ Collateral, oracleNodeId } = await addCollateral( 'Synthetix Token', 'SNX', - 400, - 200, + bn(4), + bn(2), owner, systems().Core, systems().OracleManager @@ -39,7 +39,7 @@ describe('CollateralModule', function () { }); it('is well configured', async () => { - await verifyCollateral(1, Collateral, oracleNodeId, 400, 200, true, systems().Core); + await verifyCollateral(1, Collateral, oracleNodeId, bn(4), bn(2), true, systems().Core); }); describe('when accounts have tokens', function () { diff --git a/protocol/synthetix/test/integration/modules/core/CollateralModule/CollateralModule.deposit.test.ts b/protocol/synthetix/test/integration/modules/core/CollateralModule/CollateralModule.deposit.test.ts index 755d659b1d..94f1888f2d 100644 --- a/protocol/synthetix/test/integration/modules/core/CollateralModule/CollateralModule.deposit.test.ts +++ b/protocol/synthetix/test/integration/modules/core/CollateralModule/CollateralModule.deposit.test.ts @@ -5,7 +5,7 @@ import { fastForwardTo, getTime } from '@synthetixio/core-utils/utils/hardhat/rp import { snapshotCheckpoint } from '@synthetixio/core-utils/utils/mocha/snapshot'; import { ethers as Ethers } from 'ethers'; import { ethers } from 'hardhat'; -import { bootstrap } from '../../../bootstrap'; +import { bn, bootstrap } from '../../../bootstrap'; import { verifyUsesFeatureFlag } from '../../../verifications'; import { addCollateral, verifyCollateral } from './CollateralModule.helper'; @@ -33,8 +33,8 @@ describe('CollateralModule', function () { ({ Collateral, oracleNodeId } = await addCollateral( 'Synthetix Token', 'SNX', - 400, - 200, + bn(4), + bn(2), owner, systems().Core, systems().OracleManager @@ -42,7 +42,7 @@ describe('CollateralModule', function () { }); it('is well configured', async () => { - await verifyCollateral(1, Collateral, oracleNodeId, 400, 200, true, systems().Core); + await verifyCollateral(1, Collateral, oracleNodeId, bn(4), bn(2), true, systems().Core); }); describe('when accounts have tokens', function () { diff --git a/protocol/synthetix/test/integration/modules/core/CollateralModule/CollateralModule.helper.ts b/protocol/synthetix/test/integration/modules/core/CollateralModule/CollateralModule.helper.ts index 5cc00d2e4f..8d8ef0d182 100644 --- a/protocol/synthetix/test/integration/modules/core/CollateralModule/CollateralModule.helper.ts +++ b/protocol/synthetix/test/integration/modules/core/CollateralModule/CollateralModule.helper.ts @@ -1,5 +1,5 @@ import { ethers } from 'hardhat'; -import { ethers as Ethers } from 'ethers'; +import { BigNumberish, ethers as Ethers } from 'ethers'; import assert from 'assert/strict'; import assertBn from '@synthetixio/core-utils/utils/assertions/assert-bignumber'; import NodeTypes from '@synthetixio/oracle-manager/test/integration/mixins/Node.types'; @@ -7,8 +7,8 @@ import NodeTypes from '@synthetixio/oracle-manager/test/integration/mixins/Node. export async function addCollateral( tokenName: string, tokenSymbol: string, - issuanceRatio: number, - liquidationRatio: number, + issuanceRatio: BigNumberish, + liquidationRatio: BigNumberish, owner: Ethers.Signer, core: Ethers.Contract, oracleManager: Ethers.Contract @@ -53,8 +53,8 @@ export async function verifyCollateral( collateralIdx: number, Collateral: Ethers.Contract, oracleNodeId: string, - expectedIssuanceRatio: number, - expectedLiquidationRatio: number, + expectedIssuanceRatio: BigNumberish, + expectedLiquidationRatio: BigNumberish, expectedToBeEnabled: boolean, core: Ethers.Contract ) { diff --git a/protocol/synthetix/test/integration/modules/core/CollateralModule/CollateralModule.locks.test.ts b/protocol/synthetix/test/integration/modules/core/CollateralModule/CollateralModule.locks.test.ts index de0007e3f3..87bea5a6d3 100644 --- a/protocol/synthetix/test/integration/modules/core/CollateralModule/CollateralModule.locks.test.ts +++ b/protocol/synthetix/test/integration/modules/core/CollateralModule/CollateralModule.locks.test.ts @@ -53,19 +53,16 @@ describe('CollateralModule', function () { 0, // 0 is invalid for amount to lock 1234123412341 ), - 'InvalidParameter("amount"', + 'InvalidParameter("amount", "must be nonzero")', systems().Core ); }); it('fails when insufficient collateral in account to lock', async () => { await assertRevert( - systems().Core.connect(user1).createLock( - 1, - collateralAddress(), - depositAmount.mul(10).add(1), - 1234123412341 // timestamp is definitely in the past - ), + systems() + .Core.connect(user1) + .createLock(1, collateralAddress(), depositAmount.mul(1000).add(1), 1234123412341), 'InsufficientAccountCollateral(', systems().Core ); diff --git a/protocol/synthetix/test/integration/modules/core/CrossChainUSDModule.test.ts b/protocol/synthetix/test/integration/modules/core/CrossChainUSDModule.test.ts index af685824e8..bc79478fad 100644 --- a/protocol/synthetix/test/integration/modules/core/CrossChainUSDModule.test.ts +++ b/protocol/synthetix/test/integration/modules/core/CrossChainUSDModule.test.ts @@ -36,19 +36,15 @@ describe('CrossChainUSDModule', function () { ); }); - before('get some snxUSD', async () => { + before('mint some sUSD', async () => { await systems() .Core.connect(staker()) .mintUsd(accountId, poolId, collateralAddress(), oneHundredUSD); - - // await systems() - // .Core.connect(staker()) - // .withdraw(accountId, systems().USD.address, oneHundredUSD); }); before('record balances', async () => { stakerBalanceBefore = await systems().USD.connect(staker()).balanceOf(stakerAddress); - proxyBalanceBefore = await systems().USD.connect(staker()).balanceOf(systems().Core.address); + proxyBalanceBefore = await systems().USD.balanceOf(systems().Core.address); }); describe('transferCrossChain()', () => { @@ -67,7 +63,7 @@ describe('CrossChainUSDModule', function () { ); }); - it('reverts if the sender did not set enough allownce', async () => { + it('reverts if the sender did not set enough allowance', async () => { const allowance = await systems() .USD.connect(staker()) .allowance(stakerAddress, systems().Core.address); @@ -97,6 +93,9 @@ describe('CrossChainUSDModule', function () { let transferCrossChainTxn: ethers.providers.TransactionResponse; before('invokes transferCrossChain', async () => { + await systems() + .Core.connect(staker()) + .withdraw(accountId, await systems().Core.getUsdToken(), fiftyUSD); transferCrossChainTxn = await systems() .Core.connect(staker()) .transferCrossChain(1, fiftyUSD); @@ -106,12 +105,12 @@ describe('CrossChainUSDModule', function () { const usdBalanceAfter = await systems() .USD.connect(owner()) .balanceOf(systems().Core.address); - assertBn.equal(usdBalanceAfter, proxyBalanceBefore.add(fiftyUSD)); + assertBn.equal(usdBalanceAfter, proxyBalanceBefore); }); it('should decrease the stakers balance by the expected amount', async () => { const usdBalanceAfter = await systems().USD.connect(staker()).balanceOf(stakerAddress); - assertBn.equal(usdBalanceAfter, stakerBalanceBefore.sub(fiftyUSD)); + assertBn.equal(usdBalanceAfter, 0); }); it('emits correct event with the expected values', async () => { diff --git a/protocol/synthetix/test/integration/modules/core/IssueUSDModule.test.ts b/protocol/synthetix/test/integration/modules/core/IssueUSDModule.test.ts index ca7f7d57bd..e8b7baed0c 100644 --- a/protocol/synthetix/test/integration/modules/core/IssueUSDModule.test.ts +++ b/protocol/synthetix/test/integration/modules/core/IssueUSDModule.test.ts @@ -2,19 +2,27 @@ import assertBn from '@synthetixio/core-utils/utils/assertions/assert-bignumber' import assertRevert from '@synthetixio/core-utils/utils/assertions/assert-revert'; import assertEvent from '@synthetixio/core-utils/utils/assertions/assert-event'; import { snapshotCheckpoint } from '@synthetixio/core-utils/utils/mocha/snapshot'; -import { BigNumber, ethers } from 'ethers'; +import { BigNumber, constants, ethers } from 'ethers'; import hre from 'hardhat'; -import { bootstrapWithStakedPool } from '../../bootstrap'; +import { bn, bootstrapWithStakedPool } from '../../bootstrap'; import Permissions from '../../mixins/AccountRBACMixin.permissions'; import { verifyChecksCollateralEnabled, verifyUsesFeatureFlag } from '../../verifications'; const MARKET_FEATURE_FLAG = ethers.utils.formatBytes32String('registerMarket'); describe('IssueUSDModule', function () { - const { signers, systems, provider, accountId, poolId, depositAmount, collateralAddress } = - bootstrapWithStakedPool(); - - let owner: ethers.Signer, user1: ethers.Signer, user2: ethers.Signer; + const { + signers, + systems, + provider, + accountId, + poolId, + depositAmount, + collateralAddress, + collateralContract, + } = bootstrapWithStakedPool(); + + let owner: ethers.Signer, user1: ethers.Signer, user2: ethers.Signer, user3: ethers.Signer; let MockMarket: ethers.Contract; let marketId: BigNumber; @@ -22,7 +30,7 @@ describe('IssueUSDModule', function () { const feeAddress = '0x1234567890123456789012345678901234567890'; before('identify signers', async () => { - [owner, user1, user2] = signers(); + [owner, user1, user2, user3] = signers(); }); before('deploy and connect fake market', async () => { @@ -53,6 +61,18 @@ describe('IssueUSDModule', function () { maxDebtShareValueD18: ethers.utils.parseEther('10000000000000000'), }, ]); + + await systems() + .Core.connect(owner) + .configureCollateral({ + tokenAddress: await systems().Core.getUsdToken(), + oracleNodeId: ethers.utils.formatBytes32String(''), + issuanceRatioD18: bn(150), + liquidationRatioD18: bn(100), + liquidationRewardD18: 0, + minDelegationD18: 0, + depositingEnabled: true, + }); }); const restore = snapshotCheckpoint(provider); @@ -145,6 +165,9 @@ describe('IssueUSDModule', function () { collateralAddress(), depositAmount.div(10) // should be enough ); + await systems() + .Core.connect(user1) + .withdraw(accountId, await systems().Core.getUsdToken(), depositAmount.div(10)); }); it( @@ -235,6 +258,10 @@ describe('IssueUSDModule', function () { collateralAddress(), depositAmount.div(10) // should be enough ); + + await systems() + .Core.connect(user1) + .withdraw(accountId, await systems().Core.getUsdToken(), depositAmount.div(10)); }); it( @@ -252,6 +279,73 @@ describe('IssueUSDModule', function () { }); }); + describe('mint/burn security check', () => { + before(restore); + + before('mint', async () => { + await systems().Core.connect(user1).mintUsd( + accountId, + poolId, + collateralAddress(), + depositAmount.div(10) // should be enough + ); + await systems() + .Core.connect(user1) + .withdraw(accountId, await systems().Core.getUsdToken(), depositAmount.div(10)); + }); + + it('does not let another user pay back the debt without balance', async () => { + // User 1 mint some sUSD + await systems() + .Core.connect(user1) + .mintUsd(accountId, poolId, collateralAddress(), depositAmount.div(10)); + // Mint some collateral for user3. It does not work without user3 having some collateral. (they will not loose any of this though.) + await collateralContract().mint(await user3.getAddress(), depositAmount); + const user3CollateralBalBefore = await collateralContract().balanceOf( + await user3.getAddress() + ); + const user3sUSDBalanceBefore = await systems().USD.balanceOf(await user3.getAddress()); + const user1DebtBefore = await systems() + .Core.connect(user1) + .callStatic.getPositionDebt(accountId, poolId, collateralAddress()); + + const user1SusdBalanceBefore = await systems().USD.balanceOf(await user1.getAddress()); + console.log('user1DebtBefore', user1DebtBefore.toString()); + console.log('user1SusdBalanceBefore', user1SusdBalanceBefore.toString()); + console.log('user3CollateralBalBefore', user3CollateralBalBefore.toString()); + console.log('user3sUSDBalanceBefore', user3sUSDBalanceBefore.toString()); + console.log('Calling burnUSD connected as user3 but passing account id of user1...'); + console.log('Note that user 3 does not have any sUSD'); + + // Try to burn for another user without having any sUSD + await assertRevert( + systems() + .Core.connect(user3) + .burnUsd(accountId, poolId, collateralAddress(), depositAmount.div(10)), + 'PermissionDenied' + ); + + const user3CollateralBalAfter = await collateralContract().balanceOf( + await user3.getAddress() + ); + const user3sUSDBalanceAfter = await systems().USD.balanceOf(await user3.getAddress()); + const user1DebtAfter = await systems() + .Core.connect(user1) + .callStatic.getPositionDebt(accountId, poolId, collateralAddress()); + + const user1SusdBalanceAfter = await systems().USD.balanceOf(await user1.getAddress()); + + console.log('Tx did not revert'); + console.log('user3CollateralBalAfter', user3CollateralBalAfter.toString()); + console.log('user3sUSDBalanceAfter', user3sUSDBalanceAfter.toString()); + console.log('user1DebtAfter', user1DebtAfter.toString()); + console.log('user1SusdBalanceAfter', user1SusdBalanceAfter.toString()); + console.log('User3 have the same amount of collateral, and still 0 sUSD'); + console.log('User1 now have less debt and the same amount of sUSD'); + assertBn.equal(user1DebtBefore, user1DebtAfter); + }); + }); + describe('successful mint when fee is levied', async () => { before(restore); before('set fee', async () => { @@ -278,6 +372,9 @@ describe('IssueUSDModule', function () { collateralAddress(), depositAmount.div(10) // should be enough ); + await systems() + .Core.connect(user1) + .withdraw(accountId, await systems().Core.getUsdToken(), depositAmount.div(10)); }); it( @@ -320,6 +417,9 @@ describe('IssueUSDModule', function () { await systems() .Core.connect(user1) .mintUsd(accountId, poolId, collateralAddress(), depositAmount.div(10)); + await systems() + .Core.connect(user1) + .withdraw(accountId, await systems().Core.getUsdToken(), depositAmount.div(10)); }); const restoreBurn = snapshotCheckpoint(provider); @@ -336,13 +436,23 @@ describe('IssueUSDModule', function () { describe('burn', async () => { before(restoreBurn); - before('other account burn', async () => { + before('user deposit into other account', async () => { + await systems() + .USD.connect(user2) + .approve(systems().Core.address, constants.MaxUint256.toString()); await systems() .Core.connect(user2) - .burnUsd(accountId, poolId, collateralAddress(), depositAmount.div(10)); + .deposit(accountId, await systems().Core.getUsdToken(), depositAmount.div(10)); }); - it('has correct debt', verifyAccountState(accountId, poolId, depositAmount, 0)); + it('other account burn would revert', async () => { + await assertRevert( + systems() + .Core.connect(user2) + .burnUsd(accountId, poolId, collateralAddress(), depositAmount.div(10)), + 'PermissionDenied' + ); + }); it('took away from account collateral', async () => { assertBn.equal( @@ -370,6 +480,18 @@ describe('IssueUSDModule', function () { }); before('account partial burn debt', async () => { + await systems() + .USD.connect(user1) + .approve(systems().Core.address, constants.MaxUint256.toString()); + + await systems() + .Core.connect(user1) + .deposit( + accountId, + await systems().Core.getUsdToken(), + depositAmount.div(20).add(depositAmount.div(2000)) + ); + // in order to burn all with the fee we need a bit more await systems() .Core.connect(user1) @@ -427,6 +549,22 @@ describe('IssueUSDModule', function () { before('account partial burn debt', async () => { // in order to burn all with the fee we need a bit more + await systems() + .Core.connect(user1) + .withdraw(accountId, await systems().Core.getUsdToken(), depositAmount.div(1000)); + + await systems() + .USD.connect(user1) + .approve(systems().Core.address, constants.MaxUint256.toString()); + + await systems() + .Core.connect(user1) + .deposit( + accountId, + await systems().Core.getUsdToken(), + await systems().USD.balanceOf(await user1.getAddress()) + ); + tx = await systems() .Core.connect(user1) .burnUsd(accountId, poolId, collateralAddress(), depositAmount); // pay off everything @@ -504,4 +642,31 @@ describe('IssueUSDModule', function () { it('try to create debt beyond system max c ratio', exploit(2)); }); }); + + describe('establish a more stringent collateralization ratio for the pool', async () => { + before(restore); + + it('set the pool min collateral issuance ratio to 600%', async () => { + await systems() + .Core.connect(owner) + .setPoolCollateralConfiguration(poolId, collateralAddress(), { + collateralLimitD18: bn(10), + issuanceRatioD18: bn(6), + }); + }); + + it('verifies sufficient c-ratio', async () => { + const price = await systems().Core.getCollateralPrice(collateralAddress()); + + await assertRevert( + systems() + .Core.connect(user1) + .mintUsd(accountId, poolId, collateralAddress(), depositAmount), + `InsufficientCollateralRatio("${depositAmount}", "${depositAmount}", "${price}", "${bn( + 6 + ).toString()}")`, + systems().Core + ); + }); + }); }); diff --git a/protocol/synthetix/test/integration/modules/core/LiquidationModule.test.ts b/protocol/synthetix/test/integration/modules/core/LiquidationModule.test.ts index 6476e2a75c..82c2a823b3 100644 --- a/protocol/synthetix/test/integration/modules/core/LiquidationModule.test.ts +++ b/protocol/synthetix/test/integration/modules/core/LiquidationModule.test.ts @@ -54,6 +54,10 @@ describe('LiquidationModule', function () { await systems() .Core.connect(user1) .mintUsd(accountId, poolId, collateralAddress(), debtAmount.div(10)); + + await systems() + .Core.connect(user1) + .withdraw(accountId, await systems().Core.getUsdToken(), debtAmount.div(10)); }); before('going into debt', async () => { @@ -226,6 +230,10 @@ describe('LiquidationModule', function () { await systems() .Core.connect(user1) .mintUsd(accountId, poolId, collateralAddress(), debtAmount.div(10)); + + await systems() + .Core.connect(user1) + .withdraw(accountId, await systems().Core.getUsdToken(), debtAmount.div(10)); }); before('going into debt', async () => { @@ -268,8 +276,6 @@ describe('LiquidationModule', function () { await systems() .Core.connect(user2) .deposit(liquidatorAccountId, collateralAddress(), depositAmount.mul(50)); - - // use the zero pool to get minted USD await systems() .Core.connect(user2) .delegateCollateral( @@ -279,7 +285,6 @@ describe('LiquidationModule', function () { depositAmount.mul(50), ethers.utils.parseEther('1') ); - await systems() .Core.connect(user2) .mintUsd(liquidatorAccountId, 0, collateralAddress(), liquidatorAccountStartingBalance); @@ -346,7 +351,7 @@ describe('LiquidationModule', function () { ); }); - describe('succesful full liquidation', () => { + describe('successful full liquidation', () => { let txn: ethers.providers.TransactionResponse; before('liquidate', async () => { diff --git a/protocol/synthetix/test/integration/modules/core/MulticallModule.test.ts b/protocol/synthetix/test/integration/modules/core/MulticallModule.test.ts index 1132db4a83..49afd0e339 100644 --- a/protocol/synthetix/test/integration/modules/core/MulticallModule.test.ts +++ b/protocol/synthetix/test/integration/modules/core/MulticallModule.test.ts @@ -4,14 +4,16 @@ import assert from 'assert/strict'; import { bootstrap } from '../../bootstrap'; import { ethers } from 'ethers'; import assertRevert from '@synthetixio/core-utils/utils/assertions/assert-revert'; +import assertEvent from '@synthetixio/core-utils/utils/assertions/assert-event'; +import hre from 'hardhat'; describe('MulticallModule', function () { const { systems, signers } = bootstrap(); - let user1: ethers.Signer; + let owner: ethers.Signer, user1: ethers.Signer; before('identify signers', async () => { - [, user1] = signers(); + [owner, user1] = signers(); }); describe('multicall()', () => { @@ -50,7 +52,7 @@ describe('MulticallModule', function () { }); }); - describe.skip('multicallThrough()', () => { + describe('multicallThrough()', () => { it('passes through errors', async () => { await assertRevert( systems() @@ -62,14 +64,42 @@ describe('MulticallModule', function () { systems().Core.interface.encodeFunctionData('createAccount(uint128)', [ '170141183460469231731687303715884105727', ]), - ] + ], + [0] ), `InvalidAccountId("170141183460469231731687303715884105727")`, systems().Core ); }); + it('only works for allowlisted targets', async () => { + await assertRevert( + systems() + .Core.connect(user1) + //@ts-ignore tests is skipped, fixe type when enabled + .multicallThrough( + [systems().Core.address, systems().OracleManager.address], + [ + systems().Core.interface.encodeFunctionData('createAccount(uint128)', [1234434]), + systems().OracleManager.interface.encodeFunctionData('registerNode', [ + 8, + ethers.utils.defaultAbiCoder.encode(['uint256'], [429]), + [], + ]), + ], + [0, 0] + ), + `DeniedMulticallTarget("${systems().OracleManager.address}")`, + systems().Core + ); + }); + describe('on success', async () => { + before('allowlist OracleManager', async () => { + await systems() + .Core.connect(owner) + .setAllowlistedMulticallTarget(systems().OracleManager.address, true); + }); before('call', async () => { await systems() .Core.connect(user1) @@ -83,7 +113,8 @@ describe('MulticallModule', function () { ethers.utils.defaultAbiCoder.encode(['uint256'], [429]), [], ]), - ] + ], + [0, 0] ); }); @@ -98,5 +129,47 @@ describe('MulticallModule', function () { assert.equal((await systems().OracleManager.getNode(nodeId)).nodeType, 8); }); }); + + describe('verify messageSender', async () => { + let receiverContract: ethers.Contract; + let tx: ethers.providers.TransactionResponse; + before('deploy multicall receiver', async () => { + const factory = await hre.ethers.getContractFactory('MulticallReceiver'); + const MulticallReceiver = await factory.deploy(); + receiverContract = await MulticallReceiver.deployed(); + await systems() + .Core.connect(owner) + .setAllowlistedMulticallTarget(receiverContract.address, true); + tx = await systems() + .Core.connect(user1) + .multicallThrough( + [receiverContract.address], + [receiverContract.interface.encodeFunctionData('testMessageSender')], + [0] + ); + }); + + it('emits event confirming msg sender is correct', async () => { + await assertEvent( + tx, + `MessageSenderTested("${await user1.getAddress()}")`, + receiverContract + ); + }); + + it('should have reset messageSender after multicall', async () => { + assert.equal(await systems().Core.getMessageSender(), ethers.constants.AddressZero); + }); + }); + }); + + describe('setAllowlistedMulticallTarget()', () => { + it('only owner can set allowlisted target', async () => { + await assertRevert( + systems().Core.connect(user1).setAllowlistedMulticallTarget(user1.getAddress(), true), + 'Unauthorized', + systems().Core + ); + }); }); }); diff --git a/protocol/synthetix/test/integration/modules/core/OffchainWormholeModule.test.ts b/protocol/synthetix/test/integration/modules/core/OffchainWormholeModule.test.ts index 442cb23d1b..f4cdf3921d 100644 --- a/protocol/synthetix/test/integration/modules/core/OffchainWormholeModule.test.ts +++ b/protocol/synthetix/test/integration/modules/core/OffchainWormholeModule.test.ts @@ -42,7 +42,7 @@ describe('CcipReceiverModule', function () { .Core.connect(staker()) .mintUsd(accountId, poolId, collateralAddress(), twoHundredUSD); - await systems().USD.connect(staker()).transfer(systems().Core.address, fiftyUSD); + await systems().Core.connect(staker()).withdraw(accountId, collateralAddress(), fiftyUSD); }); before('record balances', async () => { diff --git a/protocol/synthetix/test/integration/modules/core/PoolConfigurationModule/PoolConfigurationModule.test.ts b/protocol/synthetix/test/integration/modules/core/PoolConfigurationModule/PoolConfigurationModule.test.ts index 2c6e8ef3f9..7f551a77e5 100644 --- a/protocol/synthetix/test/integration/modules/core/PoolConfigurationModule/PoolConfigurationModule.test.ts +++ b/protocol/synthetix/test/integration/modules/core/PoolConfigurationModule/PoolConfigurationModule.test.ts @@ -9,7 +9,7 @@ import { bootstrap } from '../../../bootstrap'; describe('PoolConfigurationModule', function () { const { signers, systems } = bootstrap(); - let owner: Ethers.Signer, user1: Ethers.Signer; + let owner: Ethers.Signer, user1: Ethers.Signer, user2: Ethers.Signer; let receipt: Ethers.providers.TransactionReceipt; @@ -23,7 +23,7 @@ describe('PoolConfigurationModule', function () { describe('PoolConfigurationModule', function () { before('identify signers', async () => { - [owner, user1] = signers(); + [owner, user1, user2] = signers(); }); describe('when some pools are created', function () { @@ -183,6 +183,25 @@ describe('PoolConfigurationModule', function () { }); }); }); + + describe('when the owner tries to disable/enable new collaterals by default', () => { + it('setPoolCollateralDisabledByDefault is restricted to the pool owner', async () => { + await assertRevert( + systems().Core.connect(user2).setPoolCollateralDisabledByDefault(1, true), + `Unauthorized("${await user2.getAddress()}")`, + systems().Core + ); + }); + + it('pool owner disables new collaterals by default', async () => { + const tx = await systems() + .Core.connect(user1) + .setPoolCollateralDisabledByDefault(1, true); + + receipt = await tx.wait(); + await assertEvent(receipt, 'PoolCollateralDisabledByDefaultSet(1, true)', systems().Core); + }); + }); }); }); }); diff --git a/protocol/synthetix/test/integration/modules/core/PoolModule/PoolModuleFundAdmin.test.ts b/protocol/synthetix/test/integration/modules/core/PoolModule/PoolModuleFundAdmin.test.ts index f9710eee73..5f76e50a72 100644 --- a/protocol/synthetix/test/integration/modules/core/PoolModule/PoolModuleFundAdmin.test.ts +++ b/protocol/synthetix/test/integration/modules/core/PoolModule/PoolModuleFundAdmin.test.ts @@ -25,6 +25,7 @@ describe('PoolModule Admin', function () { let owner: ethers.Signer, user1: ethers.Signer, user2: ethers.Signer; const secondPoolId = 3384692; + const thirdPoolId = 3384633; const One = ethers.utils.parseEther('1'); const Hundred = ethers.utils.parseEther('100'); @@ -684,4 +685,93 @@ describe('PoolModule Admin', function () { }); }); }); + + describe('disable/enable collateral for a pool ', async () => { + before(restore); + + before('give user1 permission to create pool', async () => { + await systems() + .Core.connect(owner) + .addToFeatureFlagAllowlist( + ethers.utils.formatBytes32String('createPool'), + user1.getAddress() + ); + }); + + before('create a pool', async () => { + await ( + await systems() + .Core.connect(user1) + .createPool(thirdPoolId, await user1.getAddress()) + ).wait(); + }); + + it('only works for owner', async () => { + await assertRevert( + systems() + .Core.connect(user2) + .setPoolCollateralConfiguration(thirdPoolId, collateralAddress(), { + collateralLimitD18: bn(10), + issuanceRatioD18: bn(0), + }), + `Unauthorized("${await user2.getAddress()}")`, + systems().Core + ); + }); + }); + + describe('set pool collateral issuance ratio', async () => { + before(restore); + + before('give user1 permission to create pool', async () => { + await systems() + .Core.connect(owner) + .addToFeatureFlagAllowlist( + ethers.utils.formatBytes32String('createPool'), + user1.getAddress() + ); + }); + + before('create a pool', async () => { + await ( + await systems() + .Core.connect(user1) + .createPool(thirdPoolId, await user1.getAddress()) + ).wait(); + }); + + it('only works for owner', async () => { + await assertRevert( + systems() + .Core.connect(user2) + .setPoolCollateralConfiguration(thirdPoolId, collateralAddress(), { + collateralLimitD18: bn(10), + issuanceRatioD18: bn(2), + }), + `Unauthorized("${await user2.getAddress()}")`, + systems().Core + ); + }); + + it('min collateral ratio is set to zero for the pool by default', async () => { + await assert.equal( + await systems().Core.getPoolCollateralIssuanceRatio(thirdPoolId, collateralAddress()), + 0 + ); + }); + + it('set the pool collateal issuance ratio to 200%', async () => { + await systems() + .Core.connect(user1) + .setPoolCollateralConfiguration(thirdPoolId, collateralAddress(), { + collateralLimitD18: bn(10), + issuanceRatioD18: bn(2), + }); + + await assertBn.equal( + await systems().Core.getPoolCollateralIssuanceRatio(thirdPoolId, collateralAddress()), + bn(2) + ); + }); + }); }); diff --git a/protocol/synthetix/test/integration/modules/core/USDTokenModule.test.ts b/protocol/synthetix/test/integration/modules/core/USDTokenModule.test.ts index 7ad784c80e..467910e4c9 100644 --- a/protocol/synthetix/test/integration/modules/core/USDTokenModule.test.ts +++ b/protocol/synthetix/test/integration/modules/core/USDTokenModule.test.ts @@ -1,6 +1,6 @@ -import assert from 'assert/strict'; import assertBn from '@synthetixio/core-utils/src/utils/assertions/assert-bignumber'; import assertRevert from '@synthetixio/core-utils/utils/assertions/assert-revert'; +import assert from 'assert/strict'; import { ethers } from 'ethers'; import { bn, bootstrapWithStakedPool } from '../../bootstrap'; @@ -62,6 +62,9 @@ describe('USDTokenModule', function () { let usdBalanceBefore: ethers.BigNumber; before('record balances', async () => { + await systems() + .Core.connect(staker()) + .withdraw(accountId, await systems().Core.getUsdToken(), fiftyUSD); usdBalanceBefore = await systems().USD.connect(staker()).balanceOf(stakerAddress); }); diff --git a/protocol/synthetix/test/integration/modules/core/VaultModule.test.ts b/protocol/synthetix/test/integration/modules/core/VaultModule.test.ts index 3ff21390f8..cf97208279 100644 --- a/protocol/synthetix/test/integration/modules/core/VaultModule.test.ts +++ b/protocol/synthetix/test/integration/modules/core/VaultModule.test.ts @@ -2,9 +2,9 @@ import assertBn from '@synthetixio/core-utils/utils/assertions/assert-bignumber' import assertRevert from '@synthetixio/core-utils/utils/assertions/assert-revert'; import { snapshotCheckpoint } from '@synthetixio/core-utils/utils/mocha/snapshot'; import assert from 'assert/strict'; -import { BigNumber, ethers } from 'ethers'; +import { BigNumber, constants, ethers } from 'ethers'; import hre from 'hardhat'; -import { bootstrapWithStakedPool } from '../../bootstrap'; +import { bn, bootstrapWithStakedPool } from '../../bootstrap'; import Permissions from '../../mixins/AccountRBACMixin.permissions'; import { verifyUsesFeatureFlag } from '../../verifications'; import { fastForwardTo, getTime } from '@synthetixio/core-utils/utils/hardhat/rpc'; @@ -82,6 +82,18 @@ describe('VaultModule', function () { depositingEnabled: true, }) ).wait(); + + await systems() + .Core.connect(owner) + .configureCollateral({ + tokenAddress: await systems().Core.getUsdToken(), + oracleNodeId: ethers.utils.formatBytes32String(''), + issuanceRatioD18: bn(1.5), + liquidationRatioD18: bn(1.1), + liquidationRewardD18: 0, + minDelegationD18: 0, + depositingEnabled: true, + }); }); const restore = snapshotCheckpoint(provider); @@ -277,7 +289,7 @@ describe('VaultModule', function () { ) ); - describe('when collateral is disabled', async () => { + describe('when collateral is disabled by system', async () => { const restore = snapshotCheckpoint(provider); after(restore); @@ -314,6 +326,106 @@ describe('VaultModule', function () { }); }); + describe('when collateral is disabled by pool owner', async () => { + const restore = snapshotCheckpoint(provider); + after(restore); + + const fakeVaultId = 93729021; + + before('create empty vault', async () => { + await systems().Core.createPool(fakeVaultId, await user1.getAddress()); + }); + + before('enable collateral for the system', async () => { + const beforeConfiguration = await systems().Core.getCollateralConfiguration( + collateralAddress() + ); + + await systems() + .Core.connect(owner) + .configureCollateral({ ...beforeConfiguration, depositingEnabled: true }); + }); + + // fails when collateral is disabled for the pool by pool owner + before('disable collateral for the pool by the pool owner', async () => { + await systems() + .Core.connect(user1) + .setPoolCollateralConfiguration(fakeVaultId, collateralAddress(), { + collateralLimitD18: bn(10), + issuanceRatioD18: bn(0), + }); + }); + + // fails when collateral is disabled for the pool by pool owner + it('fails when trying to open delegation position with disabled collateral', async () => { + await assertRevert( + systems() + .Core.connect(user1) + .delegateCollateral( + accountId, + fakeVaultId, + collateralAddress(), + depositAmount.div(50), + ethers.utils.parseEther('1') + ), + `PoolCollateralLimitExceeded("${fakeVaultId}", "${collateralAddress()}", "${depositAmount + .div(50) + .toString()}", "${bn(10).toString()}")`, + systems().Core + ); + }); + + it('collateral is enabled by the pool owner', async () => { + await systems() + .Core.connect(user1) + .setPoolCollateralConfiguration(fakeVaultId, collateralAddress(), { + collateralLimitD18: bn(1000000), + issuanceRatioD18: bn(0), + }); + }); + + it('the delegation works as expected with the enabled collateral', async () => { + await systems() + .Core.connect(user1) + .delegateCollateral( + accountId, + fakeVaultId, + collateralAddress(), + depositAmount.div(50), + ethers.utils.parseEther('1') + ); + }); + }); + + describe('when pool has limited collateral deposit', async () => { + before('set pool limit', async () => { + await systems() + .Core.connect(owner) + .setPoolCollateralConfiguration(poolId, collateralAddress(), { + collateralLimitD18: depositAmount.div(2), + issuanceRatioD18: bn(0), + }); + }); + + it('fails when pool does not allow sufficient deposit amount', async () => { + await assertRevert( + systems() + .Core.connect(user1) + .delegateCollateral( + accountId, + poolId, + collateralAddress(), + depositAmount.mul(2), + ethers.utils.parseEther('1') + ), + `PoolCollateralLimitExceeded("${poolId}", "${collateralAddress()}", "${depositAmount + .mul(2) + .toString()}", "${depositAmount.div(2).toString()}")`, + systems().Core + ); + }); + }); + it( 'user1 has expected initial position', verifyAccountState(accountId, poolId, depositAmount, 0) @@ -348,6 +460,15 @@ describe('VaultModule', function () { describe('second user delegates', async () => { const user2AccountId = 283847; + before('set pool limit', async () => { + await systems() + .Core.connect(owner) + .setPoolCollateralConfiguration(poolId, collateralAddress(), { + collateralLimitD18: depositAmount.mul(10), + issuanceRatioD18: bn(0), + }); + }); + before('second user delegates and mints', async () => { // user1 has extra collateral available await collateralContract() @@ -378,6 +499,10 @@ describe('VaultModule', function () { collateralAddress(), depositAmount.div(100) // should be enough collateral to mint this ); + + await systems() + .Core.connect(user2) + .withdraw(user2AccountId, await systems().Core.getUsdToken(), depositAmount.div(100)); }); // lock enough collateral that the market will *become* capacity locked when the user @@ -724,6 +849,14 @@ describe('VaultModule', function () { describe('remove collateral', async () => { before('repay debt', async () => { + await systems() + .USD.connect(user2) + .approve(systems().Core.address, constants.MaxUint256.toString()); + + await systems() + .Core.connect(user2) + .deposit(user2AccountId, await systems().Core.getUsdToken(), depositAmount.div(100)); + await systems() .Core.connect(user2) .burnUsd(user2AccountId, poolId, collateralAddress(), depositAmount.div(100)); diff --git a/protocol/synthetix/test/integration/storage/CollateralConfiguration.test.ts b/protocol/synthetix/test/integration/storage/CollateralConfiguration.test.ts index f1061921c6..e01643c6fd 100644 --- a/protocol/synthetix/test/integration/storage/CollateralConfiguration.test.ts +++ b/protocol/synthetix/test/integration/storage/CollateralConfiguration.test.ts @@ -48,34 +48,67 @@ describe('CollateralConfiguration', function () { systems().Core.CollateralConfiguration_verifyIssuanceRatio( fakeCollateral.address, 100, - 499 + 499, + 0 ), 'InsufficientCollateralRatio("499", "100", "4990000000000000000", "5000000000000000000")', systems().Core ); + + // default to system issuanceRatioD18 + await assertRevert( + systems().Core.CollateralConfiguration_verifyIssuanceRatio( + fakeCollateral.address, + 100, + 499, + ONE.mul(3) + ), + 'InsufficientCollateralRatio("499", "100", "4990000000000000000", "5000000000000000000")', + systems().Core + ); + + // override with minIssuanceRatioD18 + await assertRevert( + systems().Core.CollateralConfiguration_verifyIssuanceRatio( + fakeCollateral.address, + 100, + 500, + ONE.mul(6) + ), + 'InsufficientCollateralRatio("500", "100", "5000000000000000000", "6000000000000000000")', + systems().Core + ); }); it('succeeds when c-ratio is good', async () => { await systems().Core.CollateralConfiguration_verifyIssuanceRatio( fakeCollateral.address, 100, - 500 + 500, + 0 ); await systems().Core.CollateralConfiguration_verifyIssuanceRatio( fakeCollateral.address, 100, - 1000 + 1000, + 0 ); await systems().Core.CollateralConfiguration_verifyIssuanceRatio( fakeCollateral.address, 0, - 1000 + 1000, + 0 ); }); it('edge case: fails if positive debt with no collateral', async () => { await assertRevert( - systems().Core.CollateralConfiguration_verifyIssuanceRatio(fakeCollateral.address, 100, 0), + systems().Core.CollateralConfiguration_verifyIssuanceRatio( + fakeCollateral.address, + 100, + 0, + 0 + ), 'InsufficientCollateralRatio("0", "100", "0", "5000000000000000000")', systems().Core ); diff --git a/protocol/synthetix/test/integration/verifications.ts b/protocol/synthetix/test/integration/verifications.ts index 3ae01ecf7c..2b8f41821c 100644 --- a/protocol/synthetix/test/integration/verifications.ts +++ b/protocol/synthetix/test/integration/verifications.ts @@ -1,6 +1,7 @@ import assertRevert from '@synthetixio/core-utils/utils/assertions/assert-revert'; import { snapshotCheckpoint } from '@synthetixio/core-utils/utils/mocha/snapshot'; import { ethers } from 'ethers'; +import { bn } from '../common'; export function verifyUsesFeatureFlag( c: () => ethers.Contract, @@ -38,8 +39,8 @@ export function verifyChecksCollateralEnabled( before('disable collateral', async () => { await c().configureCollateral({ depositingEnabled: false, - issuanceRatioD18: 0, - liquidationRatioD18: 0, + issuanceRatioD18: bn(2), + liquidationRatioD18: bn(2), liquidationRewardD18: 0, oracleNodeId: ethers.utils.formatBytes32String(''), tokenAddress: collateralAddress(), diff --git a/utils/common-config/hardhat.config.ts b/utils/common-config/hardhat.config.ts index 7db95c17a8..da1e21dfae 100644 --- a/utils/common-config/hardhat.config.ts +++ b/utils/common-config/hardhat.config.ts @@ -13,12 +13,6 @@ import 'hardhat-cannon'; import 'hardhat-ignore-warnings'; import '@synthetixio/hardhat-storage'; -// Router generation cannon plugin -import { registerAction } from '@usecannon/builder'; -import pluginRouter from 'cannon-plugin-router'; - -registerAction(pluginRouter); - // Load common .env file from root dotenv.config({ path: path.resolve(__dirname, '..', '..', '.env') }); diff --git a/utils/common-config/package.json b/utils/common-config/package.json index 1dad63b676..f78521c57a 100644 --- a/utils/common-config/package.json +++ b/utils/common-config/package.json @@ -15,16 +15,14 @@ "@synthetixio/hardhat-storage": "workspace:*", "@typechain/ethers-v5": "10.1.0", "@typechain/hardhat": "6.1.3", - "@usecannon/builder": "^2.5.1", - "cannon-plugin-router": "^1.0.16", "dotenv": "16.0.1", - "hardhat": "2.15.0", - "hardhat-cannon": "2.5.1", + "hardhat": "2.17.2", + "hardhat-cannon": "2.7.1", "hardhat-contract-sizer": "2.10.0", "hardhat-gas-reporter": "1.0.9", "hardhat-ignore-warnings": "0.2.9", "solidity-coverage": "0.8.2", "typechain": "8.1.1" }, - "gitHead": "af79d976af56150c628a885cc94a94f5bcc2c862" + "gitHead": "ba5a9730df248cd1999b5a6fd1bf67b307b95eec" } diff --git a/utils/common-config/tsconfig.json b/utils/common-config/tsconfig.json index 93c6be541b..de04bec016 100644 --- a/utils/common-config/tsconfig.json +++ b/utils/common-config/tsconfig.json @@ -3,5 +3,5 @@ "compilerOptions": { "noEmit": true }, - "files": ["./hardhat.config.ts", "types/cannon-plugin-router.d.ts"] + "files": ["./hardhat.config.ts"] } diff --git a/utils/core-contracts/contracts/token/ERC20.sol b/utils/core-contracts/contracts/token/ERC20.sol index 9b903400f8..768b9bf9bf 100644 --- a/utils/core-contracts/contracts/token/ERC20.sol +++ b/utils/core-contracts/contracts/token/ERC20.sol @@ -158,7 +158,7 @@ contract ERC20 is IERC20 { } function _approve(address owner, address spender, uint256 amount) internal virtual { - _checkZeroAddressOrAmount(spender, amount); + _checkZeroAddress(spender); ERC20Storage.load().allowance[owner][spender] = amount; @@ -166,15 +166,19 @@ contract ERC20 is IERC20 { } function _checkZeroAddressOrAmount(address target, uint256 amount) private pure { - if (target == address(0)) { - revert ParameterError.InvalidParameter("target", "Zero address"); - } + _checkZeroAddress(target); if (amount == 0) { revert ParameterError.InvalidParameter("amount", "Zero amount"); } } + function _checkZeroAddress(address target) private pure { + if (target == address(0)) { + revert ParameterError.InvalidParameter("target", "Zero address"); + } + } + function _mint(address to, uint256 amount) internal virtual { _checkZeroAddressOrAmount(to, amount); diff --git a/utils/core-contracts/package.json b/utils/core-contracts/package.json index 98ffde7ce6..f51e12d599 100644 --- a/utils/core-contracts/package.json +++ b/utils/core-contracts/package.json @@ -29,14 +29,12 @@ "@ethersproject/bignumber": "^5.7.0", "@synthetixio/common-config": "workspace:*", "@synthetixio/core-utils": "workspace:*", - "@synthetixio/router": "^3.1.3", "ethers": "^5.7.2", - "hardhat": "2.15.0" + "hardhat": "2.17.2" }, - "gitHead": "af79d976af56150c628a885cc94a94f5bcc2c862", + "gitHead": "ba5a9730df248cd1999b5a6fd1bf67b307b95eec", "depcheck": { "ignoreMatches": [ - "@synthetixio/router", "@ethersproject/abi", "@ethersproject/providers", "@nomiclabs/hardhat-ethers" diff --git a/utils/core-contracts/test/contracts/token/ERC20.test.ts b/utils/core-contracts/test/contracts/token/ERC20.test.ts index ee193d9314..b6e046a7ac 100644 --- a/utils/core-contracts/test/contracts/token/ERC20.test.ts +++ b/utils/core-contracts/test/contracts/token/ERC20.test.ts @@ -53,10 +53,6 @@ describe('ERC20', function () { ); // Zero amount - await assertRevert( - ERC20.approve(await user1.getAddress(), 0), - 'InvalidParameter("amount", "Zero amount")' - ); await assertRevert( ERC20.transfer(await user1.getAddress(), 0), 'InvalidParameter("amount", "Zero amount")' @@ -221,6 +217,20 @@ describe('ERC20', function () { assertBn.equal(evt.args.amount, approvalAmount); }); + describe('approve()', async function () { + it('revokes token when amount zero', async function () { + await ERC20.connect(user1).approve(await user2.getAddress(), BigNumber.from('0')); + assertBn.equal( + await ERC20.allowance(await user1.getAddress(), await user2.getAddress()), + '0' + ); + }); + + after('reset approval', async () => { + await ERC20.connect(user1).approve(await user2.getAddress(), approvalAmount); + }); + }); + describe('increaseAllowance()', async () => { it('reverts when overflowing', async () => { await assertRevert( diff --git a/utils/core-modules/cannonfile.test.toml b/utils/core-modules/cannonfile.test.toml index d2f7de5688..5257dbb004 100644 --- a/utils/core-modules/cannonfile.test.toml +++ b/utils/core-modules/cannonfile.test.toml @@ -12,7 +12,6 @@ description = "Admin user for the system" defaultValue = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266" # Core Modules - [contract.OwnerModule] artifact = "contracts/modules/OwnerModule.sol:OwnerModule" @@ -38,7 +37,6 @@ artifact = "contracts/modules/DecayTokenModule.sol:DecayTokenModule" artifact = "contracts/modules/NftModule.sol:NftModule" # Mocks - [contract.SampleFeatureFlagModule] artifact = "contracts/modules/mocks/SampleFeatureFlagModule.sol:SampleFeatureFlagModule" @@ -49,126 +47,52 @@ artifact = "contracts/modules/mocks/SampleOwnedModule.sol:SampleOwnedModule" artifact = "contracts/modules/mocks/GenericModule.sol:GenericModule" # Setup Initial Proxy - [contract.Proxy] artifact = "contracts/Proxy.sol:Proxy" args = ["<%= contracts.CoreRouter.address %>", "<%= settings.owner %>"] abiOf = ["CoreRouter"] salt = "<%= settings.salt %>" -depends = ["router.CoreRouter"] # Core Router - [router.CoreRouter] contracts = ["CoreModule"] -depends = ["contract.CoreModule"] # AssociatedSystemsModule Router - [router.AssociatedSystemsModuleRouter] -contracts = [ - "CoreModule", - "AssociatedSystemsModule", -] -depends = [ - "contract.CoreModule", - "contract.AssociatedSystemsModule" -] +contracts = ["CoreModule", "AssociatedSystemsModule"] # TokenModule Router - [router.TokenModuleRouter] -contracts = [ - "CoreModule", - "TokenModule", -] -depends = [ - "contract.CoreModule", - "contract.TokenModule" -] - +contracts = ["CoreModule", "TokenModule"] [router.TokenModuleRouter2] -contracts = [ - "CoreModule", - "TokenModule", -] +contracts = ["CoreModule", "TokenModule"] salt = "second" -depends = [ - "contract.CoreModule", - "contract.TokenModule" -] [router.TokenModuleRouter3] -contracts = [ - "CoreModule", - "TokenModule", -] +contracts = ["CoreModule", "TokenModule"] salt = "third" -depends = [ - "contract.CoreModule", - "contract.TokenModule" -] # DecayTokenModule Router - [router.DecayTokenModuleRouter] -contracts = [ - "CoreModule", - "DecayTokenModule", -] -depends = [ - "contract.CoreModule", - "contract.DecayTokenModule" -] +contracts = ["CoreModule", "DecayTokenModule"] # Sample Router - [router.SampleRouter] -contracts = [ - "CoreModule", - "SampleOwnedModule" -] -depends = [ - "contract.CoreModule", - "contract.SampleOwnedModule" -] +contracts = ["CoreModule", "SampleOwnedModule"] # NftModule Router ( we need multiple for tests) - [router.NftModuleRouter] -contracts = [ - "CoreModule", - "NftModule", -] -depends = ["contract.CoreModule", "contract.NftModule"] +contracts = ["CoreModule", "NftModule"] [router.NftModuleRouter2] -contracts = [ - "CoreModule", - "NftModule", -] +contracts = ["CoreModule", "NftModule"] salt = "second" -depends = ["contract.CoreModule", "contract.NftModule"] [router.NftModuleRouter3] -contracts = [ - "CoreModule", - "NftModule", -] +contracts = ["CoreModule", "NftModule"] salt = "third" -depends = ["contract.CoreModule", "contract.NftModule"] # FeatureFlagModule Router - [router.FeatureFlagModuleRouter] -contracts = [ - "CoreModule", - "FeatureFlagModule", - "SampleFeatureFlagModule", -] -depends = [ - "contract.CoreModule", - "contract.FeatureFlagModule", - "contract.SampleFeatureFlagModule" -] +contracts = ["CoreModule", "FeatureFlagModule", "SampleFeatureFlagModule"] diff --git a/utils/core-modules/contracts/modules/AssociatedSystemsModule.sol b/utils/core-modules/contracts/modules/AssociatedSystemsModule.sol index 0106e765e9..162525f576 100644 --- a/utils/core-modules/contracts/modules/AssociatedSystemsModule.sol +++ b/utils/core-modules/contracts/modules/AssociatedSystemsModule.sol @@ -126,7 +126,10 @@ contract AssociatedSystemsModule is IAssociatedSystemsModule { AssociatedSystem.Data storage store = AssociatedSystem.load(id); if (store.proxy != address(0)) { - _upgradeToken(id, impl); + if (store.impl != impl) { + _upgradeToken(id, impl); + } + ITokenModule(store.proxy).initialize(name, symbol, decimals); } else { // create a new proxy and own it address proxy = address(new UUPSProxyWithOwner(impl, address(this))); diff --git a/utils/core-modules/package.json b/utils/core-modules/package.json index 984d69d3a6..be1b60d06c 100644 --- a/utils/core-modules/package.json +++ b/utils/core-modules/package.json @@ -23,9 +23,9 @@ "devDependencies": { "@synthetixio/common-config": "workspace:*", "@synthetixio/core-utils": "workspace:*", - "@synthetixio/router": "^3.1.3", + "@synthetixio/router": "^3.3.0", "ethers": "^5.7.2", - "hardhat": "2.15.0" + "hardhat": "2.17.2" }, - "gitHead": "af79d976af56150c628a885cc94a94f5bcc2c862" + "gitHead": "ba5a9730df248cd1999b5a6fd1bf67b307b95eec" } diff --git a/utils/core-modules/test/bootstrap.ts b/utils/core-modules/test/bootstrap.ts index 14ce848279..4da85a76e9 100644 --- a/utils/core-modules/test/bootstrap.ts +++ b/utils/core-modules/test/bootstrap.ts @@ -1,4 +1,4 @@ -import { coreBootstrap } from '@synthetixio/router/dist/utils/tests'; +import { coreBootstrap } from '@synthetixio/router/utils/tests'; import { AssociatedSystemsModule, DecayTokenModule, @@ -13,13 +13,13 @@ import { UpgradeModule, } from '../typechain-types'; import { - TokenModuleRouter, - SampleRouter, - NftModuleRouter, - FeatureFlagModuleRouter, - DecayTokenModuleRouter, - CoreRouter, AssociatedSystemsModuleRouter, + CoreRouter, + DecayTokenModuleRouter, + FeatureFlagModuleRouter, + NftModuleRouter, + SampleRouter, + TokenModuleRouter, } from './generated/typechain'; interface Contracts { diff --git a/utils/core-modules/test/contracts/modules/AssociatedSystemsModule.test.ts b/utils/core-modules/test/contracts/modules/AssociatedSystemsModule.test.ts index a9a602250d..f48a08ad66 100644 --- a/utils/core-modules/test/contracts/modules/AssociatedSystemsModule.test.ts +++ b/utils/core-modules/test/contracts/modules/AssociatedSystemsModule.test.ts @@ -156,6 +156,23 @@ describe('AssociatedSystemsModule', function () { assert.equal(await TokenModule.isInitialized(), false); }); + it('upgrade token with new name and symbol', async () => { + await AssociatedSystemsModule.initOrUpgradeToken( + registeredName, + 'A Token 2', + 'TOK2', + 18, + TokenModule.address + ); + }); + + it('the token has been successfully reinitlized', async function () { + assert.equal(await TokenModuleAssociated.isInitialized(), true); + assert.equal(await TokenModuleAssociated.name(), 'A Token 2'); + assert.equal(await TokenModuleAssociated.symbol(), 'TOK2'); + assert.equal(await TokenModuleAssociated.decimals(), 18); + }); + describe('when attempting to register a different kind', function () { before('prepare modules', async function () { await AssociatedSystemsModule.initOrUpgradeNft( @@ -199,9 +216,8 @@ describe('AssociatedSystemsModule', function () { }); it('works when reinitialized with the same impl', async function () { - const [newProxyAddress] = await AssociatedSystemsModule.getAssociatedSystem( - registeredName - ); + const [newProxyAddress] = + await AssociatedSystemsModule.getAssociatedSystem(registeredName); assert.equal(newProxyAddress, TokenModuleAssociated.address); }); @@ -338,9 +354,8 @@ describe('AssociatedSystemsModule', function () { }); it('works when reinitialized with the same impl', async function () { - const [newProxyAddress] = await AssociatedSystemsModule.getAssociatedSystem( - registeredName - ); + const [newProxyAddress] = + await AssociatedSystemsModule.getAssociatedSystem(registeredName); assert.equal(newProxyAddress, NftModuleAssociated.address); }); diff --git a/utils/core-utils/.nycrc.json b/utils/core-utils/.nycrc.json index 9b47a37ed6..a5e1b3add2 100644 --- a/utils/core-utils/.nycrc.json +++ b/utils/core-utils/.nycrc.json @@ -1,14 +1,9 @@ { "extends": "@istanbuljs/nyc-config-typescript", "all": true, - "include": [ - "src/utils/**/*.ts" - ], + "include": ["src/utils/**/*.ts"], "check-coverage": true, - "reporter": [ - "lcov", - "text" - ], + "reporter": ["lcov", "text"], "branches": 31, "lines": 25, "functions": 11, diff --git a/utils/core-utils/package.json b/utils/core-utils/package.json index a871e3a97f..7b4d0cc7a9 100644 --- a/utils/core-utils/package.json +++ b/utils/core-utils/package.json @@ -39,15 +39,16 @@ "devDependencies": { "@istanbuljs/nyc-config-typescript": "1.0.2", "@types/prompts": "2.0.14", + "@usecannon/builder": "2.7.1", "ethers": "^5.7.2", - "hardhat": "2.15.0", - "mocha": "10.2.0", + "hardhat": "2.17.2", + "mocha": "^10.2.0", "multimatch": "6.0.0", "nyc": "15.1.0", "sinon": "11.1.2", "solc": "0.8.17", "solidity-ast": "0.4.46", - "typescript": "4.9.3" + "typescript": "^4.9.3" }, "dependencies": { "@ethersproject/abi": "^5.7.0", @@ -57,5 +58,5 @@ "prompts": "2.4.2", "rfdc": "1.3.0" }, - "gitHead": "af79d976af56150c628a885cc94a94f5bcc2c862" + "gitHead": "ba5a9730df248cd1999b5a6fd1bf67b307b95eec" } diff --git a/utils/core-utils/src/utils/ethers/contracts.ts b/utils/core-utils/src/utils/ethers/contracts.ts index bcb03f30c1..a67cb788d7 100644 --- a/utils/core-utils/src/utils/ethers/contracts.ts +++ b/utils/core-utils/src/utils/ethers/contracts.ts @@ -25,14 +25,17 @@ export function getSelectors( ) { const contract = new ethers.Contract('0x0000000000000000000000000000000000000001', contractAbi); - return contract.interface.fragments.reduce((selectors, fragment) => { - if (fragment.type === 'function' && functionFilter(fragment.name)) { - selectors.push({ - name: fragment.name, - selector: contract.interface.getSighash(fragment), - }); - } + return contract.interface.fragments.reduce( + (selectors, fragment) => { + if (fragment.type === 'function' && functionFilter(fragment.name)) { + selectors.push({ + name: fragment.name, + selector: contract.interface.getSighash(fragment), + }); + } - return selectors; - }, [] as { name: string; selector: string }[]); + return selectors; + }, + [] as { name: string; selector: string }[] + ); } diff --git a/utils/core-utils/src/utils/merkle-tree/merkle-tree.ts b/utils/core-utils/src/utils/merkle-tree/merkle-tree.ts index b26bb98f76..d542cbb50b 100644 --- a/utils/core-utils/src/utils/merkle-tree/merkle-tree.ts +++ b/utils/core-utils/src/utils/merkle-tree/merkle-tree.ts @@ -17,10 +17,13 @@ export default class MerkleTree { // Deduplicate elements this.elements = MerkleTree._bufDedup(this.elements); - this.bufferElementPositionIndex = this.elements.reduce((memo, el, index) => { - memo[bufferToHex(el)] = index; - return memo; - }, {} as typeof this.bufferElementPositionIndex); + this.bufferElementPositionIndex = this.elements.reduce( + (memo, el, index) => { + memo[bufferToHex(el)] = index; + return memo; + }, + {} as typeof this.bufferElementPositionIndex + ); // Create layers this.layers = this.getLayers(this.elements); diff --git a/utils/core-utils/src/utils/merkle-tree/parse-balance-tree.ts b/utils/core-utils/src/utils/merkle-tree/parse-balance-tree.ts index ed94a7b7cd..e7446ee1a8 100644 --- a/utils/core-utils/src/utils/merkle-tree/parse-balance-tree.ts +++ b/utils/core-utils/src/utils/merkle-tree/parse-balance-tree.ts @@ -21,18 +21,21 @@ export function parseBalanceMap(balances: Balance[] | { [addr: string]: BigNumbe })); /* eslint-enable indent */ - const dataByAddress = balancesInNewFormat.reduce((memo, { address: account, balance }) => { - if (!isAddress(account)) { - throw new Error(`Found invalid address: ${account}`); - } - const parsed = getAddress(account); - if (memo[parsed]) throw new Error(`Duplicate address: ${parsed}`); - const parsedNum = BigNumber.from(balance); - if (parsedNum.lte(0)) throw new Error(`Invalid amount for account: ${account}`); - - memo[parsed] = { amount: parsedNum }; - return memo; - }, {} as { [key: string]: { amount: BigNumber } }); + const dataByAddress = balancesInNewFormat.reduce( + (memo, { address: account, balance }) => { + if (!isAddress(account)) { + throw new Error(`Found invalid address: ${account}`); + } + const parsed = getAddress(account); + if (memo[parsed]) throw new Error(`Duplicate address: ${parsed}`); + const parsedNum = BigNumber.from(balance); + if (parsedNum.lte(0)) throw new Error(`Invalid amount for account: ${account}`); + + memo[parsed] = { amount: parsedNum }; + return memo; + }, + {} as { [key: string]: { amount: BigNumber } } + ); const sortedAddresses = Object.keys(dataByAddress).sort(); @@ -45,14 +48,17 @@ export function parseBalanceMap(balances: Balance[] | { [addr: string]: BigNumbe ); // generate claims - const claims = sortedAddresses.reduce((memo, address) => { - const { amount } = dataByAddress[address]; - memo[address] = { - amount: amount.toHexString(), - proof: tree.getProof(address, amount), - }; - return memo; - }, {} as { [key: string]: { amount: string; proof: string[] } }); + const claims = sortedAddresses.reduce( + (memo, address) => { + const { amount } = dataByAddress[address]; + memo[address] = { + amount: amount.toHexString(), + proof: tree.getProof(address, amount), + }; + return memo; + }, + {} as { [key: string]: { amount: string; proof: string[] } } + ); return { merkleRoot: tree.getHexRoot(), diff --git a/utils/core-utils/test/fixtures/initializable-ast.json b/utils/core-utils/test/fixtures/initializable-ast.json index 047a61e12e..179e8c4b02 100644 --- a/utils/core-utils/test/fixtures/initializable-ast.json +++ b/utils/core-utils/test/fixtures/initializable-ast.json @@ -1,424 +1,440 @@ { "contracts/errors/InitError.sol": { - "absolutePath": "contracts/errors/InitError.sol", - "exportedSymbols": { - "InitError": [ - 75 - ], - "c_0x4527f593": [ - 64 - ] + "absolutePath": "contracts/errors/InitError.sol", + "exportedSymbols": { + "InitError": [75], + "c_0x4527f593": [64] + }, + "id": 76, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 58, + "literals": ["solidity", "^", "0.8", ".0"], + "nodeType": "PragmaDirective", + "src": "31:23:3" }, - "id": 76, - "license": "MIT", - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 58, - "literals": [ - "solidity", - "^", - "0.8", - ".0" - ], - "nodeType": "PragmaDirective", - "src": "31:23:3" + { + "body": { + "id": 63, + "nodeType": "Block", + "src": "105:2:3", + "statements": [] }, - { - "body": { - "id": 63, - "nodeType": "Block", - "src": "105:2:3", - "statements": [] - }, - "id": 64, - "implemented": true, - "kind": "freeFunction", - "modifiers": [], - "name": "c_0x4527f593", - "nameLocation": "64:12:3", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 61, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 60, - "mutability": "mutable", - "name": "c__0x4527f593", - "nameLocation": "85:13:3", - "nodeType": "VariableDeclaration", - "scope": 64, - "src": "77:21:3", - "stateVariable": false, - "storageLocation": "default", + "id": 64, + "implemented": true, + "kind": "freeFunction", + "modifiers": [], + "name": "c_0x4527f593", + "nameLocation": "64:12:3", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 61, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 60, + "mutability": "mutable", + "name": "c__0x4527f593", + "nameLocation": "85:13:3", + "nodeType": "VariableDeclaration", + "scope": 64, + "src": "77:21:3", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 59, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "77:7:3", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" - }, - "typeName": { - "id": 59, - "name": "bytes32", - "nodeType": "ElementaryTypeName", - "src": "77:7:3", + } + }, + "visibility": "internal" + } + ], + "src": "76:23:3" + }, + "returnParameters": { + "id": 62, + "nodeType": "ParameterList", + "parameters": [], + "src": "105:0:3" + }, + "scope": 76, + "src": "55:52:3", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "abstract": false, + "baseContracts": [], + "contractDependencies": [], + "contractKind": "library", + "fullyImplemented": true, + "id": 75, + "linearizedBaseContracts": [75], + "name": "InitError", + "nameLocation": "118:9:3", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 69, + "nodeType": "Block", + "src": "187:2:3", + "statements": [] + }, + "functionSelector": "4fd09189", + "id": 70, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "c_0xf21fc19c", + "nameLocation": "139:12:3", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 67, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 66, + "mutability": "mutable", + "name": "c__0xf21fc19c", + "nameLocation": "160:13:3", + "nodeType": "VariableDeclaration", + "scope": 70, + "src": "152:21:3", + "stateVariable": false, + "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" - } - }, - "visibility": "internal" - } - ], - "src": "76:23:3" - }, - "returnParameters": { - "id": 62, - "nodeType": "ParameterList", - "parameters": [], - "src": "105:0:3" - }, - "scope": 76, - "src": "55:52:3", - "stateMutability": "pure", - "virtual": false, - "visibility": "internal" - }, - { - "abstract": false, - "baseContracts": [], - "contractDependencies": [], - "contractKind": "library", - "fullyImplemented": true, - "id": 75, - "linearizedBaseContracts": [ - 75 - ], - "name": "InitError", - "nameLocation": "118:9:3", - "nodeType": "ContractDefinition", - "nodes": [ - { - "body": { - "id": 69, - "nodeType": "Block", - "src": "187:2:3", - "statements": [] - }, - "functionSelector": "4fd09189", - "id": 70, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "c_0xf21fc19c", - "nameLocation": "139:12:3", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 67, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 66, - "mutability": "mutable", - "name": "c__0xf21fc19c", - "nameLocation": "160:13:3", - "nodeType": "VariableDeclaration", - "scope": 70, - "src": "152:21:3", - "stateVariable": false, - "storageLocation": "default", + }, + "typeName": { + "id": 65, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "152:7:3", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" - }, - "typeName": { - "id": 65, - "name": "bytes32", - "nodeType": "ElementaryTypeName", - "src": "152:7:3", - "typeDescriptions": { - "typeIdentifier": "t_bytes32", - "typeString": "bytes32" - } - }, - "visibility": "internal" - } - ], - "src": "151:23:3" - }, - "returnParameters": { - "id": 68, - "nodeType": "ParameterList", - "parameters": [], - "src": "187:0:3" - }, - "scope": 75, - "src": "130:59:3", - "stateMutability": "pure", - "virtual": false, - "visibility": "public" + } + }, + "visibility": "internal" + } + ], + "src": "151:23:3" }, - { - "id": 72, - "name": "AlreadyInitialized", - "nameLocation": "201:18:3", - "nodeType": "ErrorDefinition", - "parameters": { - "id": 71, - "nodeType": "ParameterList", - "parameters": [], - "src": "219:2:3" - }, - "src": "195:27:3" + "returnParameters": { + "id": 68, + "nodeType": "ParameterList", + "parameters": [], + "src": "187:0:3" }, - { - "id": 74, - "name": "NotInitialized", - "nameLocation": "233:14:3", - "nodeType": "ErrorDefinition", - "parameters": { - "id": 73, - "nodeType": "ParameterList", - "parameters": [], - "src": "247:2:3" - }, - "src": "227:23:3" - } - ], - "scope": 76, - "src": "110:142:3", - "usedErrors": [ - 72, - 74 - ] - } - ], - "src": "31:222:3" + "scope": 75, + "src": "130:59:3", + "stateMutability": "pure", + "virtual": false, + "visibility": "public" + }, + { + "id": 72, + "name": "AlreadyInitialized", + "nameLocation": "201:18:3", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 71, + "nodeType": "ParameterList", + "parameters": [], + "src": "219:2:3" + }, + "src": "195:27:3" + }, + { + "id": 74, + "name": "NotInitialized", + "nameLocation": "233:14:3", + "nodeType": "ErrorDefinition", + "parameters": { + "id": 73, + "nodeType": "ParameterList", + "parameters": [], + "src": "247:2:3" + }, + "src": "227:23:3" + } + ], + "scope": 76, + "src": "110:142:3", + "usedErrors": [72, 74] + } + ], + "src": "31:222:3" }, "contracts/initializable/InitializableMixin.sol": { - "absolutePath": "contracts/initializable/InitializableMixin.sol", - "exportedSymbols": { - "InitError": [ - 75 - ], - "InitializableMixin": [ - 165 - ], - "c_0x20d02a49": [ - 83 - ], - "c_0x4527f593": [ - 64 - ] + "absolutePath": "contracts/initializable/InitializableMixin.sol", + "exportedSymbols": { + "InitError": [75], + "InitializableMixin": [165], + "c_0x20d02a49": [83], + "c_0x4527f593": [64] + }, + "id": 166, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 77, + "literals": ["solidity", "^", "0.8", ".0"], + "nodeType": "PragmaDirective", + "src": "31:23:4" }, - "id": 166, - "license": "MIT", - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 77, - "literals": [ - "solidity", - "^", - "0.8", - ".0" - ], - "nodeType": "PragmaDirective", - "src": "31:23:4" + { + "body": { + "id": 82, + "nodeType": "Block", + "src": "105:2:4", + "statements": [] }, - { - "body": { - "id": 82, - "nodeType": "Block", - "src": "105:2:4", - "statements": [] - }, - "id": 83, - "implemented": true, - "kind": "freeFunction", - "modifiers": [], - "name": "c_0x20d02a49", - "nameLocation": "64:12:4", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 80, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 79, - "mutability": "mutable", - "name": "c__0x20d02a49", - "nameLocation": "85:13:4", - "nodeType": "VariableDeclaration", - "scope": 83, - "src": "77:21:4", - "stateVariable": false, - "storageLocation": "default", + "id": 83, + "implemented": true, + "kind": "freeFunction", + "modifiers": [], + "name": "c_0x20d02a49", + "nameLocation": "64:12:4", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 80, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 79, + "mutability": "mutable", + "name": "c__0x20d02a49", + "nameLocation": "85:13:4", + "nodeType": "VariableDeclaration", + "scope": 83, + "src": "77:21:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 78, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "77:7:4", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" - }, - "typeName": { - "id": 78, - "name": "bytes32", - "nodeType": "ElementaryTypeName", - "src": "77:7:4", + } + }, + "visibility": "internal" + } + ], + "src": "76:23:4" + }, + "returnParameters": { + "id": 81, + "nodeType": "ParameterList", + "parameters": [], + "src": "105:0:4" + }, + "scope": 166, + "src": "55:52:4", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "absolutePath": "contracts/errors/InitError.sol", + "file": "../errors/InitError.sol", + "id": 84, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 166, + "sourceUnit": 76, + "src": "110:33:4", + "symbolAliases": [], + "unitAlias": "" + }, + { + "abstract": true, + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": false, + "id": 165, + "linearizedBaseContracts": [165], + "name": "InitializableMixin", + "nameLocation": "163:18:4", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 89, + "nodeType": "Block", + "src": "241:2:4", + "statements": [] + }, + "functionSelector": "2a59b760", + "id": 90, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "c_0x0b1c142e", + "nameLocation": "193:12:4", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 87, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 86, + "mutability": "mutable", + "name": "c__0x0b1c142e", + "nameLocation": "214:13:4", + "nodeType": "VariableDeclaration", + "scope": 90, + "src": "206:21:4", + "stateVariable": false, + "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" - } - }, - "visibility": "internal" - } - ], - "src": "76:23:4" - }, - "returnParameters": { - "id": 81, - "nodeType": "ParameterList", - "parameters": [], - "src": "105:0:4" - }, - "scope": 166, - "src": "55:52:4", - "stateMutability": "pure", - "virtual": false, - "visibility": "internal" - }, - { - "absolutePath": "contracts/errors/InitError.sol", - "file": "../errors/InitError.sol", - "id": 84, - "nameLocation": "-1:-1:-1", - "nodeType": "ImportDirective", - "scope": 166, - "sourceUnit": 76, - "src": "110:33:4", - "symbolAliases": [], - "unitAlias": "" - }, - { - "abstract": true, - "baseContracts": [], - "contractDependencies": [], - "contractKind": "contract", - "fullyImplemented": false, - "id": 165, - "linearizedBaseContracts": [ - 165 - ], - "name": "InitializableMixin", - "nameLocation": "163:18:4", - "nodeType": "ContractDefinition", - "nodes": [ - { - "body": { - "id": 89, - "nodeType": "Block", - "src": "241:2:4", - "statements": [] - }, - "functionSelector": "2a59b760", - "id": 90, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "c_0x0b1c142e", - "nameLocation": "193:12:4", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 87, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 86, - "mutability": "mutable", - "name": "c__0x0b1c142e", - "nameLocation": "214:13:4", - "nodeType": "VariableDeclaration", - "scope": 90, - "src": "206:21:4", - "stateVariable": false, - "storageLocation": "default", + }, + "typeName": { + "id": 85, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "206:7:4", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" - }, - "typeName": { - "id": 85, - "name": "bytes32", - "nodeType": "ElementaryTypeName", - "src": "206:7:4", - "typeDescriptions": { - "typeIdentifier": "t_bytes32", - "typeString": "bytes32" - } - }, - "visibility": "internal" - } - ], - "src": "205:23:4" - }, - "returnParameters": { - "id": 88, - "nodeType": "ParameterList", - "parameters": [], - "src": "241:0:4" - }, - "scope": 165, - "src": "184:59:4", - "stateMutability": "pure", - "virtual": false, - "visibility": "public" + } + }, + "visibility": "internal" + } + ], + "src": "205:23:4" }, - { - "body": { - "id": 124, - "nodeType": "Block", - "src": "278:591:4", - "statements": [ - { + "returnParameters": { + "id": 88, + "nodeType": "ParameterList", + "parameters": [], + "src": "241:0:4" + }, + "scope": 165, + "src": "184:59:4", + "stateMutability": "pure", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 124, + "nodeType": "Block", + "src": "278:591:4", + "statements": [ + { + "expression": { + "arguments": [ + { + "hexValue": "307832656664366131336135653364383432353234646232366138363632623237633236633761653065613433623630653334356339326430643661343564646332", + "id": 93, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "293:66:4", + "typeDescriptions": { + "typeIdentifier": "t_rational_21254135457041189600045374582499923899359739198616972010683209621041771306434_by_1", + "typeString": "int_const 2125...(69 digits omitted)...6434" + }, + "value": "0x2efd6a13a5e3d842524db26a8662b27c26c7ae0ea43b60e345c92d0d6a45ddc2" + } + ], "expression": { - "arguments": [ + "argumentTypes": [ { - "hexValue": "307832656664366131336135653364383432353234646232366138363632623237633236633761653065613433623630653334356339326430643661343564646332", - "id": 93, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "293:66:4", - "typeDescriptions": { - "typeIdentifier": "t_rational_21254135457041189600045374582499923899359739198616972010683209621041771306434_by_1", - "typeString": "int_const 2125...(69 digits omitted)...6434" - }, - "value": "0x2efd6a13a5e3d842524db26a8662b27c26c7ae0ea43b60e345c92d0d6a45ddc2" + "typeIdentifier": "t_rational_21254135457041189600045374582499923899359739198616972010683209621041771306434_by_1", + "typeString": "int_const 2125...(69 digits omitted)...6434" } ], + "id": 92, + "name": "c_0x0b1c142e", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 90, + "src": "280:12:4", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", + "typeString": "function (bytes32) pure" + } + }, + "id": 94, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "280:80:4", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 95, + "nodeType": "ExpressionStatement", + "src": "280:80:4" + }, + { + "condition": { + "id": 98, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "!", + "prefix": true, + "src": "386:17:4", + "subExpression": { + "arguments": [], "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_rational_21254135457041189600045374582499923899359739198616972010683209621041771306434_by_1", - "typeString": "int_const 2125...(69 digits omitted)...6434" - } - ], - "id": 92, - "name": "c_0x0b1c142e", + "argumentTypes": [], + "id": 96, + "name": "_isInitialized", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 90, - "src": "280:12:4", + "referencedDeclaration": 164, + "src": "387:14:4", "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", - "typeString": "function (bytes32) pure" + "typeIdentifier": "t_function_internal_view$__$returns$_t_bool_$", + "typeString": "function () view returns (bool)" } }, - "id": 94, + "id": 97, "isConstant": false, "isLValue": false, "isPure": false, @@ -426,2325 +442,2253 @@ "lValueRequested": false, "names": [], "nodeType": "FunctionCall", - "src": "280:80:4", + "src": "387:16:4", "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 95, - "nodeType": "ExpressionStatement", - "src": "280:80:4" - }, - { - "condition": { - "id": 98, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "!", - "prefix": true, - "src": "386:17:4", - "subExpression": { - "arguments": [], - "expression": { - "argumentTypes": [], - "id": 96, - "name": "_isInitialized", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 164, - "src": "387:14:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_view$__$returns$_t_bool_$", - "typeString": "function () view returns (bool)" - } - }, - "id": 97, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "387:16:4", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "falseBody": { - "id": 117, - "nodeType": "Block", - "src": "658:99:4", - "statements": [ - { + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 117, + "nodeType": "Block", + "src": "658:99:4", + "statements": [ + { + "expression": { + "arguments": [ + { + "hexValue": "307862346264343433343066366362366161616535653465623633353231313265343130343061336662323137363834343565306230363436346165343939336638", + "id": 114, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "673:66:4", + "typeDescriptions": { + "typeIdentifier": "t_rational_81750717562524279527843287910164877221421167046882221241756347777911460828152_by_1", + "typeString": "int_const 8175...(69 digits omitted)...8152" + }, + "value": "0xb4bd44340f6cb6aaae5e4eb6352112e41040a3fb21768445e0b06464ae4993f8" + } + ], "expression": { - "arguments": [ + "argumentTypes": [ { - "hexValue": "307862346264343433343066366362366161616535653465623633353231313265343130343061336662323137363834343565306230363436346165343939336638", - "id": 114, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "673:66:4", - "typeDescriptions": { - "typeIdentifier": "t_rational_81750717562524279527843287910164877221421167046882221241756347777911460828152_by_1", - "typeString": "int_const 8175...(69 digits omitted)...8152" - }, - "value": "0xb4bd44340f6cb6aaae5e4eb6352112e41040a3fb21768445e0b06464ae4993f8" + "typeIdentifier": "t_rational_81750717562524279527843287910164877221421167046882221241756347777911460828152_by_1", + "typeString": "int_const 8175...(69 digits omitted)...8152" } ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_rational_81750717562524279527843287910164877221421167046882221241756347777911460828152_by_1", - "typeString": "int_const 8175...(69 digits omitted)...8152" - } - ], - "id": 113, - "name": "c_0x0b1c142e", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 90, - "src": "660:12:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", - "typeString": "function (bytes32) pure" - } - }, - "id": 115, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "660:80:4", - "tryCall": false, + "id": 113, + "name": "c_0x0b1c142e", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 90, + "src": "660:12:4", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", + "typeString": "function (bytes32) pure" } }, - "id": 116, - "nodeType": "ExpressionStatement", - "src": "660:80:4" - } - ] - }, - "id": 118, - "nodeType": "IfStatement", - "src": "382:375:4", - "trueBody": { - "id": 112, - "nodeType": "Block", - "src": "405:248:4", - "statements": [ - { + "id": 115, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "660:80:4", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 116, + "nodeType": "ExpressionStatement", + "src": "660:80:4" + } + ] + }, + "id": 118, + "nodeType": "IfStatement", + "src": "382:375:4", + "trueBody": { + "id": 112, + "nodeType": "Block", + "src": "405:248:4", + "statements": [ + { + "expression": { + "arguments": [ + { + "hexValue": "307832656138396433363463616632363135363766366434366334346437616239643632633062366237616339616332386263346136656537636364343738356132", + "id": 100, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "419:66:4", + "typeDescriptions": { + "typeIdentifier": "t_rational_21104306379802374766399243002839284502569186139580363441585407338413988218274_by_1", + "typeString": "int_const 2110...(69 digits omitted)...8274" + }, + "value": "0x2ea89d364caf261567f6d46c44d7ab9d62c0b6b7ac9ac28bc4a6ee7ccd4785a2" + } + ], "expression": { - "arguments": [ + "argumentTypes": [ { - "hexValue": "307832656138396433363463616632363135363766366434366334346437616239643632633062366237616339616332386263346136656537636364343738356132", - "id": 100, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "419:66:4", - "typeDescriptions": { - "typeIdentifier": "t_rational_21104306379802374766399243002839284502569186139580363441585407338413988218274_by_1", - "typeString": "int_const 2110...(69 digits omitted)...8274" - }, - "value": "0x2ea89d364caf261567f6d46c44d7ab9d62c0b6b7ac9ac28bc4a6ee7ccd4785a2" + "typeIdentifier": "t_rational_21104306379802374766399243002839284502569186139580363441585407338413988218274_by_1", + "typeString": "int_const 2110...(69 digits omitted)...8274" } ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_rational_21104306379802374766399243002839284502569186139580363441585407338413988218274_by_1", - "typeString": "int_const 2110...(69 digits omitted)...8274" - } - ], - "id": 99, - "name": "c_0x0b1c142e", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 90, - "src": "406:12:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", - "typeString": "function (bytes32) pure" - } - }, - "id": 101, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "406:80:4", - "tryCall": false, + "id": 99, + "name": "c_0x0b1c142e", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 90, + "src": "406:12:4", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", + "typeString": "function (bytes32) pure" } }, - "id": 102, - "nodeType": "ExpressionStatement", - "src": "406:80:4" + "id": 101, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "406:80:4", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } }, - { + "id": 102, + "nodeType": "ExpressionStatement", + "src": "406:80:4" + }, + { + "expression": { + "arguments": [ + { + "hexValue": "307838323430613438393264373530643439316235633330313430323032383130346432336433303661633531623635343463366131373761353933386530613034", + "id": 104, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "516:66:4", + "typeDescriptions": { + "typeIdentifier": "t_rational_58914884112671219620204851673542646184147026271851706222681837841240292198916_by_1", + "typeString": "int_const 5891...(69 digits omitted)...8916" + }, + "value": "0x8240a4892d750d491b5c301402028104d23d306ac51b6544c6a177a5938e0a04" + } + ], "expression": { - "arguments": [ + "argumentTypes": [ { - "hexValue": "307838323430613438393264373530643439316235633330313430323032383130346432336433303661633531623635343463366131373761353933386530613034", - "id": 104, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "516:66:4", - "typeDescriptions": { - "typeIdentifier": "t_rational_58914884112671219620204851673542646184147026271851706222681837841240292198916_by_1", - "typeString": "int_const 5891...(69 digits omitted)...8916" - }, - "value": "0x8240a4892d750d491b5c301402028104d23d306ac51b6544c6a177a5938e0a04" + "typeIdentifier": "t_rational_58914884112671219620204851673542646184147026271851706222681837841240292198916_by_1", + "typeString": "int_const 5891...(69 digits omitted)...8916" } ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_rational_58914884112671219620204851673542646184147026271851706222681837841240292198916_by_1", - "typeString": "int_const 5891...(69 digits omitted)...8916" - } - ], - "id": 103, - "name": "c_0x0b1c142e", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 90, - "src": "503:12:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", - "typeString": "function (bytes32) pure" - } - }, - "id": 105, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "503:80:4", - "tryCall": false, + "id": 103, + "name": "c_0x0b1c142e", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 90, + "src": "503:12:4", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", + "typeString": "function (bytes32) pure" } }, - "id": 106, - "nodeType": "ExpressionStatement", - "src": "503:80:4" + "id": 105, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "503:80:4", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } }, - { - "errorCall": { - "arguments": [], + "id": 106, + "nodeType": "ExpressionStatement", + "src": "503:80:4" + }, + { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], "expression": { - "argumentTypes": [], - "expression": { - "id": 107, - "name": "InitError", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 75, - "src": "616:9:4", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_InitError_$75_$", - "typeString": "type(library InitError)" - } - }, - "id": 109, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "NotInitialized", - "nodeType": "MemberAccess", - "referencedDeclaration": 74, - "src": "616:24:4", + "id": 107, + "name": "InitError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 75, + "src": "616:9:4", "typeDescriptions": { - "typeIdentifier": "t_function_error_pure$__$returns$__$", - "typeString": "function () pure" + "typeIdentifier": "t_type$_t_contract$_InitError_$75_$", + "typeString": "type(library InitError)" } }, - "id": 110, + "id": 109, "isConstant": false, "isLValue": false, "isPure": false, - "kind": "functionCall", "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "616:26:4", - "tryCall": false, + "memberName": "NotInitialized", + "nodeType": "MemberAccess", + "referencedDeclaration": 74, + "src": "616:24:4", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_function_error_pure$__$returns$__$", + "typeString": "function () pure" } }, - "id": 111, - "nodeType": "RevertStatement", - "src": "609:33:4" - } - ] - } - }, - { - "expression": { - "arguments": [ - { - "hexValue": "307866313635643831316163663738653435356631393631343464326361323531323533366138373531306138346236373161343037643633313234346439383830", - "id": 120, + "id": 110, "isConstant": false, "isLValue": false, - "isPure": true, - "kind": "number", + "isPure": false, + "kind": "functionCall", "lValueRequested": false, - "nodeType": "Literal", - "src": "772:66:4", + "names": [], + "nodeType": "FunctionCall", + "src": "616:26:4", + "tryCall": false, "typeDescriptions": { - "typeIdentifier": "t_rational_109187339315855369212658547312453633208645472953126731259396224803728522057856_by_1", - "typeString": "int_const 1091...(70 digits omitted)...7856" - }, - "value": "0xf165d811acf78e455f196144d2ca2512536a87510a84b671a407d631244d9880" - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_rational_109187339315855369212658547312453633208645472953126731259396224803728522057856_by_1", - "typeString": "int_const 1091...(70 digits omitted)...7856" + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" } - ], - "id": 119, - "name": "c_0x0b1c142e", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 90, - "src": "759:12:4", + }, + "id": 111, + "nodeType": "RevertStatement", + "src": "609:33:4" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "hexValue": "307866313635643831316163663738653435356631393631343464326361323531323533366138373531306138346236373161343037643633313234346439383830", + "id": 120, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "772:66:4", "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", - "typeString": "function (bytes32) pure" + "typeIdentifier": "t_rational_109187339315855369212658547312453633208645472953126731259396224803728522057856_by_1", + "typeString": "int_const 1091...(70 digits omitted)...7856" + }, + "value": "0xf165d811acf78e455f196144d2ca2512536a87510a84b671a407d631244d9880" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_109187339315855369212658547312453633208645472953126731259396224803728522057856_by_1", + "typeString": "int_const 1091...(70 digits omitted)...7856" } - }, - "id": 121, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "759:80:4", - "tryCall": false, + ], + "id": 119, + "name": "c_0x0b1c142e", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 90, + "src": "759:12:4", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", + "typeString": "function (bytes32) pure" } }, - "id": 122, - "nodeType": "ExpressionStatement", - "src": "759:80:4" + "id": 121, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "759:80:4", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } }, - { - "id": 123, - "nodeType": "PlaceholderStatement", - "src": "861:1:4" - } - ] - }, - "id": 125, - "name": "onlyIfInitialized", - "nameLocation": "258:17:4", - "nodeType": "ModifierDefinition", - "parameters": { - "id": 91, - "nodeType": "ParameterList", - "parameters": [], - "src": "275:2:4" - }, - "src": "249:620:4", - "virtual": false, - "visibility": "internal" + "id": 122, + "nodeType": "ExpressionStatement", + "src": "759:80:4" + }, + { + "id": 123, + "nodeType": "PlaceholderStatement", + "src": "861:1:4" + } + ] }, - { - "body": { - "id": 158, - "nodeType": "Block", - "src": "907:594:4", - "statements": [ - { + "id": 125, + "name": "onlyIfInitialized", + "nameLocation": "258:17:4", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 91, + "nodeType": "ParameterList", + "parameters": [], + "src": "275:2:4" + }, + "src": "249:620:4", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 158, + "nodeType": "Block", + "src": "907:594:4", + "statements": [ + { + "expression": { + "arguments": [ + { + "hexValue": "307866343862643963666231356337633862656365396635636536646134376135643833383738363064333933333136613666636137646661653762336265653737", + "id": 128, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "922:66:4", + "typeDescriptions": { + "typeIdentifier": "t_rational_110611430074665730206224235490848448037427698005050110958454229905221829258871_by_1", + "typeString": "int_const 1106...(70 digits omitted)...8871" + }, + "value": "0xf48bd9cfb15c7c8bece9f5ce6da47a5d8387860d393316a6fca7dfae7b3bee77" + } + ], "expression": { - "arguments": [ + "argumentTypes": [ { - "hexValue": "307866343862643963666231356337633862656365396635636536646134376135643833383738363064333933333136613666636137646661653762336265653737", - "id": 128, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "922:66:4", - "typeDescriptions": { - "typeIdentifier": "t_rational_110611430074665730206224235490848448037427698005050110958454229905221829258871_by_1", - "typeString": "int_const 1106...(70 digits omitted)...8871" - }, - "value": "0xf48bd9cfb15c7c8bece9f5ce6da47a5d8387860d393316a6fca7dfae7b3bee77" + "typeIdentifier": "t_rational_110611430074665730206224235490848448037427698005050110958454229905221829258871_by_1", + "typeString": "int_const 1106...(70 digits omitted)...8871" } ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_rational_110611430074665730206224235490848448037427698005050110958454229905221829258871_by_1", - "typeString": "int_const 1106...(70 digits omitted)...8871" - } - ], - "id": 127, - "name": "c_0x0b1c142e", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 90, - "src": "909:12:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", - "typeString": "function (bytes32) pure" - } - }, - "id": 129, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "909:80:4", - "tryCall": false, + "id": 127, + "name": "c_0x0b1c142e", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 90, + "src": "909:12:4", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", + "typeString": "function (bytes32) pure" } }, - "id": 130, - "nodeType": "ExpressionStatement", - "src": "909:80:4" + "id": 129, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "909:80:4", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } }, - { - "condition": { - "arguments": [], - "expression": { - "argumentTypes": [], - "id": 131, - "name": "_isInitialized", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 164, - "src": "1015:14:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_view$__$returns$_t_bool_$", - "typeString": "function () view returns (bool)" - } - }, - "id": 132, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1015:16:4", - "tryCall": false, + "id": 130, + "nodeType": "ExpressionStatement", + "src": "909:80:4" + }, + { + "condition": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 131, + "name": "_isInitialized", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 164, + "src": "1015:14:4", "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" + "typeIdentifier": "t_function_internal_view$__$returns$_t_bool_$", + "typeString": "function () view returns (bool)" } }, - "falseBody": { - "id": 151, - "nodeType": "Block", - "src": "1290:99:4", - "statements": [ - { + "id": 132, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1015:16:4", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 151, + "nodeType": "Block", + "src": "1290:99:4", + "statements": [ + { + "expression": { + "arguments": [ + { + "hexValue": "307863383731623061663738363630363937613064386637303062363431373031313430303632326330326132643638643733653536613235343632613866373464", + "id": 148, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1305:66:4", + "typeDescriptions": { + "typeIdentifier": "t_rational_90663442873000382954349447683666734730555402008362772835191044848485638141773_by_1", + "typeString": "int_const 9066...(69 digits omitted)...1773" + }, + "value": "0xc871b0af78660697a0d8f700b6417011400622c02a2d68d73e56a25462a8f74d" + } + ], "expression": { - "arguments": [ + "argumentTypes": [ { - "hexValue": "307863383731623061663738363630363937613064386637303062363431373031313430303632326330326132643638643733653536613235343632613866373464", - "id": 148, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1305:66:4", - "typeDescriptions": { - "typeIdentifier": "t_rational_90663442873000382954349447683666734730555402008362772835191044848485638141773_by_1", - "typeString": "int_const 9066...(69 digits omitted)...1773" - }, - "value": "0xc871b0af78660697a0d8f700b6417011400622c02a2d68d73e56a25462a8f74d" + "typeIdentifier": "t_rational_90663442873000382954349447683666734730555402008362772835191044848485638141773_by_1", + "typeString": "int_const 9066...(69 digits omitted)...1773" } ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_rational_90663442873000382954349447683666734730555402008362772835191044848485638141773_by_1", - "typeString": "int_const 9066...(69 digits omitted)...1773" - } - ], - "id": 147, - "name": "c_0x0b1c142e", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 90, - "src": "1292:12:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", - "typeString": "function (bytes32) pure" - } - }, - "id": 149, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1292:80:4", - "tryCall": false, + "id": 147, + "name": "c_0x0b1c142e", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 90, + "src": "1292:12:4", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", + "typeString": "function (bytes32) pure" } }, - "id": 150, - "nodeType": "ExpressionStatement", - "src": "1292:80:4" - } - ] - }, - "id": 152, - "nodeType": "IfStatement", - "src": "1011:378:4", - "trueBody": { - "id": 146, - "nodeType": "Block", - "src": "1033:252:4", - "statements": [ - { + "id": 149, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1292:80:4", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 150, + "nodeType": "ExpressionStatement", + "src": "1292:80:4" + } + ] + }, + "id": 152, + "nodeType": "IfStatement", + "src": "1011:378:4", + "trueBody": { + "id": 146, + "nodeType": "Block", + "src": "1033:252:4", + "statements": [ + { + "expression": { + "arguments": [ + { + "hexValue": "307830306539303938326537353233623138346234626635326465323761303265363330313361666337656433343632643438386232656534633738653838633339", + "id": 134, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1047:66:4", + "typeDescriptions": { + "typeIdentifier": "t_rational_411741010964518574153286272307753806810615342460445277369250292986156715065_by_1", + "typeString": "int_const 4117...(67 digits omitted)...5065" + }, + "value": "0x00e90982e7523b184b4bf52de27a02e63013afc7ed3462d488b2ee4c78e88c39" + } + ], "expression": { - "arguments": [ + "argumentTypes": [ { - "hexValue": "307830306539303938326537353233623138346234626635326465323761303265363330313361666337656433343632643438386232656534633738653838633339", - "id": 134, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1047:66:4", - "typeDescriptions": { - "typeIdentifier": "t_rational_411741010964518574153286272307753806810615342460445277369250292986156715065_by_1", - "typeString": "int_const 4117...(67 digits omitted)...5065" - }, - "value": "0x00e90982e7523b184b4bf52de27a02e63013afc7ed3462d488b2ee4c78e88c39" + "typeIdentifier": "t_rational_411741010964518574153286272307753806810615342460445277369250292986156715065_by_1", + "typeString": "int_const 4117...(67 digits omitted)...5065" } ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_rational_411741010964518574153286272307753806810615342460445277369250292986156715065_by_1", - "typeString": "int_const 4117...(67 digits omitted)...5065" - } - ], - "id": 133, - "name": "c_0x0b1c142e", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 90, - "src": "1034:12:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", - "typeString": "function (bytes32) pure" - } - }, - "id": 135, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1034:80:4", - "tryCall": false, + "id": 133, + "name": "c_0x0b1c142e", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 90, + "src": "1034:12:4", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", + "typeString": "function (bytes32) pure" } }, - "id": 136, - "nodeType": "ExpressionStatement", - "src": "1034:80:4" + "id": 135, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1034:80:4", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } }, - { + "id": 136, + "nodeType": "ExpressionStatement", + "src": "1034:80:4" + }, + { + "expression": { + "arguments": [ + { + "hexValue": "307838353934346433363261343839343663643861666235383932666636343564613561613535333339373063643339313937643437356639666232396138356236", + "id": 138, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1144:66:4", + "typeDescriptions": { + "typeIdentifier": "t_rational_60419635121920427276158478205868839777435041748364499838563173291038875485622_by_1", + "typeString": "int_const 6041...(69 digits omitted)...5622" + }, + "value": "0x85944d362a48946cd8afb5892ff645da5aa5533970cd39197d475f9fb29a85b6" + } + ], "expression": { - "arguments": [ + "argumentTypes": [ { - "hexValue": "307838353934346433363261343839343663643861666235383932666636343564613561613535333339373063643339313937643437356639666232396138356236", - "id": 138, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1144:66:4", - "typeDescriptions": { - "typeIdentifier": "t_rational_60419635121920427276158478205868839777435041748364499838563173291038875485622_by_1", - "typeString": "int_const 6041...(69 digits omitted)...5622" - }, - "value": "0x85944d362a48946cd8afb5892ff645da5aa5533970cd39197d475f9fb29a85b6" + "typeIdentifier": "t_rational_60419635121920427276158478205868839777435041748364499838563173291038875485622_by_1", + "typeString": "int_const 6041...(69 digits omitted)...5622" } ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_rational_60419635121920427276158478205868839777435041748364499838563173291038875485622_by_1", - "typeString": "int_const 6041...(69 digits omitted)...5622" - } - ], - "id": 137, - "name": "c_0x0b1c142e", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 90, - "src": "1131:12:4", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", - "typeString": "function (bytes32) pure" - } - }, - "id": 139, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1131:80:4", - "tryCall": false, + "id": 137, + "name": "c_0x0b1c142e", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 90, + "src": "1131:12:4", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", + "typeString": "function (bytes32) pure" } }, - "id": 140, - "nodeType": "ExpressionStatement", - "src": "1131:80:4" + "id": 139, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1131:80:4", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } }, - { - "errorCall": { - "arguments": [], + "id": 140, + "nodeType": "ExpressionStatement", + "src": "1131:80:4" + }, + { + "errorCall": { + "arguments": [], + "expression": { + "argumentTypes": [], "expression": { - "argumentTypes": [], - "expression": { - "id": 141, - "name": "InitError", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 75, - "src": "1244:9:4", - "typeDescriptions": { - "typeIdentifier": "t_type$_t_contract$_InitError_$75_$", - "typeString": "type(library InitError)" - } - }, - "id": 143, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberName": "AlreadyInitialized", - "nodeType": "MemberAccess", - "referencedDeclaration": 72, - "src": "1244:28:4", + "id": 141, + "name": "InitError", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 75, + "src": "1244:9:4", "typeDescriptions": { - "typeIdentifier": "t_function_error_pure$__$returns$__$", - "typeString": "function () pure" + "typeIdentifier": "t_type$_t_contract$_InitError_$75_$", + "typeString": "type(library InitError)" } }, - "id": 144, + "id": 143, "isConstant": false, "isLValue": false, "isPure": false, - "kind": "functionCall", "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1244:30:4", - "tryCall": false, + "memberName": "AlreadyInitialized", + "nodeType": "MemberAccess", + "referencedDeclaration": 72, + "src": "1244:28:4", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_function_error_pure$__$returns$__$", + "typeString": "function () pure" } }, - "id": 145, - "nodeType": "RevertStatement", - "src": "1237:37:4" - } - ] - } - }, - { - "expression": { - "arguments": [ - { - "hexValue": "307833643563363339613532613562316230356266613630343331666638313331366463663164633030343963643232666438633338373733346333383866623163", - "id": 154, + "id": 144, "isConstant": false, "isLValue": false, - "isPure": true, - "kind": "number", + "isPure": false, + "kind": "functionCall", "lValueRequested": false, - "nodeType": "Literal", - "src": "1404:66:4", + "names": [], + "nodeType": "FunctionCall", + "src": "1244:30:4", + "tryCall": false, "typeDescriptions": { - "typeIdentifier": "t_rational_27754321126962750570978144655317332382632103578340188644647626391309670480668_by_1", - "typeString": "int_const 2775...(69 digits omitted)...0668" - }, - "value": "0x3d5c639a52a5b1b05bfa60431ff81316dcf1dc0049cd22fd8c387734c388fb1c" - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_rational_27754321126962750570978144655317332382632103578340188644647626391309670480668_by_1", - "typeString": "int_const 2775...(69 digits omitted)...0668" + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" } - ], - "id": 153, - "name": "c_0x0b1c142e", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 90, - "src": "1391:12:4", + }, + "id": 145, + "nodeType": "RevertStatement", + "src": "1237:37:4" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "hexValue": "307833643563363339613532613562316230356266613630343331666638313331366463663164633030343963643232666438633338373733346333383866623163", + "id": 154, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1404:66:4", "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", - "typeString": "function (bytes32) pure" + "typeIdentifier": "t_rational_27754321126962750570978144655317332382632103578340188644647626391309670480668_by_1", + "typeString": "int_const 2775...(69 digits omitted)...0668" + }, + "value": "0x3d5c639a52a5b1b05bfa60431ff81316dcf1dc0049cd22fd8c387734c388fb1c" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_27754321126962750570978144655317332382632103578340188644647626391309670480668_by_1", + "typeString": "int_const 2775...(69 digits omitted)...0668" } - }, - "id": 155, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1391:80:4", - "tryCall": false, + ], + "id": 153, + "name": "c_0x0b1c142e", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 90, + "src": "1391:12:4", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", + "typeString": "function (bytes32) pure" } }, - "id": 156, - "nodeType": "ExpressionStatement", - "src": "1391:80:4" + "id": 155, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1391:80:4", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } }, - { - "id": 157, - "nodeType": "PlaceholderStatement", - "src": "1493:1:4" - } - ] - }, - "id": 159, - "name": "onlyIfNotInitialized", - "nameLocation": "884:20:4", - "nodeType": "ModifierDefinition", - "parameters": { - "id": 126, - "nodeType": "ParameterList", - "parameters": [], - "src": "904:2:4" - }, - "src": "875:626:4", - "virtual": false, - "visibility": "internal" + "id": 156, + "nodeType": "ExpressionStatement", + "src": "1391:80:4" + }, + { + "id": 157, + "nodeType": "PlaceholderStatement", + "src": "1493:1:4" + } + ] }, - { - "id": 164, - "implemented": false, - "kind": "function", - "modifiers": [], - "name": "_isInitialized", - "nameLocation": "1516:14:4", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 160, - "nodeType": "ParameterList", - "parameters": [], - "src": "1530:2:4" - }, - "returnParameters": { - "id": 163, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 162, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 164, + "id": 159, + "name": "onlyIfNotInitialized", + "nameLocation": "884:20:4", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 126, + "nodeType": "ParameterList", + "parameters": [], + "src": "904:2:4" + }, + "src": "875:626:4", + "virtual": false, + "visibility": "internal" + }, + { + "id": 164, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "_isInitialized", + "nameLocation": "1516:14:4", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 160, + "nodeType": "ParameterList", + "parameters": [], + "src": "1530:2:4" + }, + "returnParameters": { + "id": 163, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 162, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 164, + "src": "1564:4:4", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 161, + "name": "bool", + "nodeType": "ElementaryTypeName", "src": "1564:4:4", - "stateVariable": false, - "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" - }, - "typeName": { - "id": 161, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "1564:4:4", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "visibility": "internal" - } - ], - "src": "1563:6:4" - }, - "scope": 165, - "src": "1507:63:4", - "stateMutability": "view", - "virtual": true, - "visibility": "internal" - } - ], - "scope": 166, - "src": "145:1427:4", - "usedErrors": [] - } - ], - "src": "31:1542:4" + } + }, + "visibility": "internal" + } + ], + "src": "1563:6:4" + }, + "scope": 165, + "src": "1507:63:4", + "stateMutability": "view", + "virtual": true, + "visibility": "internal" + } + ], + "scope": 166, + "src": "145:1427:4", + "usedErrors": [] + } + ], + "src": "31:1542:4" }, "contracts/mocks/initializable/InitializableMock.sol": { - "absolutePath": "contracts/mocks/initializable/InitializableMock.sol", - "exportedSymbols": { - "InitError": [ - 75 - ], - "InitializableMixin": [ - 165 - ], - "InitializableMock": [ - 592 - ], - "c_0x20d02a49": [ - 83 - ], - "c_0x4527f593": [ - 64 - ], - "c_0xcefe244c": [ - 472 - ] + "absolutePath": "contracts/mocks/initializable/InitializableMock.sol", + "exportedSymbols": { + "InitError": [75], + "InitializableMixin": [165], + "InitializableMock": [592], + "c_0x20d02a49": [83], + "c_0x4527f593": [64], + "c_0xcefe244c": [472] + }, + "id": 593, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 466, + "literals": ["solidity", "^", "0.8", ".0"], + "nodeType": "PragmaDirective", + "src": "31:23:13" }, - "id": 593, - "license": "MIT", - "nodeType": "SourceUnit", - "nodes": [ - { - "id": 466, - "literals": [ - "solidity", - "^", - "0.8", - ".0" - ], - "nodeType": "PragmaDirective", - "src": "31:23:13" + { + "body": { + "id": 471, + "nodeType": "Block", + "src": "105:2:13", + "statements": [] }, - { - "body": { - "id": 471, - "nodeType": "Block", - "src": "105:2:13", - "statements": [] - }, - "id": 472, - "implemented": true, - "kind": "freeFunction", - "modifiers": [], - "name": "c_0xcefe244c", - "nameLocation": "64:12:13", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 469, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 468, - "mutability": "mutable", - "name": "c__0xcefe244c", - "nameLocation": "85:13:13", - "nodeType": "VariableDeclaration", - "scope": 472, - "src": "77:21:13", - "stateVariable": false, - "storageLocation": "default", + "id": 472, + "implemented": true, + "kind": "freeFunction", + "modifiers": [], + "name": "c_0xcefe244c", + "nameLocation": "64:12:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 469, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 468, + "mutability": "mutable", + "name": "c__0xcefe244c", + "nameLocation": "85:13:13", + "nodeType": "VariableDeclaration", + "scope": 472, + "src": "77:21:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 467, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "77:7:13", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" - }, - "typeName": { - "id": 467, - "name": "bytes32", - "nodeType": "ElementaryTypeName", - "src": "77:7:13", - "typeDescriptions": { - "typeIdentifier": "t_bytes32", - "typeString": "bytes32" - } - }, - "visibility": "internal" - } - ], - "src": "76:23:13" - }, - "returnParameters": { - "id": 470, - "nodeType": "ParameterList", - "parameters": [], - "src": "105:0:13" - }, - "scope": 593, - "src": "55:52:13", - "stateMutability": "pure", - "virtual": false, - "visibility": "internal" - }, - { - "absolutePath": "contracts/initializable/InitializableMixin.sol", - "file": "../../initializable/InitializableMixin.sol", - "id": 473, - "nameLocation": "-1:-1:-1", - "nodeType": "ImportDirective", - "scope": 593, - "sourceUnit": 166, - "src": "110:52:13", - "symbolAliases": [], - "unitAlias": "" - }, - { - "abstract": false, - "baseContracts": [ - { - "baseName": { - "id": 474, - "name": "InitializableMixin", - "nodeType": "IdentifierPath", - "referencedDeclaration": 165, - "src": "194:18:13" + } }, - "id": 475, - "nodeType": "InheritanceSpecifier", - "src": "194:18:13" + "visibility": "internal" } ], - "contractDependencies": [], - "contractKind": "contract", - "fullyImplemented": true, - "id": 592, - "linearizedBaseContracts": [ - 592, - 165 - ], - "name": "InitializableMock", - "nameLocation": "173:17:13", - "nodeType": "ContractDefinition", - "nodes": [ - { - "body": { - "id": 480, - "nodeType": "Block", - "src": "272:2:13", - "statements": [] - }, - "functionSelector": "82514d02", - "id": 481, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "c_0x25b48697", - "nameLocation": "224:12:13", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 478, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 477, - "mutability": "mutable", - "name": "c__0x25b48697", - "nameLocation": "245:13:13", - "nodeType": "VariableDeclaration", - "scope": 481, - "src": "237:21:13", - "stateVariable": false, - "storageLocation": "default", + "src": "76:23:13" + }, + "returnParameters": { + "id": 470, + "nodeType": "ParameterList", + "parameters": [], + "src": "105:0:13" + }, + "scope": 593, + "src": "55:52:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "internal" + }, + { + "absolutePath": "contracts/initializable/InitializableMixin.sol", + "file": "../../initializable/InitializableMixin.sol", + "id": 473, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 593, + "sourceUnit": 166, + "src": "110:52:13", + "symbolAliases": [], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [ + { + "baseName": { + "id": 474, + "name": "InitializableMixin", + "nodeType": "IdentifierPath", + "referencedDeclaration": 165, + "src": "194:18:13" + }, + "id": 475, + "nodeType": "InheritanceSpecifier", + "src": "194:18:13" + } + ], + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 592, + "linearizedBaseContracts": [592, 165], + "name": "InitializableMock", + "nameLocation": "173:17:13", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 480, + "nodeType": "Block", + "src": "272:2:13", + "statements": [] + }, + "functionSelector": "82514d02", + "id": 481, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "c_0x25b48697", + "nameLocation": "224:12:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 478, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 477, + "mutability": "mutable", + "name": "c__0x25b48697", + "nameLocation": "245:13:13", + "nodeType": "VariableDeclaration", + "scope": 481, + "src": "237:21:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 476, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "237:7:13", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" - }, - "typeName": { - "id": 476, - "name": "bytes32", - "nodeType": "ElementaryTypeName", - "src": "237:7:13", - "typeDescriptions": { - "typeIdentifier": "t_bytes32", - "typeString": "bytes32" - } - }, - "visibility": "internal" - } - ], - "src": "236:23:13" - }, - "returnParameters": { - "id": 479, - "nodeType": "ParameterList", - "parameters": [], - "src": "272:0:13" - }, - "scope": 592, - "src": "215:59:13", - "stateMutability": "pure", - "virtual": false, - "visibility": "public" + } + }, + "visibility": "internal" + } + ], + "src": "236:23:13" }, - { - "constant": false, - "id": 483, - "mutability": "mutable", - "name": "_initialized", - "nameLocation": "293:12:13", - "nodeType": "VariableDeclaration", - "scope": 592, - "src": "280:25:13", - "stateVariable": true, - "storageLocation": "default", + "returnParameters": { + "id": 479, + "nodeType": "ParameterList", + "parameters": [], + "src": "272:0:13" + }, + "scope": 592, + "src": "215:59:13", + "stateMutability": "pure", + "virtual": false, + "visibility": "public" + }, + { + "constant": false, + "id": 483, + "mutability": "mutable", + "name": "_initialized", + "nameLocation": "293:12:13", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "280:25:13", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 482, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "280:4:13", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" - }, - "typeName": { - "id": 482, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "280:4:13", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "visibility": "private" + } }, - { - "constant": false, - "id": 485, - "mutability": "mutable", - "name": "_value", - "nameLocation": "327:6:13", - "nodeType": "VariableDeclaration", - "scope": 592, - "src": "311:22:13", - "stateVariable": true, - "storageLocation": "default", + "visibility": "private" + }, + { + "constant": false, + "id": 485, + "mutability": "mutable", + "name": "_value", + "nameLocation": "327:6:13", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "311:22:13", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 484, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "311:7:13", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "typeName": { - "id": 484, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "311:7:13", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "private" + } }, - { - "constant": false, - "id": 487, - "mutability": "mutable", - "name": "_nonCriticalValue", - "nameLocation": "355:17:13", - "nodeType": "VariableDeclaration", - "scope": 592, - "src": "339:33:13", - "stateVariable": true, - "storageLocation": "default", + "visibility": "private" + }, + { + "constant": false, + "id": 487, + "mutability": "mutable", + "name": "_nonCriticalValue", + "nameLocation": "355:17:13", + "nodeType": "VariableDeclaration", + "scope": 592, + "src": "339:33:13", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 486, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "339:7:13", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "typeName": { - "id": 486, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "339:7:13", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "private" + } }, - { - "baseFunctions": [ - 164 - ], - "body": { - "id": 499, - "nodeType": "Block", - "src": "443:130:13", - "statements": [ - { + "visibility": "private" + }, + { + "baseFunctions": [164], + "body": { + "id": 499, + "nodeType": "Block", + "src": "443:130:13", + "statements": [ + { + "expression": { + "arguments": [ + { + "hexValue": "307863396637316661323235393835366135663139643539326139643339356331336234363165643530313535363231333966323261623338653364396439353430", + "id": 494, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "458:66:13", + "typeDescriptions": { + "typeIdentifier": "t_rational_91351512115844138781559076022997747605649314101775083518834317106547892524352_by_1", + "typeString": "int_const 9135...(69 digits omitted)...4352" + }, + "value": "0xc9f71fa2259856a5f19d592a9d395c13b461ed5015562139f22ab38e3d9d9540" + } + ], "expression": { - "arguments": [ + "argumentTypes": [ { - "hexValue": "307863396637316661323235393835366135663139643539326139643339356331336234363165643530313535363231333966323261623338653364396439353430", - "id": 494, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "458:66:13", - "typeDescriptions": { - "typeIdentifier": "t_rational_91351512115844138781559076022997747605649314101775083518834317106547892524352_by_1", - "typeString": "int_const 9135...(69 digits omitted)...4352" - }, - "value": "0xc9f71fa2259856a5f19d592a9d395c13b461ed5015562139f22ab38e3d9d9540" + "typeIdentifier": "t_rational_91351512115844138781559076022997747605649314101775083518834317106547892524352_by_1", + "typeString": "int_const 9135...(69 digits omitted)...4352" } ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_rational_91351512115844138781559076022997747605649314101775083518834317106547892524352_by_1", - "typeString": "int_const 9135...(69 digits omitted)...4352" - } - ], - "id": 493, - "name": "c_0x25b48697", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 481, - "src": "445:12:13", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", - "typeString": "function (bytes32) pure" - } - }, - "id": 495, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "445:80:13", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 496, - "nodeType": "ExpressionStatement", - "src": "445:80:13" - }, - { - "expression": { - "id": 497, - "name": "_initialized", + "id": 493, + "name": "c_0x25b48697", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 483, - "src": "554:12:13", + "referencedDeclaration": 481, + "src": "445:12:13", "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", + "typeString": "function (bytes32) pure" } }, - "functionReturnParameters": 492, - "id": 498, - "nodeType": "Return", - "src": "547:19:13" - } - ] - }, - "id": 500, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "_isInitialized", - "nameLocation": "388:14:13", - "nodeType": "FunctionDefinition", - "overrides": { - "id": 489, - "nodeType": "OverrideSpecifier", - "overrides": [], - "src": "419:8:13" - }, - "parameters": { - "id": 488, - "nodeType": "ParameterList", - "parameters": [], - "src": "402:2:13" - }, - "returnParameters": { - "id": 492, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 491, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 500, + "id": 495, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "445:80:13", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 496, + "nodeType": "ExpressionStatement", + "src": "445:80:13" + }, + { + "expression": { + "id": 497, + "name": "_initialized", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 483, + "src": "554:12:13", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 492, + "id": 498, + "nodeType": "Return", + "src": "547:19:13" + } + ] + }, + "id": 500, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_isInitialized", + "nameLocation": "388:14:13", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 489, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "419:8:13" + }, + "parameters": { + "id": 488, + "nodeType": "ParameterList", + "parameters": [], + "src": "402:2:13" + }, + "returnParameters": { + "id": 492, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 491, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 500, + "src": "437:4:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 490, + "name": "bool", + "nodeType": "ElementaryTypeName", "src": "437:4:13", - "stateVariable": false, - "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" - }, - "typeName": { - "id": 490, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "437:4:13", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "visibility": "internal" - } - ], - "src": "436:6:13" - }, - "scope": 592, - "src": "379:194:13", - "stateMutability": "view", - "virtual": false, - "visibility": "internal" + } + }, + "visibility": "internal" + } + ], + "src": "436:6:13" }, - { - "body": { - "id": 523, - "nodeType": "Block", - "src": "666:256:13", - "statements": [ - { + "scope": 592, + "src": "379:194:13", + "stateMutability": "view", + "virtual": false, + "visibility": "internal" + }, + { + "body": { + "id": 523, + "nodeType": "Block", + "src": "666:256:13", + "statements": [ + { + "expression": { + "arguments": [ + { + "hexValue": "307836376361346533336339323465363565303738363639333937356462633431366338343066653135303133393238666261353962653262633663636138303631", + "id": 508, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "681:66:13", + "typeDescriptions": { + "typeIdentifier": "t_rational_46945666243516951678064405628360845769431018845217331743790146126004401897569_by_1", + "typeString": "int_const 4694...(69 digits omitted)...7569" + }, + "value": "0x67ca4e33c924e65e0786693975dbc416c840fe15013928fba59be2bc6cca8061" + } + ], "expression": { - "arguments": [ + "argumentTypes": [ { - "hexValue": "307836376361346533336339323465363565303738363639333937356462633431366338343066653135303133393238666261353962653262633663636138303631", - "id": 508, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "681:66:13", - "typeDescriptions": { - "typeIdentifier": "t_rational_46945666243516951678064405628360845769431018845217331743790146126004401897569_by_1", - "typeString": "int_const 4694...(69 digits omitted)...7569" - }, - "value": "0x67ca4e33c924e65e0786693975dbc416c840fe15013928fba59be2bc6cca8061" + "typeIdentifier": "t_rational_46945666243516951678064405628360845769431018845217331743790146126004401897569_by_1", + "typeString": "int_const 4694...(69 digits omitted)...7569" } ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_rational_46945666243516951678064405628360845769431018845217331743790146126004401897569_by_1", - "typeString": "int_const 4694...(69 digits omitted)...7569" - } - ], - "id": 507, - "name": "c_0x25b48697", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 481, - "src": "668:12:13", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", - "typeString": "function (bytes32) pure" - } - }, - "id": 509, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "668:80:13", - "tryCall": false, + "id": 507, + "name": "c_0x25b48697", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 481, + "src": "668:12:13", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", + "typeString": "function (bytes32) pure" } }, - "id": 510, - "nodeType": "ExpressionStatement", - "src": "668:80:13" + "id": 509, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "668:80:13", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } }, - { - "expression": { - "id": 513, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "id": 511, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 485, - "src": "770:6:13", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "id": 512, - "name": "initialValue", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 502, - "src": "779:12:13", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "770:21:13", + "id": 510, + "nodeType": "ExpressionStatement", + "src": "668:80:13" + }, + { + "expression": { + "id": 513, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 511, + "name": "_value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 485, + "src": "770:6:13", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "id": 514, - "nodeType": "ExpressionStatement", - "src": "770:21:13" - }, - { - "expression": { - "arguments": [ - { - "hexValue": "307834313136306634636539616463613233616435303234356666643131346330663438643864383163623862303938656439366237306662663861636162646163", - "id": 516, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "807:66:13", - "typeDescriptions": { - "typeIdentifier": "t_rational_29439311393097845117733430334224793553313724293264693883065156761890331475372_by_1", - "typeString": "int_const 2943...(69 digits omitted)...5372" - }, - "value": "0x41160f4ce9adca23ad50245ffd114c0f48d8d81cb8b098ed96b70fbf8acabdac" - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_rational_29439311393097845117733430334224793553313724293264693883065156761890331475372_by_1", - "typeString": "int_const 2943...(69 digits omitted)...5372" - } - ], - "id": 515, - "name": "c_0x25b48697", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 481, - "src": "794:12:13", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", - "typeString": "function (bytes32) pure" - } - }, - "id": 517, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "794:80:13", - "tryCall": false, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 512, + "name": "initialValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 502, + "src": "779:12:13", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_uint256", + "typeString": "uint256" } }, - "id": 518, - "nodeType": "ExpressionStatement", - "src": "794:80:13" + "src": "770:21:13", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - { - "expression": { - "id": 521, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "id": 519, - "name": "_initialized", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 483, - "src": "896:12:13", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "hexValue": "74727565", - "id": 520, + "id": 514, + "nodeType": "ExpressionStatement", + "src": "770:21:13" + }, + { + "expression": { + "arguments": [ + { + "hexValue": "307834313136306634636539616463613233616435303234356666643131346330663438643864383163623862303938656439366237306662663861636162646163", + "id": 516, "isConstant": false, "isLValue": false, "isPure": true, - "kind": "bool", + "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "911:4:13", + "src": "807:66:13", "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" + "typeIdentifier": "t_rational_29439311393097845117733430334224793553313724293264693883065156761890331475372_by_1", + "typeString": "int_const 2943...(69 digits omitted)...5372" }, - "value": "true" - }, - "src": "896:19:13", + "value": "0x41160f4ce9adca23ad50245ffd114c0f48d8d81cb8b098ed96b70fbf8acabdac" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_29439311393097845117733430334224793553313724293264693883065156761890331475372_by_1", + "typeString": "int_const 2943...(69 digits omitted)...5372" + } + ], + "id": 515, + "name": "c_0x25b48697", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 481, + "src": "794:12:13", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", + "typeString": "function (bytes32) pure" + } + }, + "id": 517, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "794:80:13", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 518, + "nodeType": "ExpressionStatement", + "src": "794:80:13" + }, + { + "expression": { + "id": 521, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 519, + "name": "_initialized", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 483, + "src": "896:12:13", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, - "id": 522, - "nodeType": "ExpressionStatement", - "src": "896:19:13" - } - ] - }, - "functionSelector": "76d85cb4", - "id": 524, - "implemented": true, - "kind": "function", - "modifiers": [ - { - "id": 505, - "kind": "modifierInvocation", - "modifierName": { - "id": 504, - "name": "onlyIfNotInitialized", - "nodeType": "IdentifierPath", - "referencedDeclaration": 159, - "src": "645:20:13" + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "74727565", + "id": 520, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "911:4:13", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "src": "896:19:13", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } }, - "nodeType": "ModifierInvocation", - "src": "645:20:13" + "id": 522, + "nodeType": "ExpressionStatement", + "src": "896:19:13" } - ], - "name": "initializeInitializableMock", - "nameLocation": "588:27:13", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 503, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 502, - "mutability": "mutable", - "name": "initialValue", - "nameLocation": "624:12:13", - "nodeType": "VariableDeclaration", - "scope": 524, - "src": "616:20:13", - "stateVariable": false, - "storageLocation": "default", + ] + }, + "functionSelector": "76d85cb4", + "id": 524, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 505, + "kind": "modifierInvocation", + "modifierName": { + "id": 504, + "name": "onlyIfNotInitialized", + "nodeType": "IdentifierPath", + "referencedDeclaration": 159, + "src": "645:20:13" + }, + "nodeType": "ModifierInvocation", + "src": "645:20:13" + } + ], + "name": "initializeInitializableMock", + "nameLocation": "588:27:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 503, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 502, + "mutability": "mutable", + "name": "initialValue", + "nameLocation": "624:12:13", + "nodeType": "VariableDeclaration", + "scope": 524, + "src": "616:20:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 501, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "616:7:13", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "typeName": { - "id": 501, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "616:7:13", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "615:22:13" - }, - "returnParameters": { - "id": 506, - "nodeType": "ParameterList", - "parameters": [], - "src": "666:0:13" - }, - "scope": 592, - "src": "579:343:13", - "stateMutability": "nonpayable", - "virtual": false, - "visibility": "public" + } + }, + "visibility": "internal" + } + ], + "src": "615:22:13" }, - { - "body": { - "id": 536, - "nodeType": "Block", - "src": "997:134:13", - "statements": [ - { + "returnParameters": { + "id": 506, + "nodeType": "ParameterList", + "parameters": [], + "src": "666:0:13" + }, + "scope": 592, + "src": "579:343:13", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 536, + "nodeType": "Block", + "src": "997:134:13", + "statements": [ + { + "expression": { + "arguments": [ + { + "hexValue": "307830316261636538356336626466656338626661306439383433616631653339343664626134613962663538643739643733343062633530373630363965326237", + "id": 530, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1012:66:13", + "typeDescriptions": { + "typeIdentifier": "t_rational_782371768982384723941173269183241968643719869640986685049959834327571882679_by_1", + "typeString": "int_const 7823...(67 digits omitted)...2679" + }, + "value": "0x01bace85c6bdfec8bfa0d9843af1e3946dba4a9bf58d79d7340bc5076069e2b7" + } + ], "expression": { - "arguments": [ + "argumentTypes": [ { - "hexValue": "307830316261636538356336626466656338626661306439383433616631653339343664626134613962663538643739643733343062633530373630363965326237", - "id": 530, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1012:66:13", - "typeDescriptions": { - "typeIdentifier": "t_rational_782371768982384723941173269183241968643719869640986685049959834327571882679_by_1", - "typeString": "int_const 7823...(67 digits omitted)...2679" - }, - "value": "0x01bace85c6bdfec8bfa0d9843af1e3946dba4a9bf58d79d7340bc5076069e2b7" + "typeIdentifier": "t_rational_782371768982384723941173269183241968643719869640986685049959834327571882679_by_1", + "typeString": "int_const 7823...(67 digits omitted)...2679" } ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_rational_782371768982384723941173269183241968643719869640986685049959834327571882679_by_1", - "typeString": "int_const 7823...(67 digits omitted)...2679" - } - ], - "id": 529, - "name": "c_0x25b48697", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 481, - "src": "999:12:13", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", - "typeString": "function (bytes32) pure" - } - }, - "id": 531, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "999:80:13", - "tryCall": false, + "id": 529, + "name": "c_0x25b48697", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 481, + "src": "999:12:13", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", + "typeString": "function (bytes32) pure" } }, - "id": 532, - "nodeType": "ExpressionStatement", - "src": "999:80:13" + "id": 531, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "999:80:13", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } }, - { + "id": 532, + "nodeType": "ExpressionStatement", + "src": "999:80:13" + }, + { + "expression": { + "arguments": [], "expression": { - "arguments": [], - "expression": { - "argumentTypes": [], - "id": 533, - "name": "_isInitialized", - "nodeType": "Identifier", - "overloadedDeclarations": [ - 500 - ], - "referencedDeclaration": 500, - "src": "1108:14:13", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_view$__$returns$_t_bool_$", - "typeString": "function () view returns (bool)" - } - }, - "id": 534, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1108:16:13", - "tryCall": false, + "argumentTypes": [], + "id": 533, + "name": "_isInitialized", + "nodeType": "Identifier", + "overloadedDeclarations": [500], + "referencedDeclaration": 500, + "src": "1108:14:13", "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" + "typeIdentifier": "t_function_internal_view$__$returns$_t_bool_$", + "typeString": "function () view returns (bool)" } }, - "functionReturnParameters": 528, - "id": 535, - "nodeType": "Return", - "src": "1101:23:13" - } - ] - }, - "functionSelector": "f6aceff2", - "id": 537, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "isInitializableMockInitialized", - "nameLocation": "937:30:13", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 525, - "nodeType": "ParameterList", - "parameters": [], - "src": "967:2:13" - }, - "returnParameters": { - "id": 528, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 527, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 537, + "id": 534, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1108:16:13", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 528, + "id": 535, + "nodeType": "Return", + "src": "1101:23:13" + } + ] + }, + "functionSelector": "f6aceff2", + "id": 537, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "isInitializableMockInitialized", + "nameLocation": "937:30:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 525, + "nodeType": "ParameterList", + "parameters": [], + "src": "967:2:13" + }, + "returnParameters": { + "id": 528, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 527, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 537, + "src": "991:4:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 526, + "name": "bool", + "nodeType": "ElementaryTypeName", "src": "991:4:13", - "stateVariable": false, - "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" - }, - "typeName": { - "id": 526, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "991:4:13", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "visibility": "internal" - } - ], - "src": "990:6:13" - }, - "scope": 592, - "src": "928:203:13", - "stateMutability": "view", - "virtual": false, - "visibility": "public" + } + }, + "visibility": "internal" + } + ], + "src": "990:6:13" }, - { - "body": { - "id": 550, - "nodeType": "Block", - "src": "1185:122:13", - "statements": [ - { + "scope": 592, + "src": "928:203:13", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 550, + "nodeType": "Block", + "src": "1185:122:13", + "statements": [ + { + "expression": { + "arguments": [ + { + "hexValue": "307833393435333761303366306339626137653735666665313639623537396539303162363362643761633536313337396439613236623533656138346430356433", + "id": 543, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1200:66:13", + "typeDescriptions": { + "typeIdentifier": "t_rational_25904128732996293899268614826887030544995973004805009220576551962806535914963_by_1", + "typeString": "int_const 2590...(69 digits omitted)...4963" + }, + "value": "0x394537a03f0c9ba7e75ffe169b579e901b63bd7ac561379d9a26b53ea84d05d3" + } + ], "expression": { - "arguments": [ + "argumentTypes": [ { - "hexValue": "307833393435333761303366306339626137653735666665313639623537396539303162363362643761633536313337396439613236623533656138346430356433", - "id": 543, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1200:66:13", - "typeDescriptions": { - "typeIdentifier": "t_rational_25904128732996293899268614826887030544995973004805009220576551962806535914963_by_1", - "typeString": "int_const 2590...(69 digits omitted)...4963" - }, - "value": "0x394537a03f0c9ba7e75ffe169b579e901b63bd7ac561379d9a26b53ea84d05d3" + "typeIdentifier": "t_rational_25904128732996293899268614826887030544995973004805009220576551962806535914963_by_1", + "typeString": "int_const 2590...(69 digits omitted)...4963" } ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_rational_25904128732996293899268614826887030544995973004805009220576551962806535914963_by_1", - "typeString": "int_const 2590...(69 digits omitted)...4963" - } - ], - "id": 542, - "name": "c_0x25b48697", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 481, - "src": "1187:12:13", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", - "typeString": "function (bytes32) pure" - } - }, - "id": 544, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1187:80:13", - "tryCall": false, + "id": 542, + "name": "c_0x25b48697", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 481, + "src": "1187:12:13", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", + "typeString": "function (bytes32) pure" } }, - "id": 545, - "nodeType": "ExpressionStatement", - "src": "1187:80:13" + "id": 544, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1187:80:13", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } }, - { - "expression": { - "id": 548, + "id": 545, + "nodeType": "ExpressionStatement", + "src": "1187:80:13" + }, + { + "expression": { + "id": 548, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 546, + "name": "_value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 485, + "src": "1289:6:13", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "*=", + "rightHandSide": { + "hexValue": "32", + "id": 547, "isConstant": false, "isLValue": false, - "isPure": false, + "isPure": true, + "kind": "number", "lValueRequested": false, - "leftHandSide": { - "id": 546, - "name": "_value", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 485, - "src": "1289:6:13", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } + "nodeType": "Literal", + "src": "1299:1:13", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" }, - "nodeType": "Assignment", - "operator": "*=", - "rightHandSide": { - "hexValue": "32", - "id": 547, + "value": "2" + }, + "src": "1289:11:13", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 549, + "nodeType": "ExpressionStatement", + "src": "1289:11:13" + } + ] + }, + "functionSelector": "e3778184", + "id": 551, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 540, + "kind": "modifierInvocation", + "modifierName": { + "id": 539, + "name": "onlyIfInitialized", + "nodeType": "IdentifierPath", + "referencedDeclaration": 125, + "src": "1167:17:13" + }, + "nodeType": "ModifierInvocation", + "src": "1167:17:13" + } + ], + "name": "doubleValue", + "nameLocation": "1146:11:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 538, + "nodeType": "ParameterList", + "parameters": [], + "src": "1157:2:13" + }, + "returnParameters": { + "id": 541, + "nodeType": "ParameterList", + "parameters": [], + "src": "1185:0:13" + }, + "scope": 592, + "src": "1137:170:13", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 564, + "nodeType": "Block", + "src": "1381:124:13", + "statements": [ + { + "expression": { + "arguments": [ + { + "hexValue": "307838623664613839643132343433343836303733363733323963666461383362353730643065323536616530366637366365383234363465623230383662313234", + "id": 559, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", - "src": "1299:1:13", + "src": "1396:66:13", "typeDescriptions": { - "typeIdentifier": "t_rational_2_by_1", - "typeString": "int_const 2" + "typeIdentifier": "t_rational_63065236011156438662778653129055737503068901374827761007045109242652298490148_by_1", + "typeString": "int_const 6306...(69 digits omitted)...0148" }, - "value": "2" - }, - "src": "1289:11:13", + "value": "0x8b6da89d1244348607367329cfda83b570d0e256ae06f76ce82464eb2086b124" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_63065236011156438662778653129055737503068901374827761007045109242652298490148_by_1", + "typeString": "int_const 6306...(69 digits omitted)...0148" + } + ], + "id": 558, + "name": "c_0x25b48697", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 481, + "src": "1383:12:13", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", + "typeString": "function (bytes32) pure" } }, - "id": 549, - "nodeType": "ExpressionStatement", - "src": "1289:11:13" - } - ] - }, - "functionSelector": "e3778184", - "id": 551, - "implemented": true, - "kind": "function", - "modifiers": [ + "id": 560, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1383:80:13", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 561, + "nodeType": "ExpressionStatement", + "src": "1383:80:13" + }, { - "id": 540, - "kind": "modifierInvocation", - "modifierName": { - "id": 539, - "name": "onlyIfInitialized", - "nodeType": "IdentifierPath", - "referencedDeclaration": 125, - "src": "1167:17:13" + "expression": { + "id": 562, + "name": "_value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 485, + "src": "1492:6:13", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "nodeType": "ModifierInvocation", - "src": "1167:17:13" + "functionReturnParameters": 557, + "id": 563, + "nodeType": "Return", + "src": "1485:13:13" + } + ] + }, + "functionSelector": "20965255", + "id": 565, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 554, + "kind": "modifierInvocation", + "modifierName": { + "id": 553, + "name": "onlyIfInitialized", + "nodeType": "IdentifierPath", + "referencedDeclaration": 125, + "src": "1345:17:13" + }, + "nodeType": "ModifierInvocation", + "src": "1345:17:13" + } + ], + "name": "getValue", + "nameLocation": "1322:8:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 552, + "nodeType": "ParameterList", + "parameters": [], + "src": "1330:2:13" + }, + "returnParameters": { + "id": 557, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 556, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 565, + "src": "1372:7:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 555, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1372:7:13", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" } ], - "name": "doubleValue", - "nameLocation": "1146:11:13", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 538, - "nodeType": "ParameterList", - "parameters": [], - "src": "1157:2:13" - }, - "returnParameters": { - "id": 541, - "nodeType": "ParameterList", - "parameters": [], - "src": "1185:0:13" - }, - "scope": 592, - "src": "1137:170:13", - "stateMutability": "nonpayable", - "virtual": false, - "visibility": "public" + "src": "1371:9:13" }, - { - "body": { - "id": 564, - "nodeType": "Block", - "src": "1381:124:13", - "statements": [ - { + "scope": 592, + "src": "1313:192:13", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 576, + "nodeType": "Block", + "src": "1572:135:13", + "statements": [ + { + "expression": { + "arguments": [ + { + "hexValue": "307831383732653231643138326236356464353930373366346436643932326265656233636263653937346638303638303831623363636132326331643362316565", + "id": 571, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1587:66:13", + "typeDescriptions": { + "typeIdentifier": "t_rational_11058489510441305013518286985246700570204188436517089266733461417169834455534_by_1", + "typeString": "int_const 1105...(69 digits omitted)...5534" + }, + "value": "0x1872e21d182b65dd59073f4d6d922beeb3cbce974f8068081b3cca22c1d3b1ee" + } + ], "expression": { - "arguments": [ + "argumentTypes": [ { - "hexValue": "307838623664613839643132343433343836303733363733323963666461383362353730643065323536616530366637366365383234363465623230383662313234", - "id": 559, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1396:66:13", - "typeDescriptions": { - "typeIdentifier": "t_rational_63065236011156438662778653129055737503068901374827761007045109242652298490148_by_1", - "typeString": "int_const 6306...(69 digits omitted)...0148" - }, - "value": "0x8b6da89d1244348607367329cfda83b570d0e256ae06f76ce82464eb2086b124" + "typeIdentifier": "t_rational_11058489510441305013518286985246700570204188436517089266733461417169834455534_by_1", + "typeString": "int_const 1105...(69 digits omitted)...5534" } ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_rational_63065236011156438662778653129055737503068901374827761007045109242652298490148_by_1", - "typeString": "int_const 6306...(69 digits omitted)...0148" - } - ], - "id": 558, - "name": "c_0x25b48697", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 481, - "src": "1383:12:13", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", - "typeString": "function (bytes32) pure" - } - }, - "id": 560, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1383:80:13", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 561, - "nodeType": "ExpressionStatement", - "src": "1383:80:13" - }, - { - "expression": { - "id": 562, - "name": "_value", + "id": 570, + "name": "c_0x25b48697", "nodeType": "Identifier", "overloadedDeclarations": [], - "referencedDeclaration": 485, - "src": "1492:6:13", + "referencedDeclaration": 481, + "src": "1574:12:13", "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", + "typeString": "function (bytes32) pure" } }, - "functionReturnParameters": 557, - "id": 563, - "nodeType": "Return", - "src": "1485:13:13" - } - ] - }, - "functionSelector": "20965255", - "id": 565, - "implemented": true, - "kind": "function", - "modifiers": [ + "id": 572, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1574:80:13", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 573, + "nodeType": "ExpressionStatement", + "src": "1574:80:13" + }, { - "id": 554, - "kind": "modifierInvocation", - "modifierName": { - "id": 553, - "name": "onlyIfInitialized", - "nodeType": "IdentifierPath", - "referencedDeclaration": 125, - "src": "1345:17:13" + "expression": { + "id": 574, + "name": "_nonCriticalValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 487, + "src": "1683:17:13", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } }, - "nodeType": "ModifierInvocation", - "src": "1345:17:13" + "functionReturnParameters": 569, + "id": 575, + "nodeType": "Return", + "src": "1676:24:13" } - ], - "name": "getValue", - "nameLocation": "1322:8:13", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 552, - "nodeType": "ParameterList", - "parameters": [], - "src": "1330:2:13" - }, - "returnParameters": { - "id": 557, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 556, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 565, - "src": "1372:7:13", - "stateVariable": false, - "storageLocation": "default", + ] + }, + "functionSelector": "e5088314", + "id": 577, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getNonCriticalValue", + "nameLocation": "1520:19:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 566, + "nodeType": "ParameterList", + "parameters": [], + "src": "1539:2:13" + }, + "returnParameters": { + "id": 569, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 568, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 577, + "src": "1563:7:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 567, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1563:7:13", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "typeName": { - "id": 555, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "1372:7:13", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "1371:9:13" - }, - "scope": 592, - "src": "1313:192:13", - "stateMutability": "view", - "virtual": false, - "visibility": "public" + } + }, + "visibility": "internal" + } + ], + "src": "1562:9:13" }, - { - "body": { - "id": 576, - "nodeType": "Block", - "src": "1572:135:13", - "statements": [ - { + "scope": 592, + "src": "1511:196:13", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 590, + "nodeType": "Block", + "src": "1775:147:13", + "statements": [ + { + "expression": { + "arguments": [ + { + "hexValue": "307834386264616536323764336432383161333835326234653232623836356332383033343333386564363063333561303234333762366536626434343835366339", + "id": 583, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1790:66:13", + "typeDescriptions": { + "typeIdentifier": "t_rational_32901662752366604385208546216074813965509793567081255781413633664872278939337_by_1", + "typeString": "int_const 3290...(69 digits omitted)...9337" + }, + "value": "0x48bdae627d3d281a3852b4e22b865c28034338ed60c35a02437b6e6bd44856c9" + } + ], "expression": { - "arguments": [ + "argumentTypes": [ { - "hexValue": "307831383732653231643138326236356464353930373366346436643932326265656233636263653937346638303638303831623363636132326331643362316565", - "id": 571, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1587:66:13", - "typeDescriptions": { - "typeIdentifier": "t_rational_11058489510441305013518286985246700570204188436517089266733461417169834455534_by_1", - "typeString": "int_const 1105...(69 digits omitted)...5534" - }, - "value": "0x1872e21d182b65dd59073f4d6d922beeb3cbce974f8068081b3cca22c1d3b1ee" + "typeIdentifier": "t_rational_32901662752366604385208546216074813965509793567081255781413633664872278939337_by_1", + "typeString": "int_const 3290...(69 digits omitted)...9337" } ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_rational_11058489510441305013518286985246700570204188436517089266733461417169834455534_by_1", - "typeString": "int_const 1105...(69 digits omitted)...5534" - } - ], - "id": 570, - "name": "c_0x25b48697", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 481, - "src": "1574:12:13", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", - "typeString": "function (bytes32) pure" - } - }, - "id": 572, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1574:80:13", - "tryCall": false, + "id": 582, + "name": "c_0x25b48697", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 481, + "src": "1777:12:13", "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" + "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", + "typeString": "function (bytes32) pure" } }, - "id": 573, - "nodeType": "ExpressionStatement", - "src": "1574:80:13" + "id": 584, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1777:80:13", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } }, - { - "expression": { - "id": 574, + "id": 585, + "nodeType": "ExpressionStatement", + "src": "1777:80:13" + }, + { + "expression": { + "id": 588, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 586, "name": "_nonCriticalValue", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 487, - "src": "1683:17:13", + "src": "1879:17:13", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "functionReturnParameters": 569, - "id": 575, - "nodeType": "Return", - "src": "1676:24:13" - } - ] - }, - "functionSelector": "e5088314", - "id": 577, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "getNonCriticalValue", - "nameLocation": "1520:19:13", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 566, - "nodeType": "ParameterList", - "parameters": [], - "src": "1539:2:13" - }, - "returnParameters": { - "id": 569, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 568, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 577, - "src": "1563:7:13", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 567, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "1563:7:13", + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 587, + "name": "nonCriticalValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 579, + "src": "1899:16:13", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, - "visibility": "internal" - } - ], - "src": "1562:9:13" - }, - "scope": 592, - "src": "1511:196:13", - "stateMutability": "view", - "virtual": false, - "visibility": "public" + "src": "1879:36:13", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 589, + "nodeType": "ExpressionStatement", + "src": "1879:36:13" + } + ] }, - { - "body": { - "id": 590, - "nodeType": "Block", - "src": "1775:147:13", - "statements": [ - { - "expression": { - "arguments": [ - { - "hexValue": "307834386264616536323764336432383161333835326234653232623836356332383033343333386564363063333561303234333762366536626434343835366339", - "id": 583, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "1790:66:13", - "typeDescriptions": { - "typeIdentifier": "t_rational_32901662752366604385208546216074813965509793567081255781413633664872278939337_by_1", - "typeString": "int_const 3290...(69 digits omitted)...9337" - }, - "value": "0x48bdae627d3d281a3852b4e22b865c28034338ed60c35a02437b6e6bd44856c9" - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_rational_32901662752366604385208546216074813965509793567081255781413633664872278939337_by_1", - "typeString": "int_const 3290...(69 digits omitted)...9337" - } - ], - "id": 582, - "name": "c_0x25b48697", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 481, - "src": "1777:12:13", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$__$", - "typeString": "function (bytes32) pure" - } - }, - "id": 584, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "names": [], - "nodeType": "FunctionCall", - "src": "1777:80:13", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 585, - "nodeType": "ExpressionStatement", - "src": "1777:80:13" + "functionSelector": "f7bca910", + "id": 591, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "setNonCriticalValue", + "nameLocation": "1722:19:13", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 580, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 579, + "mutability": "mutable", + "name": "nonCriticalValue", + "nameLocation": "1750:16:13", + "nodeType": "VariableDeclaration", + "scope": 591, + "src": "1742:24:13", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" }, - { - "expression": { - "id": 588, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftHandSide": { - "id": 586, - "name": "_nonCriticalValue", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 487, - "src": "1879:17:13", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "Assignment", - "operator": "=", - "rightHandSide": { - "id": 587, - "name": "nonCriticalValue", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 579, - "src": "1899:16:13", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "1879:36:13", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 589, - "nodeType": "ExpressionStatement", - "src": "1879:36:13" - } - ] - }, - "functionSelector": "f7bca910", - "id": 591, - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "setNonCriticalValue", - "nameLocation": "1722:19:13", - "nodeType": "FunctionDefinition", - "parameters": { - "id": 580, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 579, - "mutability": "mutable", - "name": "nonCriticalValue", - "nameLocation": "1750:16:13", - "nodeType": "VariableDeclaration", - "scope": 591, - "src": "1742:24:13", - "stateVariable": false, - "storageLocation": "default", + "typeName": { + "id": 578, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1742:7:13", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" - }, - "typeName": { - "id": 578, - "name": "uint256", - "nodeType": "ElementaryTypeName", - "src": "1742:7:13", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "1741:26:13" - }, - "returnParameters": { - "id": 581, - "nodeType": "ParameterList", - "parameters": [], - "src": "1775:0:13" - }, - "scope": 592, - "src": "1713:209:13", - "stateMutability": "nonpayable", - "virtual": false, - "visibility": "public" - } - ], - "scope": 593, - "src": "164:1760:13", - "usedErrors": [ - 72, - 74 - ] - } - ], - "src": "31:1894:13" + } + }, + "visibility": "internal" + } + ], + "src": "1741:26:13" + }, + "returnParameters": { + "id": 581, + "nodeType": "ParameterList", + "parameters": [], + "src": "1775:0:13" + }, + "scope": 592, + "src": "1713:209:13", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 593, + "src": "164:1760:13", + "usedErrors": [72, 74] + } + ], + "src": "31:1894:13" } } diff --git a/utils/core-utils/test/fixtures/require-all-example/3-three.yml b/utils/core-utils/test/fixtures/require-all-example/3-three.yml index 8b13789179..e69de29bb2 100644 --- a/utils/core-utils/test/fixtures/require-all-example/3-three.yml +++ b/utils/core-utils/test/fixtures/require-all-example/3-three.yml @@ -1 +0,0 @@ - diff --git a/utils/core-utils/test/utils/assertions/assert-revert.test.ts b/utils/core-utils/test/utils/assertions/assert-revert.test.ts index 106fa46106..d04f3b9d5a 100644 --- a/utils/core-utils/test/utils/assertions/assert-revert.test.ts +++ b/utils/core-utils/test/utils/assertions/assert-revert.test.ts @@ -37,9 +37,14 @@ describe('utils/assertions/assert-revert.ts', function () { const message = 'Unknown transaction error'; const expectedMessage = 'The expected transaction error'; - await rejects(async () => { - await assertRevert(mockRevertingTx(message), expectedMessage); - }, new Error(`Transaction was expected to revert with "${expectedMessage}", but reverted with "Error: ${message}"\nError: Unknown transaction error`)); + await rejects( + async () => { + await assertRevert(mockRevertingTx(message), expectedMessage); + }, + new Error( + `Transaction was expected to revert with "${expectedMessage}", but reverted with "Error: ${message}"\nError: Unknown transaction error` + ) + ); }); }); diff --git a/utils/deps/deps.js b/utils/deps/deps.js index 61cd46146c..ea9e9e7c63 100755 --- a/utils/deps/deps.js +++ b/utils/deps/deps.js @@ -128,7 +128,7 @@ async function run() { console.log(`...FIXING ${fgYellow}${location}/package.json${fgReset}`); await fs.writeFile( `${location}/package.json`, - prettier.format(JSON.stringify(packageJson, null, ' '), { + await prettier.format(JSON.stringify(packageJson, null, ' '), { parser: 'json', ...prettierOptions, }) diff --git a/utils/deps/package.json b/utils/deps/package.json index 7c53d9cb61..768b8ce8aa 100755 --- a/utils/deps/package.json +++ b/utils/deps/package.json @@ -11,8 +11,8 @@ "deps-mismatched": "./mismatched.js" }, "devDependencies": { - "depcheck": "1.4.3", - "prettier": "^2.8.8", - "typescript": "4.9.3" + "depcheck": "^1.4.3", + "prettier": "^3.0.3", + "typescript": "^4.9.3" } } diff --git a/utils/docgen/abis.js b/utils/docgen/abis.js index 9221a0506c..2d0eb56762 100755 --- a/utils/docgen/abis.js +++ b/utils/docgen/abis.js @@ -57,8 +57,8 @@ async function run() { await fs.mkdir(`${__dirname}/docs`, { recursive: true }); const prettierOptions = JSON.parse(await fs.readFile(`${__dirname}/../../.prettierrc`, 'utf8')); - const prettyJson = (obj) => - prettier.format(JSON.stringify(obj, null, 2), { parser: 'json', ...prettierOptions }); + const prettyJson = async (obj) => + await prettier.format(JSON.stringify(obj, null, 2), { parser: 'json', ...prettierOptions }); await fs.writeFile(`./docs/${chainId}.md`, `## ${chainName(chainId)}\n\n`, 'utf8'); await fs.appendFile(`./docs/${chainId}.md`, `Chain ID: ${chainId}\n\n`, 'utf8'); @@ -69,7 +69,7 @@ async function run() { console.log(`Writing ${chainId}-SynthetixCore.json`); await fs.writeFile( `./abis/${chainId}-SynthetixCore.json`, - prettyJson(system.contracts.CoreProxy), + await prettyJson(system.contracts.CoreProxy), 'utf8' ); await fs.appendFile( @@ -84,7 +84,7 @@ async function run() { console.log(`Writing ${chainId}-snxAccountNFT.json`); await fs.writeFile( `./abis/${chainId}-snxAccountNFT.json`, - prettyJson(system.contracts.AccountProxy), + await prettyJson(system.contracts.AccountProxy), 'utf8' ); await fs.appendFile( @@ -99,7 +99,7 @@ async function run() { console.log(`Writing ${chainId}-snxUSDToken.json`); await fs.writeFile( `./abis/${chainId}-snxUSDToken.json`, - prettyJson(system.contracts.USDProxy), + await prettyJson(system.contracts.USDProxy), 'utf8' ); await fs.appendFile( @@ -116,7 +116,7 @@ async function run() { console.log(`Writing ${chainId}-OracleManager.json`); await fs.writeFile( `./abis/${chainId}-OracleManager.json`, - prettyJson(oracleManager.contracts.Proxy), + await prettyJson(oracleManager.contracts.Proxy), 'utf8' ); await fs.appendFile( @@ -136,7 +136,7 @@ async function run() { console.log(`Writing ${chainId}-SpotMarket.json`); await fs.writeFile( `./abis/${chainId}-SpotMarket.json`, - prettyJson(spotFactory.contracts.SpotMarketProxy), + await prettyJson(spotFactory.contracts.SpotMarketProxy), 'utf8' ); await fs.appendFile( @@ -155,7 +155,7 @@ async function run() { console.log(`Writing ${chainId}-PerpsMarket.json`); await fs.writeFile( `./abis/${chainId}-PerpsMarket.json`, - prettyJson(perpsFactory.contracts.PerpsMarketProxy), + await prettyJson(perpsFactory.contracts.PerpsMarketProxy), 'utf8' ); await fs.appendFile( @@ -170,7 +170,7 @@ async function run() { console.log(`Writing ${chainId}-PerpsAccountNFT.json`); await fs.writeFile( `./abis/${chainId}-PerpsAccountNFT.json`, - prettyJson(perpsFactory.contracts.AccountProxy), + await prettyJson(perpsFactory.contracts.AccountProxy), 'utf8' ); await fs.appendFile( diff --git a/utils/docgen/package.json b/utils/docgen/package.json index 75e795ddb4..45ee10cc68 100644 --- a/utils/docgen/package.json +++ b/utils/docgen/package.json @@ -12,9 +12,9 @@ "docgen:contracts": "./docgen-contracts.sh" }, "devDependencies": { - "@usecannon/cli": "^2.5.1", + "@usecannon/cli": "^2.7.1", "handlebars": "4.7.7", - "prettier": "^2.8.8", + "prettier": "^3.0.3", "solidity-ast": "0.4.46", "solidity-docgen": "0.6.0-beta.35" }, diff --git a/utils/hardhat-storage/package.json b/utils/hardhat-storage/package.json index b8e8fa4e40..8b1a77bf7d 100644 --- a/utils/hardhat-storage/package.json +++ b/utils/hardhat-storage/package.json @@ -38,10 +38,10 @@ "devDependencies": { "@types/jest": "29.2.3", "@types/mustache": "4.2.2", - "hardhat": "2.15.0", + "hardhat": "2.17.2", "jest": "29.4.3", "ts-jest": "29.0.5", - "typescript": "4.9.3" + "typescript": "^4.9.3" }, - "gitHead": "af79d976af56150c628a885cc94a94f5bcc2c862" + "gitHead": "ba5a9730df248cd1999b5a6fd1bf67b307b95eec" } diff --git a/utils/sample-project/cannonfile.toml b/utils/sample-project/cannonfile.toml index 083386c84a..26cce946a1 100644 --- a/utils/sample-project/cannonfile.toml +++ b/utils/sample-project/cannonfile.toml @@ -31,28 +31,17 @@ artifact = "contracts/modules/AnotherModule.sol:AnotherModule" [contract.InitialProxy] artifact = "contracts/Proxy.sol:Proxy" -args = [ - "<%= contracts.CoreModule.address %>", - "<%= settings.initialOwner %>" -] +args = ["<%= contracts.CoreModule.address %>", "<%= settings.initialOwner %>"] abiOf = ["CoreModule"] salt = "<%= settings.salt %>" -depends = ["contract.CoreModule"] [router.Router] contracts = [ - "CoreModule", - "InitializableModule", - "SettingsModule", - "SomeModule", - "AnotherModule", -] -depends = [ - "contract.CoreModule", - "contract.InitializableModule", - "contract.SettingsModule", - "contract.SomeModule", - "contract.AnotherModule" + "CoreModule", + "InitializableModule", + "SettingsModule", + "SomeModule", + "AnotherModule", ] [invoke.upgrade_proxy] @@ -63,4 +52,3 @@ args = ["<%= contracts.Router.address %>"] factory.Proxy.abiOf = ["Router"] factory.Proxy.event = "Upgraded" factory.Proxy.arg = 0 -depends = ["contract.InitialProxy", "router.Router"] diff --git a/utils/sample-project/hardhat.config.js b/utils/sample-project/hardhat.config.js index 0614275855..93a6a85d7c 100644 --- a/utils/sample-project/hardhat.config.js +++ b/utils/sample-project/hardhat.config.js @@ -1,12 +1,8 @@ -const { registerAction } = require('@usecannon/builder'); - require('@nomiclabs/hardhat-ethers'); require('hardhat-cannon'); require('@synthetixio/hardhat-storage'); require('solidity-coverage'); -registerAction(require('cannon-plugin-router')); - module.exports = { solidity: { version: '0.8.17', diff --git a/utils/sample-project/package.json b/utils/sample-project/package.json index 648453c375..b675d0d4e2 100644 --- a/utils/sample-project/package.json +++ b/utils/sample-project/package.json @@ -17,12 +17,10 @@ "@synthetixio/core-modules": "workspace:*", "@synthetixio/core-utils": "workspace:*", "@synthetixio/hardhat-storage": "workspace:*", - "@synthetixio/router": "^3.1.3", - "@usecannon/builder": "^2.5.1", - "cannon-plugin-router": "^1.0.16", + "@synthetixio/router": "^3.3.0", "ethers": "^5.7.2", - "hardhat": "2.15.0", - "hardhat-cannon": "2.5.1", + "hardhat": "2.17.2", + "hardhat-cannon": "2.7.1", "solidity-coverage": "0.8.2" } } diff --git a/utils/sample-project/test/bootstrap.js b/utils/sample-project/test/bootstrap.js index 15d2053ff3..74bd36abdf 100644 --- a/utils/sample-project/test/bootstrap.js +++ b/utils/sample-project/test/bootstrap.js @@ -1,4 +1,4 @@ -const { coreBootstrap } = require('@synthetixio/router/dist/utils/tests'); +const { coreBootstrap } = require('@synthetixio/router/utils/tests'); const result = coreBootstrap(); diff --git a/yarn.lock b/yarn.lock index 29c75e4ecd..75ea5742da 100644 --- a/yarn.lock +++ b/yarn.lock @@ -207,16 +207,7 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:7.16.4": - version: 7.16.4 - resolution: "@babel/parser@npm:7.16.4" - bin: - parser: ./bin/babel-parser.js - checksum: ce0a8f92f440f2a12bc932f070a7b60c5133bf8a63f461841f9e39af0194f573707959d606c6fad1a2fd496a45148553afd9b74d3b8dd36cdb7861598d1f3e36 - languageName: node - linkType: hard - -"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.15, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.21.3, @babel/parser@npm:^7.22.5": +"@babel/parser@npm:7.22.5, @babel/parser@npm:^7.1.0, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.20.15, @babel/parser@npm:^7.20.7, @babel/parser@npm:^7.21.3, @babel/parser@npm:^7.22.5": version: 7.22.5 resolution: "@babel/parser@npm:7.22.5" bin: @@ -390,7 +381,7 @@ __metadata: languageName: node linkType: hard -"@babel/traverse@npm:^7.12.5, @babel/traverse@npm:^7.22.5, @babel/traverse@npm:^7.7.2": +"@babel/traverse@npm:7.22.5, @babel/traverse@npm:^7.22.5, @babel/traverse@npm:^7.7.2": version: 7.22.5 resolution: "@babel/traverse@npm:7.22.5" dependencies: @@ -484,6 +475,48 @@ __metadata: languageName: node linkType: hard +"@chevrotain/cst-dts-gen@npm:11.0.3": + version: 11.0.3 + resolution: "@chevrotain/cst-dts-gen@npm:11.0.3" + dependencies: + "@chevrotain/gast": 11.0.3 + "@chevrotain/types": 11.0.3 + lodash-es: 4.17.21 + checksum: 414229a827e06b4564e271ca3a02ed6f475d400a184dc5ae05308bbc6e966959b84a40a063dacf7debd8f9a1dba5bf8785a891e7b588eafd9f821b43ec16b109 + languageName: node + linkType: hard + +"@chevrotain/gast@npm:11.0.3": + version: 11.0.3 + resolution: "@chevrotain/gast@npm:11.0.3" + dependencies: + "@chevrotain/types": 11.0.3 + lodash-es: 4.17.21 + checksum: 5190ba3a3f03f6f58331dbd108c36172b90314f60675b88dfefca25f704549164577796a1127fa407dd546aefa9f221d6c043e5b95298a0852ffd060b4fff117 + languageName: node + linkType: hard + +"@chevrotain/regexp-to-ast@npm:11.0.3": + version: 11.0.3 + resolution: "@chevrotain/regexp-to-ast@npm:11.0.3" + checksum: 5d665b3340493e302f245c9bbcd73de9b973ca79d0e59c4fbed6cc733b665998b41a2b8a5963bc2e90c763c8b4ba30f6e53736325c40f3fccef0ad3de2095ff2 + languageName: node + linkType: hard + +"@chevrotain/types@npm:11.0.3": + version: 11.0.3 + resolution: "@chevrotain/types@npm:11.0.3" + checksum: 4496bf1955f1db2b08c188f508db23d9f1cbecdf0bfa7f23f8d8dcd3f9ca450529b71acc83a941c59c0f8188b54c0f5687f6e203dcd7dca622ac4ea6291df316 + languageName: node + linkType: hard + +"@chevrotain/utils@npm:11.0.3": + version: 11.0.3 + resolution: "@chevrotain/utils@npm:11.0.3" + checksum: 099f0aa65ff82a7d49ffefd7a90182efcc1518b89b88d516d2125ca730eaa38d61e36ee40fad6c21f7896b6e8393b1e6810b6a69122fabff283f0522ee49eaa5 + languageName: node + linkType: hard + "@colors/colors@npm:1.5.0": version: 1.5.0 resolution: "@colors/colors@npm:1.5.0" @@ -500,20 +533,45 @@ __metadata: languageName: node linkType: hard -"@eslint/eslintrc@npm:^1.3.3": - version: 1.4.1 - resolution: "@eslint/eslintrc@npm:1.4.1" +"@eslint-community/eslint-utils@npm:^4.2.0": + version: 4.4.0 + resolution: "@eslint-community/eslint-utils@npm:4.4.0" + dependencies: + eslint-visitor-keys: ^3.3.0 + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 + checksum: cdfe3ae42b4f572cbfb46d20edafe6f36fc5fb52bf2d90875c58aefe226892b9677fef60820e2832caf864a326fe4fc225714c46e8389ccca04d5f9288aabd22 + languageName: node + linkType: hard + +"@eslint-community/regexpp@npm:^4.4.0, @eslint-community/regexpp@npm:^4.6.1": + version: 4.8.1 + resolution: "@eslint-community/regexpp@npm:4.8.1" + checksum: 82d62c845ef42b810f268cfdc84d803a2da01735fb52e902fd34bdc09f92464a094fd8e4802839874b000b2f73f67c972859e813ba705233515d3e954f234bf2 + languageName: node + linkType: hard + +"@eslint/eslintrc@npm:^2.1.2": + version: 2.1.2 + resolution: "@eslint/eslintrc@npm:2.1.2" dependencies: ajv: ^6.12.4 debug: ^4.3.2 - espree: ^9.4.0 + espree: ^9.6.0 globals: ^13.19.0 ignore: ^5.2.0 import-fresh: ^3.2.1 js-yaml: ^4.1.0 minimatch: ^3.1.2 strip-json-comments: ^3.1.1 - checksum: cd3e5a8683db604739938b1c1c8b77927dc04fce3e28e0c88e7f2cd4900b89466baf83dfbad76b2b9e4d2746abdd00dd3f9da544d3e311633d8693f327d04cd7 + checksum: bc742a1e3b361f06fedb4afb6bf32cbd27171292ef7924f61c62f2aed73048367bcc7ac68f98c06d4245cd3fabc43270f844e3c1699936d4734b3ac5398814a7 + languageName: node + linkType: hard + +"@eslint/js@npm:8.49.0": + version: 8.49.0 + resolution: "@eslint/js@npm:8.49.0" + checksum: a6601807c8aeeefe866926ad92ed98007c034a735af20ff709009e39ad1337474243d47908500a3bde04e37bfba16bcf1d3452417f962e1345bc8756edd6b830 languageName: node linkType: hard @@ -1032,14 +1090,14 @@ __metadata: languageName: node linkType: hard -"@humanwhocodes/config-array@npm:^0.11.6": - version: 0.11.10 - resolution: "@humanwhocodes/config-array@npm:0.11.10" +"@humanwhocodes/config-array@npm:^0.11.11": + version: 0.11.11 + resolution: "@humanwhocodes/config-array@npm:0.11.11" dependencies: "@humanwhocodes/object-schema": ^1.2.1 debug: ^4.1.1 minimatch: ^3.0.5 - checksum: 1b1302e2403d0e35bc43e66d67a2b36b0ad1119efc704b5faff68c41f791a052355b010fb2d27ef022670f550de24cd6d08d5ecf0821c16326b7dcd0ee5d5d8a + checksum: db84507375ab77b8ffdd24f498a5b49ad6b64391d30dd2ac56885501d03964d29637e05b1ed5aefa09d57ac667e28028bc22d2da872bfcd619652fbdb5f4ca19 languageName: node linkType: hard @@ -1735,161 +1793,161 @@ __metadata: languageName: node linkType: hard -"@nomicfoundation/ethereumjs-block@npm:5.0.1": - version: 5.0.1 - resolution: "@nomicfoundation/ethereumjs-block@npm:5.0.1" +"@nomicfoundation/ethereumjs-block@npm:5.0.2": + version: 5.0.2 + resolution: "@nomicfoundation/ethereumjs-block@npm:5.0.2" dependencies: - "@nomicfoundation/ethereumjs-common": 4.0.1 - "@nomicfoundation/ethereumjs-rlp": 5.0.1 - "@nomicfoundation/ethereumjs-trie": 6.0.1 - "@nomicfoundation/ethereumjs-tx": 5.0.1 - "@nomicfoundation/ethereumjs-util": 9.0.1 + "@nomicfoundation/ethereumjs-common": 4.0.2 + "@nomicfoundation/ethereumjs-rlp": 5.0.2 + "@nomicfoundation/ethereumjs-trie": 6.0.2 + "@nomicfoundation/ethereumjs-tx": 5.0.2 + "@nomicfoundation/ethereumjs-util": 9.0.2 ethereum-cryptography: 0.1.3 ethers: ^5.7.1 - checksum: 02591bc9ba02b56edc5faf75a7991d6b9430bd98542864f2f6ab202f0f4aed09be156fdba60948375beb10e524ffa4e461475edc8a15b3098b1c58ff59a0137e + checksum: 7ff744f44a01f1c059ca7812a1cfc8089f87aa506af6cb39c78331dca71b32993cbd6fa05ad03f8c4f4fab73bb998a927af69e0d8ff01ae192ee5931606e09f5 languageName: node linkType: hard -"@nomicfoundation/ethereumjs-blockchain@npm:7.0.1": - version: 7.0.1 - resolution: "@nomicfoundation/ethereumjs-blockchain@npm:7.0.1" - dependencies: - "@nomicfoundation/ethereumjs-block": 5.0.1 - "@nomicfoundation/ethereumjs-common": 4.0.1 - "@nomicfoundation/ethereumjs-ethash": 3.0.1 - "@nomicfoundation/ethereumjs-rlp": 5.0.1 - "@nomicfoundation/ethereumjs-trie": 6.0.1 - "@nomicfoundation/ethereumjs-tx": 5.0.1 - "@nomicfoundation/ethereumjs-util": 9.0.1 +"@nomicfoundation/ethereumjs-blockchain@npm:7.0.2": + version: 7.0.2 + resolution: "@nomicfoundation/ethereumjs-blockchain@npm:7.0.2" + dependencies: + "@nomicfoundation/ethereumjs-block": 5.0.2 + "@nomicfoundation/ethereumjs-common": 4.0.2 + "@nomicfoundation/ethereumjs-ethash": 3.0.2 + "@nomicfoundation/ethereumjs-rlp": 5.0.2 + "@nomicfoundation/ethereumjs-trie": 6.0.2 + "@nomicfoundation/ethereumjs-tx": 5.0.2 + "@nomicfoundation/ethereumjs-util": 9.0.2 abstract-level: ^1.0.3 debug: ^4.3.3 ethereum-cryptography: 0.1.3 level: ^8.0.0 lru-cache: ^5.1.1 memory-level: ^1.0.0 - checksum: 8b7a4e3613c2abbf59e92a927cb074d1df8640fbf6a0ec4be7fcb5ecaead1310ebbe3a41613c027253742f6dccca6eaeee8dde0a38315558de156313d0c8f313 + checksum: b7e440dcd73e32aa72d13bfd28cb472773c9c60ea808a884131bf7eb3f42286ad594a0864215f599332d800f3fe1f772fff4b138d2dcaa8f41e4d8389bff33e7 languageName: node linkType: hard -"@nomicfoundation/ethereumjs-common@npm:4.0.1": - version: 4.0.1 - resolution: "@nomicfoundation/ethereumjs-common@npm:4.0.1" +"@nomicfoundation/ethereumjs-common@npm:4.0.2": + version: 4.0.2 + resolution: "@nomicfoundation/ethereumjs-common@npm:4.0.2" dependencies: - "@nomicfoundation/ethereumjs-util": 9.0.1 + "@nomicfoundation/ethereumjs-util": 9.0.2 crc-32: ^1.2.0 - checksum: af5b599bcc07430b57017e516b0bad70af04e812b970be9bfae0c1d3433ab26656b3d1db71717b3b0fb38a889db2b93071b45adc1857000e7cd58a99a8e29495 + checksum: f0d84704d6254d374299c19884312bd5666974b4b6f342d3f10bc76e549de78d20e45a53d25fbdc146268a52335497127e4f069126da7c60ac933a158e704887 languageName: node linkType: hard -"@nomicfoundation/ethereumjs-ethash@npm:3.0.1": - version: 3.0.1 - resolution: "@nomicfoundation/ethereumjs-ethash@npm:3.0.1" +"@nomicfoundation/ethereumjs-ethash@npm:3.0.2": + version: 3.0.2 + resolution: "@nomicfoundation/ethereumjs-ethash@npm:3.0.2" dependencies: - "@nomicfoundation/ethereumjs-block": 5.0.1 - "@nomicfoundation/ethereumjs-rlp": 5.0.1 - "@nomicfoundation/ethereumjs-util": 9.0.1 + "@nomicfoundation/ethereumjs-block": 5.0.2 + "@nomicfoundation/ethereumjs-rlp": 5.0.2 + "@nomicfoundation/ethereumjs-util": 9.0.2 abstract-level: ^1.0.3 bigint-crypto-utils: ^3.0.23 ethereum-cryptography: 0.1.3 - checksum: beeec9788a9ed57020ee47271447715bdc0a98990a0bd0e9d598c6de74ade836db17c0590275e6aab12fa9b0fbd81f1d02e3cdf1fb8497583cec693ec3ed6aed + checksum: e4011e4019dd9b92f7eeebfc1e6c9a9685c52d8fd0ee4f28f03e50048a23b600c714490827f59fdce497b3afb503b3fd2ebf6815ff307e9949c3efeff1403278 languageName: node linkType: hard -"@nomicfoundation/ethereumjs-evm@npm:2.0.1": - version: 2.0.1 - resolution: "@nomicfoundation/ethereumjs-evm@npm:2.0.1" +"@nomicfoundation/ethereumjs-evm@npm:2.0.2": + version: 2.0.2 + resolution: "@nomicfoundation/ethereumjs-evm@npm:2.0.2" dependencies: "@ethersproject/providers": ^5.7.1 - "@nomicfoundation/ethereumjs-common": 4.0.1 - "@nomicfoundation/ethereumjs-tx": 5.0.1 - "@nomicfoundation/ethereumjs-util": 9.0.1 + "@nomicfoundation/ethereumjs-common": 4.0.2 + "@nomicfoundation/ethereumjs-tx": 5.0.2 + "@nomicfoundation/ethereumjs-util": 9.0.2 debug: ^4.3.3 ethereum-cryptography: 0.1.3 mcl-wasm: ^0.7.1 rustbn.js: ~0.2.0 - checksum: 0aa2e1460e1c311506fd3bf9d03602c7c3a5e03f352173a55a274a9cc1840bd774692d1c4e5c6e82a7eee015a7cf1585f1c5be02cfdf54cc2a771421820e3f84 + checksum: a23cf570836ddc147606b02df568069de946108e640f902358fef67e589f6b371d856056ee44299d9b4e3497f8ae25faa45e6b18fefd90e9b222dc6a761d85f0 languageName: node linkType: hard -"@nomicfoundation/ethereumjs-rlp@npm:5.0.1": - version: 5.0.1 - resolution: "@nomicfoundation/ethereumjs-rlp@npm:5.0.1" +"@nomicfoundation/ethereumjs-rlp@npm:5.0.2": + version: 5.0.2 + resolution: "@nomicfoundation/ethereumjs-rlp@npm:5.0.2" bin: rlp: bin/rlp - checksum: 5a51d2cf92b84e50ce516cbdadff5d39cb4c6b71335e92eaf447dfb7d88f5499d78d599024b9252efd7ba99495de36f4d983cec6a89e77db286db691fc6328f7 + checksum: a74434cadefca9aa8754607cc1ad7bb4bbea4ee61c6214918e60a5bbee83206850346eb64e39fd1fe97f854c7ec0163e01148c0c881dda23881938f0645a0ef2 languageName: node linkType: hard -"@nomicfoundation/ethereumjs-statemanager@npm:2.0.1": - version: 2.0.1 - resolution: "@nomicfoundation/ethereumjs-statemanager@npm:2.0.1" +"@nomicfoundation/ethereumjs-statemanager@npm:2.0.2": + version: 2.0.2 + resolution: "@nomicfoundation/ethereumjs-statemanager@npm:2.0.2" dependencies: - "@nomicfoundation/ethereumjs-common": 4.0.1 - "@nomicfoundation/ethereumjs-rlp": 5.0.1 + "@nomicfoundation/ethereumjs-common": 4.0.2 + "@nomicfoundation/ethereumjs-rlp": 5.0.2 debug: ^4.3.3 ethereum-cryptography: 0.1.3 ethers: ^5.7.1 js-sdsl: ^4.1.4 - checksum: 157b503fa3e45a3695ba2eba5b089b56719f7790274edd09c95bb0d223570820127f6a2cbfcb14f2d9d876d1440ea4dccb04a4922fa9e9e34b416fddd6517c20 + checksum: 3ab6578e252e53609afd98d8ba42a99f182dcf80252f23ed9a5e0471023ffb2502130f85fc47fa7c94cd149f9be799ed9a0942ca52a143405be9267f4ad94e64 languageName: node linkType: hard -"@nomicfoundation/ethereumjs-trie@npm:6.0.1": - version: 6.0.1 - resolution: "@nomicfoundation/ethereumjs-trie@npm:6.0.1" +"@nomicfoundation/ethereumjs-trie@npm:6.0.2": + version: 6.0.2 + resolution: "@nomicfoundation/ethereumjs-trie@npm:6.0.2" dependencies: - "@nomicfoundation/ethereumjs-rlp": 5.0.1 - "@nomicfoundation/ethereumjs-util": 9.0.1 + "@nomicfoundation/ethereumjs-rlp": 5.0.2 + "@nomicfoundation/ethereumjs-util": 9.0.2 "@types/readable-stream": ^2.3.13 ethereum-cryptography: 0.1.3 readable-stream: ^3.6.0 - checksum: 7001c3204120fd4baba673b4bb52015594f5ad28311f24574cd16f38c015ef87ed51188d6f46d6362ffb9da589359a9e0f99e6068ef7a2f61cb66213e2f493d7 + checksum: d4da918d333851b9f2cce7dbd25ab5753e0accd43d562d98fd991b168b6a08d1794528f0ade40fe5617c84900378376fe6256cdbe52c8d66bf4c53293bbc7c40 languageName: node linkType: hard -"@nomicfoundation/ethereumjs-tx@npm:5.0.1": - version: 5.0.1 - resolution: "@nomicfoundation/ethereumjs-tx@npm:5.0.1" +"@nomicfoundation/ethereumjs-tx@npm:5.0.2": + version: 5.0.2 + resolution: "@nomicfoundation/ethereumjs-tx@npm:5.0.2" dependencies: "@chainsafe/ssz": ^0.9.2 "@ethersproject/providers": ^5.7.2 - "@nomicfoundation/ethereumjs-common": 4.0.1 - "@nomicfoundation/ethereumjs-rlp": 5.0.1 - "@nomicfoundation/ethereumjs-util": 9.0.1 + "@nomicfoundation/ethereumjs-common": 4.0.2 + "@nomicfoundation/ethereumjs-rlp": 5.0.2 + "@nomicfoundation/ethereumjs-util": 9.0.2 ethereum-cryptography: 0.1.3 - checksum: aa3829e4a43f5e10cfd66b87eacb3e737ba98f5e3755a3e6a4ccfbc257dbf10d926838cc3acb8fef8afa3362a023b7fd11b53e6ba53f94bb09c345f083cd29a8 + checksum: 0bbcea75786b2ccb559afe2ecc9866fb4566a9f157b6ffba4f50960d14f4b3da2e86e273f6fadda9b860e67cfcabf589970fb951b328cb5f900a585cd21842a2 languageName: node linkType: hard -"@nomicfoundation/ethereumjs-util@npm:9.0.1": - version: 9.0.1 - resolution: "@nomicfoundation/ethereumjs-util@npm:9.0.1" +"@nomicfoundation/ethereumjs-util@npm:9.0.2": + version: 9.0.2 + resolution: "@nomicfoundation/ethereumjs-util@npm:9.0.2" dependencies: "@chainsafe/ssz": ^0.10.0 - "@nomicfoundation/ethereumjs-rlp": 5.0.1 + "@nomicfoundation/ethereumjs-rlp": 5.0.2 ethereum-cryptography: 0.1.3 - checksum: 5f8a50a25c68c974b717f36ad0a5828b786ce1aaea3c874663c2014593fa387de5ad5c8cea35e94379df306dbd1a58c55b310779fd82197dcb993d5dbd4de7a1 + checksum: 3a08f7b88079ef9f53b43da9bdcb8195498fd3d3911c2feee2571f4d1204656053f058b2f650471c86f7d2d0ba2f814768c7cfb0f266eede41c848356afc4900 languageName: node linkType: hard -"@nomicfoundation/ethereumjs-vm@npm:7.0.1": - version: 7.0.1 - resolution: "@nomicfoundation/ethereumjs-vm@npm:7.0.1" - dependencies: - "@nomicfoundation/ethereumjs-block": 5.0.1 - "@nomicfoundation/ethereumjs-blockchain": 7.0.1 - "@nomicfoundation/ethereumjs-common": 4.0.1 - "@nomicfoundation/ethereumjs-evm": 2.0.1 - "@nomicfoundation/ethereumjs-rlp": 5.0.1 - "@nomicfoundation/ethereumjs-statemanager": 2.0.1 - "@nomicfoundation/ethereumjs-trie": 6.0.1 - "@nomicfoundation/ethereumjs-tx": 5.0.1 - "@nomicfoundation/ethereumjs-util": 9.0.1 +"@nomicfoundation/ethereumjs-vm@npm:7.0.2": + version: 7.0.2 + resolution: "@nomicfoundation/ethereumjs-vm@npm:7.0.2" + dependencies: + "@nomicfoundation/ethereumjs-block": 5.0.2 + "@nomicfoundation/ethereumjs-blockchain": 7.0.2 + "@nomicfoundation/ethereumjs-common": 4.0.2 + "@nomicfoundation/ethereumjs-evm": 2.0.2 + "@nomicfoundation/ethereumjs-rlp": 5.0.2 + "@nomicfoundation/ethereumjs-statemanager": 2.0.2 + "@nomicfoundation/ethereumjs-trie": 6.0.2 + "@nomicfoundation/ethereumjs-tx": 5.0.2 + "@nomicfoundation/ethereumjs-util": 9.0.2 debug: ^4.3.3 ethereum-cryptography: 0.1.3 mcl-wasm: ^0.7.1 rustbn.js: ~0.2.0 - checksum: 0f637316322744140d6f75d894c21b8055e27a94c72dd8ae9b0b9b93c0d54d7f30fa2aaf909e802e183a3f1020b4aa6a8178dedb823a4ce70a227ac7b432f8c1 + checksum: 1c25ba4d0644cadb8a2b0241a4bb02e578bfd7f70e3492b855c2ab5c120cb159cb8f7486f84dc1597884bd1697feedbfb5feb66e91352afb51f3694fd8e4a043 languageName: node linkType: hard @@ -2744,7 +2802,7 @@ __metadata: languageName: node linkType: hard -"@solidity-parser/parser@npm:^0.14.0, @solidity-parser/parser@npm:^0.14.1, @solidity-parser/parser@npm:^0.14.5": +"@solidity-parser/parser@npm:^0.14.0, @solidity-parser/parser@npm:^0.14.1": version: 0.14.5 resolution: "@solidity-parser/parser@npm:0.14.5" dependencies: @@ -2753,6 +2811,15 @@ __metadata: languageName: node linkType: hard +"@solidity-parser/parser@npm:^0.16.0": + version: 0.16.1 + resolution: "@solidity-parser/parser@npm:0.16.1" + dependencies: + antlr4ts: ^0.5.0-alpha.4 + checksum: d9e2f7042434fb850a97a2c3679f5fbf4997c7845278d0a436b3de30169e6758fe3818191694ece36dc39a40f55ae0384c4ae0ae912790b5b0806728a50466c2 + languageName: node + linkType: hard + "@synthetixio/common-config@workspace:*, @synthetixio/common-config@workspace:utils/common-config": version: 0.0.0-use.local resolution: "@synthetixio/common-config@workspace:utils/common-config" @@ -2762,11 +2829,9 @@ __metadata: "@synthetixio/hardhat-storage": "workspace:*" "@typechain/ethers-v5": 10.1.0 "@typechain/hardhat": 6.1.3 - "@usecannon/builder": ^2.5.1 - cannon-plugin-router: ^1.0.16 dotenv: 16.0.1 - hardhat: 2.15.0 - hardhat-cannon: 2.5.1 + hardhat: 2.17.2 + hardhat-cannon: 2.7.1 hardhat-contract-sizer: 2.10.0 hardhat-gas-reporter: 1.0.9 hardhat-ignore-warnings: 0.2.9 @@ -2783,9 +2848,8 @@ __metadata: "@ethersproject/bignumber": ^5.7.0 "@synthetixio/common-config": "workspace:*" "@synthetixio/core-utils": "workspace:*" - "@synthetixio/router": ^3.1.3 ethers: ^5.7.2 - hardhat: 2.15.0 + hardhat: 2.17.2 languageName: unknown linkType: soft @@ -2795,9 +2859,9 @@ __metadata: dependencies: "@synthetixio/common-config": "workspace:*" "@synthetixio/core-utils": "workspace:*" - "@synthetixio/router": ^3.1.3 + "@synthetixio/router": ^3.3.0 ethers: ^5.7.2 - hardhat: 2.15.0 + hardhat: 2.17.2 languageName: unknown linkType: soft @@ -2807,10 +2871,10 @@ __metadata: dependencies: "@graphprotocol/graph-cli": ^0.50.1 "@graphprotocol/graph-ts": ^0.30.0 - "@usecannon/cli": ^2.5.1 + "@usecannon/cli": ^2.7.1 ethers: ^5.7.2 matchstick-as: ^0.5.2 - prettier: ^2.8.8 + prettier: ^3.0.3 languageName: unknown linkType: soft @@ -2821,12 +2885,13 @@ __metadata: "@ethersproject/abi": ^5.7.0 "@istanbuljs/nyc-config-typescript": 1.0.2 "@types/prompts": 2.0.14 + "@usecannon/builder": 2.7.1 chalk: 4.1.2 ethereumjs-util: 6.2.1 ethers: ^5.7.2 fast-glob: 3.2.12 - hardhat: 2.15.0 - mocha: 10.2.0 + hardhat: 2.17.2 + mocha: ^10.2.0 multimatch: 6.0.0 nyc: 15.1.0 prompts: 2.4.2 @@ -2834,7 +2899,7 @@ __metadata: sinon: 11.1.2 solc: 0.8.17 solidity-ast: 0.4.46 - typescript: 4.9.3 + typescript: ^4.9.3 peerDependencies: "@usecannon/builder": 2.4.7 ethers: ^5.7.2 @@ -2853,9 +2918,9 @@ __metadata: version: 0.0.0-use.local resolution: "@synthetixio/deps@workspace:utils/deps" dependencies: - depcheck: 1.4.3 - prettier: ^2.8.8 - typescript: 4.9.3 + depcheck: ^1.4.3 + prettier: ^3.0.3 + typescript: ^4.9.3 bin: deps: ./deps.js deps-circular: ./circular.js @@ -2867,9 +2932,9 @@ __metadata: version: 0.0.0-use.local resolution: "@synthetixio/docgen@workspace:utils/docgen" dependencies: - "@usecannon/cli": ^2.5.1 + "@usecannon/cli": ^2.7.1 handlebars: 4.7.7 - prettier: ^2.8.8 + prettier: ^3.0.3 solidity-ast: 0.4.46 solidity-docgen: 0.6.0-beta.35 languageName: unknown @@ -2884,8 +2949,8 @@ __metadata: "@synthetixio/core-modules": "workspace:*" "@synthetixio/core-utils": "workspace:*" "@synthetixio/docgen": "workspace:*" - "@synthetixio/router": ^3.1.3 - hardhat: 2.15.0 + "@synthetixio/router": ^3.3.0 + hardhat: 2.17.2 solidity-docgen: 0.6.0-beta.35 languageName: unknown linkType: soft @@ -2897,12 +2962,12 @@ __metadata: "@synthetixio/core-utils": "workspace:*" "@types/jest": 29.2.3 "@types/mustache": 4.2.2 - hardhat: 2.15.0 + hardhat: 2.17.2 jest: 29.4.3 mustache: 4.2.0 solidity-ast: 0.4.46 ts-jest: 29.0.5 - typescript: 4.9.3 + typescript: ^4.9.3 languageName: unknown linkType: soft @@ -2913,10 +2978,9 @@ __metadata: "@synthetixio/common-config": "workspace:*" "@synthetixio/core-utils": "workspace:*" "@synthetixio/docgen": "workspace:*" - "@synthetixio/router": ^3.1.3 "@synthetixio/wei": 2.74.4 ethers: ^5.7.2 - hardhat: 2.15.0 + hardhat: 2.17.2 solidity-docgen: 0.6.0-beta.35 languageName: unknown linkType: soft @@ -2932,12 +2996,12 @@ __metadata: "@synthetixio/core-utils": "workspace:*" "@synthetixio/docgen": "workspace:*" "@synthetixio/oracle-manager": "workspace:*" - "@synthetixio/router": ^3.1.3 + "@synthetixio/router": ^3.3.0 "@synthetixio/wei": 2.74.4 "@usecannon/builder": ^2.5.1 erc7412: 0.1.0 ethers: ^5.7.2 - hardhat: 2.15.0 + hardhat: 2.17.2 solidity-ast: 0.4.46 solidity-docgen: 0.6.0-beta.35 ts-node: 10.9.1 @@ -2953,14 +3017,14 @@ __metadata: "@synthetixio/core-modules": "workspace:*" "@synthetixio/core-utils": "workspace:*" "@synthetixio/docgen": "workspace:*" - "@synthetixio/router": ^3.1.3 + "@synthetixio/router": ^3.3.0 "@synthetixio/wei": 2.74.4 - "@types/node": 18.11.10 + "@types/node": ^18.16.0 ethers: ^5.7.2 - hardhat: 2.15.0 + hardhat: 2.17.2 solidity-docgen: 0.6.0-beta.35 ts-node: 10.9.1 - typescript: 4.9.3 + typescript: ^4.9.3 languageName: unknown linkType: soft @@ -2970,10 +3034,10 @@ __metadata: dependencies: "@graphprotocol/graph-cli": ^0.50.1 "@graphprotocol/graph-ts": ^0.30.0 - "@usecannon/cli": ^2.5.1 + "@usecannon/cli": ^2.7.1 ethers: ^5.7.2 matchstick-as: ^0.5.2 - prettier: ^2.8.8 + prettier: ^3.0.3 languageName: unknown linkType: soft @@ -2988,38 +3052,31 @@ __metadata: "@synthetixio/docgen": "workspace:*" "@synthetixio/main": "workspace:*" "@synthetixio/oracle-manager": "workspace:*" - "@synthetixio/router": ^3.1.3 + "@synthetixio/router": ^3.3.0 "@synthetixio/spot-market": "workspace:*" "@synthetixio/wei": 2.74.4 - "@usecannon/cli": ^2.5.1 + "@usecannon/cli": ^2.7.1 ethers: ^5.7.2 - hardhat: 2.15.0 + hardhat: 2.17.2 solidity-docgen: 0.6.0-beta.35 ts-node: 10.9.1 - typescript: 4.9.3 + typescript: ^4.9.3 languageName: unknown linkType: soft -"@synthetixio/router@npm:^3.1.3, @synthetixio/router@npm:^3.1.4": - version: 3.1.4 - resolution: "@synthetixio/router@npm:3.1.4" +"@synthetixio/router@npm:^3.3.0": + version: 3.3.0 + resolution: "@synthetixio/router@npm:3.3.0" dependencies: - "@ethersproject/abi": ^5.7.0 - ajv: ^8.11.0 + "@ethersproject/keccak256": ^5.7.0 debug: ^4.3.4 - ethers: ^5.7.2 - lodash: ^4.17.21 mustache: ^4.2.0 - solc: ^0.8.17 peerDependencies: - "@usecannon/builder": ^2.4.0-alpha.1 + "@usecannon/builder": ^2.0.0 + ethers: ^5.0.0 hardhat: ^2.0.0 - peerDependenciesMeta: - "@usecannon/builder": - optional: true - hardhat: - optional: true - checksum: da369169a1f25d67f395e569fbdd17dd8d776463c8f1c0b122f61617e4501da2f882590a0ee93043162d5850d9fa97ec3b619b0650c371e602bd2394c1c0224f + solc: ^0.8.17 + checksum: 923709d5b5a0955f4cdfa7271b0fa83ac10dc1d5dbb169be91c8c4c1c4929402681170a66a16f05879d9b012d665c44dad37307297cdf7dac8c8358d0f21f087 languageName: node linkType: hard @@ -3032,12 +3089,10 @@ __metadata: "@synthetixio/core-modules": "workspace:*" "@synthetixio/core-utils": "workspace:*" "@synthetixio/hardhat-storage": "workspace:*" - "@synthetixio/router": ^3.1.3 - "@usecannon/builder": ^2.5.1 - cannon-plugin-router: ^1.0.16 + "@synthetixio/router": ^3.3.0 ethers: ^5.7.2 - hardhat: 2.15.0 - hardhat-cannon: 2.5.1 + hardhat: 2.17.2 + hardhat-cannon: 2.7.1 solidity-coverage: 0.8.2 languageName: unknown linkType: soft @@ -3048,9 +3103,10 @@ __metadata: dependencies: "@graphprotocol/graph-cli": ^0.50.1 "@graphprotocol/graph-ts": ^0.30.0 - "@usecannon/cli": ^2.5.1 + "@usecannon/cli": ^2.7.1 ethers: ^5.7.2 - prettier: ^2.8.8 + matchstick-as: ^0.5.2 + prettier: ^3.0.3 languageName: unknown linkType: soft @@ -3065,16 +3121,16 @@ __metadata: "@synthetixio/docgen": "workspace:*" "@synthetixio/main": "workspace:*" "@synthetixio/oracle-manager": "workspace:*" - "@synthetixio/router": ^3.1.3 + "@synthetixio/router": ^3.3.0 "@synthetixio/wei": 2.74.4 "@types/node-fetch": 2.6.4 - "@usecannon/cli": ^2.5.1 + "@usecannon/cli": ^2.7.1 ethers: ^5.7.2 - hardhat: 2.15.0 + hardhat: 2.17.2 node-fetch: 2.6.9 solidity-docgen: 0.6.0-beta.35 ts-node: 10.9.1 - typescript: 4.9.3 + typescript: ^4.9.3 languageName: unknown linkType: soft @@ -3089,6 +3145,25 @@ __metadata: languageName: node linkType: hard +"@toml-tools/lexer@npm:^1.0.0": + version: 1.0.0 + resolution: "@toml-tools/lexer@npm:1.0.0" + dependencies: + chevrotain: ^11.0.1 + checksum: 9a0915903a56dc865a363843f4a8e5ea8ba5e33d7ab7483646fa8b5c9cc8bedd1ee26b2200fde752e824989c0d02adde80a58d424b0adc0ba87f92c0508a1572 + languageName: node + linkType: hard + +"@toml-tools/parser@npm:^1.0.0": + version: 1.0.0 + resolution: "@toml-tools/parser@npm:1.0.0" + dependencies: + "@toml-tools/lexer": ^1.0.0 + chevrotain: ^11.0.1 + checksum: 3846d9dd7b96622dc363bb73f1b746ea4a04eb1f099f087cb0668f58d471853c94833e2781bd700a464d20a3b2451e408af10b6ec49648901e4cc99e02ef2033 + languageName: node + linkType: hard + "@tootallnate/once@npm:2": version: 2.0.0 resolution: "@tootallnate/once@npm:2.0.0" @@ -3390,7 +3465,7 @@ __metadata: languageName: node linkType: hard -"@types/mocha@npm:10.0.1": +"@types/mocha@npm:^10.0.1": version: 10.0.1 resolution: "@types/mocha@npm:10.0.1" checksum: 224ea9fce7b1734ccdb9aa99a622d902a538ce1847bca7fd22c5fb38adcf3ed536f50f48f587085db988a4bb3c2eb68f4b98e1cd6a38bc5547bd3bbbedc54495 @@ -3421,13 +3496,6 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:18.11.10": - version: 18.11.10 - resolution: "@types/node@npm:18.11.10" - checksum: 0f60cb090b2ee91fcd3dc4311bc1ed7889b92f14644c0069f100776f86474c12eebbcc6c75bc0d7d96b975a103b4d5d6b3c22b4e88bea6e7f4e2b1bb0daf5ea8 - languageName: node - linkType: hard - "@types/node@npm:^10.0.3": version: 10.17.60 resolution: "@types/node@npm:10.17.60" @@ -3442,6 +3510,13 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:^18.16.0": + version: 18.17.15 + resolution: "@types/node@npm:18.17.15" + checksum: eed11d4398ccdb999a4c65658ee75de621a4ad57aece48ed2fb8803b1e2711fadf58d8aefbdb0a447d69cf3cba602ca32fe0fc92077575950a796e1dc13baa0f + languageName: node + linkType: hard + "@types/node@npm:^8.0.0": version: 8.10.66 resolution: "@types/node@npm:8.10.66" @@ -3562,17 +3637,18 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:5.45.0": - version: 5.45.0 - resolution: "@typescript-eslint/eslint-plugin@npm:5.45.0" +"@typescript-eslint/eslint-plugin@npm:^5.45.0": + version: 5.62.0 + resolution: "@typescript-eslint/eslint-plugin@npm:5.62.0" dependencies: - "@typescript-eslint/scope-manager": 5.45.0 - "@typescript-eslint/type-utils": 5.45.0 - "@typescript-eslint/utils": 5.45.0 + "@eslint-community/regexpp": ^4.4.0 + "@typescript-eslint/scope-manager": 5.62.0 + "@typescript-eslint/type-utils": 5.62.0 + "@typescript-eslint/utils": 5.62.0 debug: ^4.3.4 + graphemer: ^1.4.0 ignore: ^5.2.0 natural-compare-lite: ^1.4.0 - regexpp: ^3.2.0 semver: ^7.3.7 tsutils: ^3.21.0 peerDependencies: @@ -3581,43 +3657,43 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 7cff671a9ba33afa86f0ece6d0ebaeb5fc16596fc659ef230f6f65bfddfef2ffb6434310e3a4444fb852e79e40c85c5e62c559df6ddc9312aac235a18afdd269 + checksum: fc104b389c768f9fa7d45a48c86d5c1ad522c1d0512943e782a56b1e3096b2cbcc1eea3fcc590647bf0658eef61aac35120a9c6daf979bf629ad2956deb516a1 languageName: node linkType: hard -"@typescript-eslint/parser@npm:5.45.0": - version: 5.45.0 - resolution: "@typescript-eslint/parser@npm:5.45.0" +"@typescript-eslint/parser@npm:^5.45.0": + version: 5.62.0 + resolution: "@typescript-eslint/parser@npm:5.62.0" dependencies: - "@typescript-eslint/scope-manager": 5.45.0 - "@typescript-eslint/types": 5.45.0 - "@typescript-eslint/typescript-estree": 5.45.0 + "@typescript-eslint/scope-manager": 5.62.0 + "@typescript-eslint/types": 5.62.0 + "@typescript-eslint/typescript-estree": 5.62.0 debug: ^4.3.4 peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 peerDependenciesMeta: typescript: optional: true - checksum: b8ce3af72de3ff22bb206c3299e728d37a836dbe1f75bcb66ad3bb7962204174b7fff834992b84f0e661de507729c01c7ad71ad2707c217cccc3c0f798a9dc23 + checksum: d168f4c7f21a7a63f47002e2d319bcbb6173597af5c60c1cf2de046b46c76b4930a093619e69faf2d30214c29ab27b54dcf1efc7046a6a6bd6f37f59a990e752 languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:5.45.0": - version: 5.45.0 - resolution: "@typescript-eslint/scope-manager@npm:5.45.0" +"@typescript-eslint/scope-manager@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/scope-manager@npm:5.62.0" dependencies: - "@typescript-eslint/types": 5.45.0 - "@typescript-eslint/visitor-keys": 5.45.0 - checksum: 8f686be8ee0c7ac49ee2a313570cddf86a1364b1ec129f50f8a531038a3bb241429734dc5e2c4e5dd76cc3ed149628aa3e8425cc092f37ca6885b1995c99c2d1 + "@typescript-eslint/types": 5.62.0 + "@typescript-eslint/visitor-keys": 5.62.0 + checksum: 6062d6b797fe1ce4d275bb0d17204c827494af59b5eaf09d8a78cdd39dadddb31074dded4297aaf5d0f839016d601032857698b0e4516c86a41207de606e9573 languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:5.45.0": - version: 5.45.0 - resolution: "@typescript-eslint/type-utils@npm:5.45.0" +"@typescript-eslint/type-utils@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/type-utils@npm:5.62.0" dependencies: - "@typescript-eslint/typescript-estree": 5.45.0 - "@typescript-eslint/utils": 5.45.0 + "@typescript-eslint/typescript-estree": 5.62.0 + "@typescript-eslint/utils": 5.62.0 debug: ^4.3.4 tsutils: ^3.21.0 peerDependencies: @@ -3625,23 +3701,23 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: be96c89b91116b8fbed160631f3cdd345d47e34248a38e8a730fa9e09a4aa21184259414547d3c7a741b83fa68d4a14f77e9fc93b84aba4752f67bd5a772bf27 + checksum: fc41eece5f315dfda14320be0da78d3a971d650ea41300be7196934b9715f3fe1120a80207551eb71d39568275dbbcf359bde540d1ca1439d8be15e9885d2739 languageName: node linkType: hard -"@typescript-eslint/types@npm:5.45.0": - version: 5.45.0 - resolution: "@typescript-eslint/types@npm:5.45.0" - checksum: 43d533622995f002221e439ea517aa07dbce2067cc880a6eb9d26307c505b746975f334d76b35501a2f4dd06d7aaf79964d86ce5a95e76a4f309d6e54faf5213 +"@typescript-eslint/types@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/types@npm:5.62.0" + checksum: 48c87117383d1864766486f24de34086155532b070f6264e09d0e6139449270f8a9559cfef3c56d16e3bcfb52d83d42105d61b36743626399c7c2b5e0ac3b670 languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:5.45.0": - version: 5.45.0 - resolution: "@typescript-eslint/typescript-estree@npm:5.45.0" +"@typescript-eslint/typescript-estree@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/typescript-estree@npm:5.62.0" dependencies: - "@typescript-eslint/types": 5.45.0 - "@typescript-eslint/visitor-keys": 5.45.0 + "@typescript-eslint/types": 5.62.0 + "@typescript-eslint/visitor-keys": 5.62.0 debug: ^4.3.4 globby: ^11.1.0 is-glob: ^4.0.3 @@ -3650,42 +3726,43 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 8f48b3c75c155491ee49436c470e491f9fe48e6e7c95190c4d0c0ab64ce24e8bc6715de86996baf57fc9f0c6dae986ce9ae075e656664489bfa1dc706eaafcd7 + checksum: 3624520abb5807ed8f57b1197e61c7b1ed770c56dfcaca66372d584ff50175225798bccb701f7ef129d62c5989070e1ee3a0aa2d84e56d9524dcf011a2bb1a52 languageName: node linkType: hard -"@typescript-eslint/utils@npm:5.45.0": - version: 5.45.0 - resolution: "@typescript-eslint/utils@npm:5.45.0" +"@typescript-eslint/utils@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/utils@npm:5.62.0" dependencies: + "@eslint-community/eslint-utils": ^4.2.0 "@types/json-schema": ^7.0.9 "@types/semver": ^7.3.12 - "@typescript-eslint/scope-manager": 5.45.0 - "@typescript-eslint/types": 5.45.0 - "@typescript-eslint/typescript-estree": 5.45.0 + "@typescript-eslint/scope-manager": 5.62.0 + "@typescript-eslint/types": 5.62.0 + "@typescript-eslint/typescript-estree": 5.62.0 eslint-scope: ^5.1.1 - eslint-utils: ^3.0.0 semver: ^7.3.7 peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - checksum: 33a383881efb6c6e0ecd32f74810ca18bb5e85d4839f607409047d6e3d64a98b3cd1e811d027638d051b3741981de50a652c3abe0fcbb70fac80d7d93cd3e36f + checksum: ee9398c8c5db6d1da09463ca7bf36ed134361e20131ea354b2da16a5fdb6df9ba70c62a388d19f6eebb421af1786dbbd79ba95ddd6ab287324fc171c3e28d931 languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:5.45.0": - version: 5.45.0 - resolution: "@typescript-eslint/visitor-keys@npm:5.45.0" +"@typescript-eslint/visitor-keys@npm:5.62.0": + version: 5.62.0 + resolution: "@typescript-eslint/visitor-keys@npm:5.62.0" dependencies: - "@typescript-eslint/types": 5.45.0 + "@typescript-eslint/types": 5.62.0 eslint-visitor-keys: ^3.3.0 - checksum: 050cc4275d8a3638a106c2915410710e775382996130a6b2af732269e55cbbc4ed438c8662ddf409635d2d8bd0d8a4389b3980bc2cb38c6105c77c6835222af0 + checksum: 976b05d103fe8335bef5c93ad3f76d781e3ce50329c0243ee0f00c0fcfb186c81df50e64bfdd34970148113f8ade90887f53e3c4938183afba830b4ba8e30a35 languageName: node linkType: hard -"@usecannon/builder@npm:^2.5.1": - version: 2.5.1 - resolution: "@usecannon/builder@npm:2.5.1" +"@usecannon/builder@npm:2.7.1, @usecannon/builder@npm:^2.7.1": + version: 2.7.1 + resolution: "@usecannon/builder@npm:2.7.1" dependencies: + "@synthetixio/router": ^3.3.0 axios: ^1.2.2 buffer: ^6.0.3 debug: ^4.3.4 @@ -3697,17 +3774,17 @@ __metadata: zod: ^3.21.4 peerDependencies: ethers: ">=5.6.0" - checksum: f8840380635a87a8265e35fba85b00bcbb85d54ad27c8cfed4c90549f568e51fba700570722c8d9c5e3758edf2bed8fe94604153106d4510e8034a226f8259ff + checksum: 547e76098e7ef1098c02fefb3e3771f8966799b709489779890d2ce1301d716cb65f14dc35ff82486cda2e638e6966560e14ab718859a74145d3f59cd2aef178 languageName: node linkType: hard -"@usecannon/cli@npm:^2.5.1": - version: 2.5.1 - resolution: "@usecannon/cli@npm:2.5.1" +"@usecannon/cli@npm:^2.7.1": + version: 2.7.1 + resolution: "@usecannon/cli@npm:2.7.1" dependencies: "@iarna/toml": ^3.0.0 "@synthetixio/wei": ^2.74.1 - "@usecannon/builder": ^2.5.1 + "@usecannon/builder": ^2.7.1 chalk: ^4.1.2 commander: ^9.5.0 debug: ^4.3.4 @@ -3723,7 +3800,7 @@ __metadata: untildify: ^4.0.0 bin: cannon: dist/bin/cannon.js - checksum: 7b31ace8d8bc3d1cc36cbbc535acdefeac7006d10d360be69f55aba2e1f8110a2fe9e2e261ff714c1a2dff8e5d01e8cc887da3fdd82968fa9a038982935396d0 + checksum: c506e76581f6f96475c3f11b429d09085d37a1d8582874f1141e29d1d4d49398e031d6974a58fe03cfea343ae4cbbb457b491b1e005ee20ed0cd160717bdf4b1 languageName: node linkType: hard @@ -3952,7 +4029,7 @@ __metadata: languageName: node linkType: hard -"acorn-jsx@npm:^5.0.0, acorn-jsx@npm:^5.3.2": +"acorn-jsx@npm:^5.3.2": version: 5.3.2 resolution: "acorn-jsx@npm:5.3.2" peerDependencies: @@ -3968,21 +4045,12 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^6.0.7": - version: 6.4.2 - resolution: "acorn@npm:6.4.2" - bin: - acorn: bin/acorn - checksum: 44b07053729db7f44d28343eed32247ed56dc4a6ec6dff2b743141ecd6b861406bbc1c20bf9d4f143ea7dd08add5dc8c290582756539bc03a8db605050ce2fb4 - languageName: node - linkType: hard - -"acorn@npm:^8.4.1, acorn@npm:^8.8.0": - version: 8.9.0 - resolution: "acorn@npm:8.9.0" +"acorn@npm:^8.4.1, acorn@npm:^8.9.0": + version: 8.10.0 + resolution: "acorn@npm:8.10.0" bin: acorn: bin/acorn - checksum: 25dfb94952386ecfb847e61934de04a4e7c2dc21c2e700fc4e2ef27ce78cb717700c4c4f279cd630bb4774948633c3859fc16063ec8573bda4568e0a312e6744 + checksum: 538ba38af0cc9e5ef983aee196c4b8b4d87c0c94532334fa7e065b2c8a1f85863467bb774231aae91613fcda5e68740c15d97b1967ae3394d20faddddd8af61d languageName: node linkType: hard @@ -4051,7 +4119,7 @@ __metadata: languageName: node linkType: hard -"ajv@npm:^6.10.0, ajv@npm:^6.10.2, ajv@npm:^6.12.3, ajv@npm:^6.12.4, ajv@npm:^6.6.1, ajv@npm:^6.9.1": +"ajv@npm:^6.12.3, ajv@npm:^6.12.4, ajv@npm:^6.12.6": version: 6.12.6 resolution: "ajv@npm:6.12.6" dependencies: @@ -4063,7 +4131,7 @@ __metadata: languageName: node linkType: hard -"ajv@npm:^8.0.1, ajv@npm:^8.11.0": +"ajv@npm:^8.0.1": version: 8.12.0 resolution: "ajv@npm:8.12.0" dependencies: @@ -4103,7 +4171,7 @@ __metadata: languageName: node linkType: hard -"ansi-escapes@npm:^3.1.0, ansi-escapes@npm:^3.2.0": +"ansi-escapes@npm:^3.1.0": version: 3.2.0 resolution: "ansi-escapes@npm:3.2.0" checksum: 0f94695b677ea742f7f1eed961f7fd8d05670f744c6ad1f8f635362f6681dcfbc1575cb05b43abc7bb6d67e25a75fb8c7ea8f2a57330eb2c76b33f18cb2cef0a @@ -4119,6 +4187,15 @@ __metadata: languageName: node linkType: hard +"ansi-escapes@npm:^5.0.0": + version: 5.0.0 + resolution: "ansi-escapes@npm:5.0.0" + dependencies: + type-fest: ^1.0.2 + checksum: d4b5eb8207df38367945f5dd2ef41e08c28edc192dc766ef18af6b53736682f49d8bfcfa4e4d6ecbc2e2f97c258fda084fb29a9e43b69170b71090f771afccac + languageName: node + linkType: hard + "ansi-regex@npm:^3.0.0": version: 3.0.1 resolution: "ansi-regex@npm:3.0.1" @@ -4172,7 +4249,7 @@ __metadata: languageName: node linkType: hard -"ansi-styles@npm:^6.1.0": +"ansi-styles@npm:^6.0.0, ansi-styles@npm:^6.1.0": version: 6.2.1 resolution: "ansi-styles@npm:6.2.1" checksum: ef940f2f0ced1a6347398da88a91da7930c33ecac3c77b72c5905f8b8fe402c52e6fde304ff5347f616e27a742da3f1dc76de98f6866c69251ad0b07a66776d9 @@ -4186,10 +4263,10 @@ __metadata: languageName: node linkType: hard -"antlr4@npm:4.7.1": - version: 4.7.1 - resolution: "antlr4@npm:4.7.1" - checksum: ac8644a82aa4031bf466b9dbde40c2f8b20cd944d41649332f01d4ecd384531f76fcefb1cfd044bdbad3d1fd3e2457e792aa72241aaffa225f3a1fe1aca7b9d5 +"antlr4@npm:^4.11.0": + version: 4.13.1 + resolution: "antlr4@npm:4.13.1" + checksum: 76dcb0c8ed2d0b83a16641579668088919f51d1288551604e3cdff46c67955b3eef25892aead9de1eca203b3968536fa952e6931f35ba877780af37971c055f1 languageName: node linkType: hard @@ -4479,13 +4556,6 @@ __metadata: languageName: node linkType: hard -"astral-regex@npm:^1.0.0": - version: 1.0.0 - resolution: "astral-regex@npm:1.0.0" - checksum: 93417fc0879531cd95ace2560a54df865c9461a3ac0714c60cbbaa5f1f85d2bee85489e78d82f70b911b71ac25c5f05fc5a36017f44c9bb33c701bee229ff848 - languageName: node - linkType: hard - "astral-regex@npm:^2.0.0": version: 2.0.0 resolution: "astral-regex@npm:2.0.0" @@ -5070,28 +5140,10 @@ __metadata: languageName: node linkType: hard -"caller-callsite@npm:^2.0.0": - version: 2.0.0 - resolution: "caller-callsite@npm:2.0.0" - dependencies: - callsites: ^2.0.0 - checksum: b685e9d126d9247b320cfdfeb3bc8da0c4be28d8fb98c471a96bc51aab3130099898a2fe3bf0308f0fe048d64c37d6d09f563958b9afce1a1e5e63d879c128a2 - languageName: node - linkType: hard - -"caller-path@npm:^2.0.0": - version: 2.0.0 - resolution: "caller-path@npm:2.0.0" - dependencies: - caller-callsite: ^2.0.0 - checksum: 3e12ccd0c71ec10a057aac69e3ec175b721ca858c640df021ef0d25999e22f7c1d864934b596b7d47038e9b56b7ec315add042abbd15caac882998b50102fb12 - languageName: node - linkType: hard - -"callsites@npm:^2.0.0": - version: 2.0.0 - resolution: "callsites@npm:2.0.0" - checksum: be2f67b247df913732b7dec1ec0bbfcdbaea263e5a95968b19ec7965affae9496b970e3024317e6d4baa8e28dc6ba0cec03f46fdddc2fdcc51396600e53c2623 +"callsite@npm:^1.0.0": + version: 1.0.0 + resolution: "callsite@npm:1.0.0" + checksum: 569686d622a288a4f0a827466c2f967b6d7a98f2ee1e6ada9dcf5a6802267a5e2a995d40f07113b5f95c7b2b2d5cbff4fdde590195f2a8bed24b829d048688f8 languageName: node linkType: hard @@ -5134,16 +5186,6 @@ __metadata: languageName: node linkType: hard -"cannon-plugin-router@npm:^1.0.16": - version: 1.0.16 - resolution: "cannon-plugin-router@npm:1.0.16" - dependencies: - "@synthetixio/router": ^3.1.4 - zod: ^3.21.4 - checksum: 27f6f541419e2c6ed1be4d4f433844079e5c72fa2dce631454321a7a14bddd48d7a4966de57934cf7c6753c8f16aad85a7673be7708f42ff6b640c59e93ce26f - languageName: node - linkType: hard - "cardinal@npm:^2.1.1": version: 2.1.1 resolution: "cardinal@npm:2.1.1" @@ -5230,7 +5272,14 @@ __metadata: languageName: node linkType: hard -"chalk@npm:^2.0.0, chalk@npm:^2.1.0, chalk@npm:^2.4.2": +"chalk@npm:5.3.0": + version: 5.3.0 + resolution: "chalk@npm:5.3.0" + checksum: 623922e077b7d1e9dedaea6f8b9e9352921f8ae3afe739132e0e00c275971bdd331268183b2628cf4ab1727c45ea1f28d7e24ac23ce1db1eb653c414ca8a5a80 + languageName: node + linkType: hard + +"chalk@npm:^2.0.0, chalk@npm:^2.4.2": version: 2.4.2 resolution: "chalk@npm:2.4.2" dependencies: @@ -5288,7 +5337,7 @@ __metadata: languageName: node linkType: hard -"chokidar@npm:3.5.3, chokidar@npm:>=3.0.0 <4.0.0, chokidar@npm:^3.4.0": +"chokidar@npm:3.5.3, chokidar@npm:^3.4.0": version: 3.5.3 resolution: "chokidar@npm:3.5.3" dependencies: @@ -5382,15 +5431,6 @@ __metadata: languageName: node linkType: hard -"cli-cursor@npm:^2.1.0": - version: 2.1.0 - resolution: "cli-cursor@npm:2.1.0" - dependencies: - restore-cursor: ^2.0.0 - checksum: d88e97bfdac01046a3ffe7d49f06757b3126559d7e44aa2122637eb179284dc6cd49fca2fac4f67c19faaf7e6dab716b6fe1dfcd309977407d8c7578ec2d044d - languageName: node - linkType: hard - "cli-cursor@npm:^3.1.0": version: 3.1.0 resolution: "cli-cursor@npm:3.1.0" @@ -5400,6 +5440,15 @@ __metadata: languageName: node linkType: hard +"cli-cursor@npm:^4.0.0": + version: 4.0.0 + resolution: "cli-cursor@npm:4.0.0" + dependencies: + restore-cursor: ^4.0.0 + checksum: ab3f3ea2076e2176a1da29f9d64f72ec3efad51c0960898b56c8a17671365c26e67b735920530eaf7328d61f8bd41c27f46b9cf6e4e10fe2fa44b5e8c0e392cc + languageName: node + linkType: hard + "cli-progress@npm:^3.12.0": version: 3.12.0 resolution: "cli-progress@npm:3.12.0" @@ -5457,10 +5506,13 @@ __metadata: languageName: node linkType: hard -"cli-width@npm:^2.0.0": - version: 2.2.1 - resolution: "cli-width@npm:2.2.1" - checksum: 3c21b897a2ff551ae5b3c3ab32c866ed2965dcf7fb442f81adf0e27f4a397925c8f84619af7bcc6354821303f6ee9b2aa31d248306174f32c287986158cf4eed +"cli-truncate@npm:^3.1.0": + version: 3.1.0 + resolution: "cli-truncate@npm:3.1.0" + dependencies: + slice-ansi: ^5.0.0 + string-width: ^5.0.0 + checksum: c3243e41974445691c63f8b405df1d5a24049dc33d324fe448dc572e561a7b772ae982692900b1a5960901cc4fc7def25a629b9c69a4208ee89d12ab3332617a languageName: node linkType: hard @@ -5595,6 +5647,13 @@ __metadata: languageName: node linkType: hard +"colorette@npm:^2.0.20": + version: 2.0.20 + resolution: "colorette@npm:2.0.20" + checksum: 0c016fea2b91b733eb9f4bcdb580018f52c0bc0979443dad930e5037a968237ac53d9beb98e218d2e9235834f8eebce7f8e080422d6194e957454255bde71d3d + languageName: node + linkType: hard + "colors@npm:1.4.0, colors@npm:^1.1.2": version: 1.4.0 resolution: "colors@npm:1.4.0" @@ -5652,10 +5711,10 @@ __metadata: languageName: node linkType: hard -"commander@npm:2.18.0": - version: 2.18.0 - resolution: "commander@npm:2.18.0" - checksum: 3a31585348a5000bbdc457c9839aabbdf0bb0020e5dfaa1c9f9903680073d67c06911b55368e4c8df2ed166e0d4468f9a668585c1667c321804034a2819a819f +"commander@npm:11.0.0": + version: 11.0.0 + resolution: "commander@npm:11.0.0" + checksum: 6621954e1e1d078b4991c1f5bbd9439ad37aa7768d6ab4842de1dbd4d222c8a27e1b8e62108b3a92988614af45031d5bb2a2aaa92951f4d0c934d1a1ac564bb4 languageName: node linkType: hard @@ -5666,6 +5725,13 @@ __metadata: languageName: node linkType: hard +"commander@npm:^10.0.0": + version: 10.0.1 + resolution: "commander@npm:10.0.1" + checksum: 436901d64a818295803c1996cd856621a74f30b9f9e28a588e726b2b1670665bccd7c1a77007ebf328729f0139838a88a19265858a0fa7a8728c4656796db948 + languageName: node + linkType: hard + "commander@npm:^2.20.3": version: 2.20.3 resolution: "commander@npm:2.20.3" @@ -5928,18 +5994,6 @@ __metadata: languageName: node linkType: hard -"cosmiconfig@npm:^5.0.7": - version: 5.2.1 - resolution: "cosmiconfig@npm:5.2.1" - dependencies: - import-fresh: ^2.0.0 - is-directory: ^0.3.1 - js-yaml: ^3.13.1 - parse-json: ^4.0.0 - checksum: 8b6f1d3c8a5ffdf663a952f17af0761adf210b7a5933d0fe8988f3ca3a1f0e1e5cbbb74d5b419c15933dd2fdcaec31dbc5cc85cb8259a822342b93b529eff89c - languageName: node - linkType: hard - "cosmiconfig@npm:^7.0.0": version: 7.1.0 resolution: "cosmiconfig@npm:7.1.0" @@ -5953,6 +6007,23 @@ __metadata: languageName: node linkType: hard +"cosmiconfig@npm:^8.0.0": + version: 8.3.6 + resolution: "cosmiconfig@npm:8.3.6" + dependencies: + import-fresh: ^3.3.0 + js-yaml: ^4.1.0 + parse-json: ^5.2.0 + path-type: ^4.0.0 + peerDependencies: + typescript: ">=4.9.5" + peerDependenciesMeta: + typescript: + optional: true + checksum: dc339ebea427898c9e03bf01b56ba7afbac07fc7d2a2d5a15d6e9c14de98275a9565da949375aee1809591c152c0a3877bb86dbeaf74d5bd5aaa79955ad9e7a0 + languageName: node + linkType: hard + "crc-32@npm:^1.2.0": version: 1.2.2 resolution: "crc-32@npm:1.2.2" @@ -6096,7 +6167,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:4, debug@npm:4.3.4, debug@npm:^4.0.1, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.2.0, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4": +"debug@npm:4, debug@npm:4.3.4, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.2.0, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4": version: 4.3.4 resolution: "debug@npm:4.3.4" dependencies: @@ -6237,17 +6308,19 @@ __metadata: languageName: node linkType: hard -"depcheck@npm:1.4.3": - version: 1.4.3 - resolution: "depcheck@npm:1.4.3" +"depcheck@npm:^1.4.3": + version: 1.4.6 + resolution: "depcheck@npm:1.4.6" dependencies: - "@babel/parser": 7.16.4 - "@babel/traverse": ^7.12.5 + "@babel/parser": 7.22.5 + "@babel/traverse": 7.22.5 "@vue/compiler-sfc": ^3.0.5 + callsite: ^1.0.0 camelcase: ^6.2.0 cosmiconfig: ^7.0.0 debug: ^4.2.0 deps-regex: ^0.1.4 + findup-sync: ^5.0.0 ignore: ^5.1.8 is-core-module: ^2.4.0 js-yaml: ^3.14.0 @@ -6256,17 +6329,15 @@ __metadata: minimatch: ^3.0.4 multimatch: ^5.0.0 please-upgrade-node: ^3.2.0 - query-ast: ^1.0.3 readdirp: ^3.5.0 require-package-name: ^2.0.1 resolve: ^1.18.1 - sass: ^1.29.0 - scss-parser: ^1.0.4 + resolve-from: ^5.0.0 semver: ^7.3.2 yargs: ^16.1.0 bin: depcheck: bin/depcheck.js - checksum: 122631cab325707a55e26a8b530eb72c893bd481194100b1853ac2bc944b61320eb0e1ea0ff7e71724009cdfbd4057381d7bf868b9c5aad0c4207ac0bdca5e48 + checksum: 028c11045377249e9a4c24817157829b238b7794e7ad4856f7d587214ed0fae3fb8bd27b9962bdad38b405464ad64a13e45fb45ca78f6563d1675057fd9961e9 languageName: node linkType: hard @@ -6291,6 +6362,13 @@ __metadata: languageName: node linkType: hard +"detect-file@npm:^1.0.0": + version: 1.0.0 + resolution: "detect-file@npm:1.0.0" + checksum: 1861e4146128622e847abe0e1ed80fef01e78532665858a792267adf89032b7a9c698436137707fcc6f02956c2a6a0052d6a0cef5be3d4b76b1ff0da88e2158a + languageName: node + linkType: hard + "detect-indent@npm:^5.0.0": version: 5.0.0 resolution: "detect-indent@npm:5.0.0" @@ -6537,13 +6615,6 @@ __metadata: languageName: node linkType: hard -"emoji-regex@npm:^10.2.1": - version: 10.2.1 - resolution: "emoji-regex@npm:10.2.1" - checksum: 1aa2d16881c56531fdfc03d0b36f5c2b6221cc4097499a5665b88b711dc3fb4d5b8804f0ca6f00c56e5dcf89bac75f0487eee85da1da77df3a33accc6ecbe426 - languageName: node - linkType: hard - "emoji-regex@npm:^7.0.1": version: 7.0.3 resolution: "emoji-regex@npm:7.0.3" @@ -6796,18 +6867,7 @@ __metadata: languageName: node linkType: hard -"eslint-config-prettier@npm:8.5.0": - version: 8.5.0 - resolution: "eslint-config-prettier@npm:8.5.0" - peerDependencies: - eslint: ">=7.0.0" - bin: - eslint-config-prettier: bin/cli.js - checksum: 0d0f5c32e7a0ad91249467ce71ca92394ccd343178277d318baf32063b79ea90216f4c81d1065d60f96366fdc60f151d4d68ae7811a58bd37228b84c2083f893 - languageName: node - linkType: hard - -"eslint-plugin-no-only-tests@npm:3.1.0": +"eslint-plugin-no-only-tests@npm:^3.1.0": version: 3.1.0 resolution: "eslint-plugin-no-only-tests@npm:3.1.0" checksum: 2a5de82f3a732dbd46792661dd0f8546cf819f76d8828968166dee35741e8039904ba473dafe1eed585f401a496d260c2c38354bb887c94bd4ced0ddca00fb62 @@ -6820,16 +6880,6 @@ __metadata: languageName: unknown linkType: soft -"eslint-scope@npm:^4.0.3": - version: 4.0.3 - resolution: "eslint-scope@npm:4.0.3" - dependencies: - esrecurse: ^4.1.0 - estraverse: ^4.1.1 - checksum: c5f835f681884469991fe58d76a554688d9c9e50811299ccd4a8f79993a039f5bcb0ee6e8de2b0017d97c794b5832ef3b21c9aac66228e3aa0f7a0485bcfb65b - languageName: node - linkType: hard - "eslint-scope@npm:^5.1.1": version: 5.1.1 resolution: "eslint-scope@npm:5.1.1" @@ -6840,171 +6890,78 @@ __metadata: languageName: node linkType: hard -"eslint-scope@npm:^7.1.1": - version: 7.2.0 - resolution: "eslint-scope@npm:7.2.0" +"eslint-scope@npm:^7.2.2": + version: 7.2.2 + resolution: "eslint-scope@npm:7.2.2" dependencies: esrecurse: ^4.3.0 estraverse: ^5.2.0 - checksum: 64591a2d8b244ade9c690b59ef238a11d5c721a98bcee9e9f445454f442d03d3e04eda88e95a4daec558220a99fa384309d9faae3d459bd40e7a81b4063980ae - languageName: node - linkType: hard - -"eslint-utils@npm:^1.3.1": - version: 1.4.3 - resolution: "eslint-utils@npm:1.4.3" - dependencies: - eslint-visitor-keys: ^1.1.0 - checksum: a20630e686034107138272f245c460f6d77705d1f4bb0628c1a1faf59fc800f441188916b3ec3b957394dc405aa200a3017dfa2b0fff0976e307a4e645a18d1e - languageName: node - linkType: hard - -"eslint-utils@npm:^3.0.0": - version: 3.0.0 - resolution: "eslint-utils@npm:3.0.0" - dependencies: - eslint-visitor-keys: ^2.0.0 - peerDependencies: - eslint: ">=5" - checksum: 0668fe02f5adab2e5a367eee5089f4c39033af20499df88fe4e6aba2015c20720404d8c3d6349b6f716b08fdf91b9da4e5d5481f265049278099c4c836ccb619 - languageName: node - linkType: hard - -"eslint-visitor-keys@npm:^1.0.0, eslint-visitor-keys@npm:^1.1.0": - version: 1.3.0 - resolution: "eslint-visitor-keys@npm:1.3.0" - checksum: 37a19b712f42f4c9027e8ba98c2b06031c17e0c0a4c696cd429bd9ee04eb43889c446f2cd545e1ff51bef9593fcec94ecd2c2ef89129fcbbf3adadbef520376a - languageName: node - linkType: hard - -"eslint-visitor-keys@npm:^2.0.0": - version: 2.1.0 - resolution: "eslint-visitor-keys@npm:2.1.0" - checksum: e3081d7dd2611a35f0388bbdc2f5da60b3a3c5b8b6e928daffff7391146b434d691577aa95064c8b7faad0b8a680266bcda0a42439c18c717b80e6718d7e267d + checksum: ec97dbf5fb04b94e8f4c5a91a7f0a6dd3c55e46bfc7bbcd0e3138c3a76977570e02ed89a1810c778dcd72072ff0e9621ba1379b4babe53921d71e2e4486fda3e languageName: node linkType: hard -"eslint-visitor-keys@npm:^3.3.0, eslint-visitor-keys@npm:^3.4.1": - version: 3.4.1 - resolution: "eslint-visitor-keys@npm:3.4.1" - checksum: f05121d868202736b97de7d750847a328fcfa8593b031c95ea89425333db59676ac087fa905eba438d0a3c5769632f828187e0c1a0d271832a2153c1d3661c2c +"eslint-visitor-keys@npm:^3.3.0, eslint-visitor-keys@npm:^3.4.1, eslint-visitor-keys@npm:^3.4.3": + version: 3.4.3 + resolution: "eslint-visitor-keys@npm:3.4.3" + checksum: 36e9ef87fca698b6fd7ca5ca35d7b2b6eeaaf106572e2f7fd31c12d3bfdaccdb587bba6d3621067e5aece31c8c3a348b93922ab8f7b2cbc6aaab5e1d89040c60 languageName: node linkType: hard -"eslint@npm:8.29.0": - version: 8.29.0 - resolution: "eslint@npm:8.29.0" +"eslint@npm:^8.29.0": + version: 8.49.0 + resolution: "eslint@npm:8.49.0" dependencies: - "@eslint/eslintrc": ^1.3.3 - "@humanwhocodes/config-array": ^0.11.6 + "@eslint-community/eslint-utils": ^4.2.0 + "@eslint-community/regexpp": ^4.6.1 + "@eslint/eslintrc": ^2.1.2 + "@eslint/js": 8.49.0 + "@humanwhocodes/config-array": ^0.11.11 "@humanwhocodes/module-importer": ^1.0.1 "@nodelib/fs.walk": ^1.2.8 - ajv: ^6.10.0 + ajv: ^6.12.4 chalk: ^4.0.0 cross-spawn: ^7.0.2 debug: ^4.3.2 doctrine: ^3.0.0 escape-string-regexp: ^4.0.0 - eslint-scope: ^7.1.1 - eslint-utils: ^3.0.0 - eslint-visitor-keys: ^3.3.0 - espree: ^9.4.0 - esquery: ^1.4.0 + eslint-scope: ^7.2.2 + eslint-visitor-keys: ^3.4.3 + espree: ^9.6.1 + esquery: ^1.4.2 esutils: ^2.0.2 fast-deep-equal: ^3.1.3 file-entry-cache: ^6.0.1 find-up: ^5.0.0 glob-parent: ^6.0.2 - globals: ^13.15.0 - grapheme-splitter: ^1.0.4 + globals: ^13.19.0 + graphemer: ^1.4.0 ignore: ^5.2.0 - import-fresh: ^3.0.0 imurmurhash: ^0.1.4 is-glob: ^4.0.0 is-path-inside: ^3.0.3 - js-sdsl: ^4.1.4 js-yaml: ^4.1.0 json-stable-stringify-without-jsonify: ^1.0.1 levn: ^0.4.1 lodash.merge: ^4.6.2 minimatch: ^3.1.2 natural-compare: ^1.4.0 - optionator: ^0.9.1 - regexpp: ^3.2.0 + optionator: ^0.9.3 strip-ansi: ^6.0.1 - strip-json-comments: ^3.1.0 text-table: ^0.2.0 bin: eslint: bin/eslint.js - checksum: e05204b05907b82d910983995cb946e0ba62ca514eb2b6791c43f623333b143564a2eee0139909d31c10935c21877d815b1f76dd674a59cb91c471064325c4ab - languageName: node - linkType: hard - -"eslint@npm:^5.6.0": - version: 5.16.0 - resolution: "eslint@npm:5.16.0" - dependencies: - "@babel/code-frame": ^7.0.0 - ajv: ^6.9.1 - chalk: ^2.1.0 - cross-spawn: ^6.0.5 - debug: ^4.0.1 - doctrine: ^3.0.0 - eslint-scope: ^4.0.3 - eslint-utils: ^1.3.1 - eslint-visitor-keys: ^1.0.0 - espree: ^5.0.1 - esquery: ^1.0.1 - esutils: ^2.0.2 - file-entry-cache: ^5.0.1 - functional-red-black-tree: ^1.0.1 - glob: ^7.1.2 - globals: ^11.7.0 - ignore: ^4.0.6 - import-fresh: ^3.0.0 - imurmurhash: ^0.1.4 - inquirer: ^6.2.2 - js-yaml: ^3.13.0 - json-stable-stringify-without-jsonify: ^1.0.1 - levn: ^0.3.0 - lodash: ^4.17.11 - minimatch: ^3.0.4 - mkdirp: ^0.5.1 - natural-compare: ^1.4.0 - optionator: ^0.8.2 - path-is-inside: ^1.0.2 - progress: ^2.0.0 - regexpp: ^2.0.1 - semver: ^5.5.1 - strip-ansi: ^4.0.0 - strip-json-comments: ^2.0.1 - table: ^5.2.3 - text-table: ^0.2.0 - bin: - eslint: ./bin/eslint.js - checksum: 53c6b9420992df95f986dc031f76949edbea14bdeed4e40d8cda8970fbf0fc013c6d91b98f469b6477753e50c9af133c1a768e421a1c160ec2cac7a246e05494 - languageName: node - linkType: hard - -"espree@npm:^5.0.1": - version: 5.0.1 - resolution: "espree@npm:5.0.1" - dependencies: - acorn: ^6.0.7 - acorn-jsx: ^5.0.0 - eslint-visitor-keys: ^1.0.0 - checksum: a091aac2bddf872484b0a7e779e3a1ffab32d1c55a6c4f99e483613a0149443531272c191eda1c7c827e32a9e10f6ce7ea6b131c7b3f4e12471fe618ebbc5b7e + checksum: 4dfe257e1e42da2f9da872b05aaaf99b0f5aa022c1a91eee8f2af1ab72651b596366320c575ccd4e0469f7b4c97aff5bb85ae3323ebd6a293c3faef4028b0d81 languageName: node linkType: hard -"espree@npm:^9.4.0": - version: 9.5.2 - resolution: "espree@npm:9.5.2" +"espree@npm:^9.6.0, espree@npm:^9.6.1": + version: 9.6.1 + resolution: "espree@npm:9.6.1" dependencies: - acorn: ^8.8.0 + acorn: ^8.9.0 acorn-jsx: ^5.3.2 eslint-visitor-keys: ^3.4.1 - checksum: 6506289d6eb26471c0b383ee24fee5c8ae9d61ad540be956b3127be5ce3bf687d2ba6538ee5a86769812c7c552a9d8239e8c4d150f9ea056c6d5cbe8399c03c1 + checksum: eb8c149c7a2a77b3f33a5af80c10875c3abd65450f60b8af6db1bfcfa8f101e21c1e56a561c6dc13b848e18148d43469e7cd208506238554fb5395a9ea5a1ab9 languageName: node linkType: hard @@ -7028,7 +6985,7 @@ __metadata: languageName: node linkType: hard -"esquery@npm:^1.0.1, esquery@npm:^1.4.0": +"esquery@npm:^1.4.2": version: 1.5.0 resolution: "esquery@npm:1.5.0" dependencies: @@ -7037,7 +6994,7 @@ __metadata: languageName: node linkType: hard -"esrecurse@npm:^4.1.0, esrecurse@npm:^4.3.0": +"esrecurse@npm:^4.3.0": version: 4.3.0 resolution: "esrecurse@npm:4.3.0" dependencies: @@ -7303,6 +7260,13 @@ __metadata: languageName: node linkType: hard +"eventemitter3@npm:^5.0.1": + version: 5.0.1 + resolution: "eventemitter3@npm:5.0.1" + checksum: 543d6c858ab699303c3c32e0f0f47fc64d360bf73c3daf0ac0b5079710e340d6fe9f15487f94e66c629f5f82cd1a8678d692f3dbb6f6fcd1190e1b97fcad36f8 + languageName: node + linkType: hard + "events@npm:3.3.0, events@npm:^3.3.0": version: 3.3.0 resolution: "events@npm:3.3.0" @@ -7338,20 +7302,20 @@ __metadata: languageName: node linkType: hard -"execa@npm:^4.0.0": - version: 4.1.0 - resolution: "execa@npm:4.1.0" +"execa@npm:7.2.0": + version: 7.2.0 + resolution: "execa@npm:7.2.0" dependencies: - cross-spawn: ^7.0.0 - get-stream: ^5.0.0 - human-signals: ^1.1.1 - is-stream: ^2.0.0 + cross-spawn: ^7.0.3 + get-stream: ^6.0.1 + human-signals: ^4.3.0 + is-stream: ^3.0.0 merge-stream: ^2.0.0 - npm-run-path: ^4.0.0 - onetime: ^5.1.0 - signal-exit: ^3.0.2 - strip-final-newline: ^2.0.0 - checksum: e30d298934d9c52f90f3847704fd8224e849a081ab2b517bbc02f5f7732c24e56a21f14cb96a08256deffeb2d12b2b7cb7e2b014a12fb36f8d3357e06417ed55 + npm-run-path: ^5.1.0 + onetime: ^6.0.0 + signal-exit: ^3.0.7 + strip-final-newline: ^3.0.0 + checksum: 14fd17ba0ca8c87b277584d93b1d9fc24f2a65e5152b31d5eb159a3b814854283eaae5f51efa9525e304447e2f757c691877f7adff8fde5746aae67eb1edd1cc languageName: node linkType: hard @@ -7362,6 +7326,15 @@ __metadata: languageName: node linkType: hard +"expand-tilde@npm:^2.0.0, expand-tilde@npm:^2.0.2": + version: 2.0.2 + resolution: "expand-tilde@npm:2.0.2" + dependencies: + homedir-polyfill: ^1.0.1 + checksum: 2efe6ed407d229981b1b6ceb552438fbc9e5c7d6a6751ad6ced3e0aa5cf12f0b299da695e90d6c2ac79191b5c53c613e508f7149e4573abfbb540698ddb7301a + languageName: node + linkType: hard + "expect@npm:^29.0.0, expect@npm:^29.5.0": version: 29.5.0 resolution: "expect@npm:29.5.0" @@ -7435,7 +7408,7 @@ __metadata: languageName: node linkType: hard -"fast-diff@npm:^1.1.2": +"fast-diff@npm:^1.2.0": version: 1.3.0 resolution: "fast-diff@npm:1.3.0" checksum: d22d371b994fdc8cce9ff510d7b8dc4da70ac327bcba20df607dd5b9cae9f908f4d1028f5fe467650f058d1e7270235ae0b8230809a262b4df587a3b3aa216c3 @@ -7512,15 +7485,6 @@ __metadata: languageName: node linkType: hard -"figures@npm:^2.0.0": - version: 2.0.0 - resolution: "figures@npm:2.0.0" - dependencies: - escape-string-regexp: ^1.0.5 - checksum: 081beb16ea57d1716f8447c694f637668322398b57017b20929376aaf5def9823b35245b734cdd87e4832dc96e9c6f46274833cada77bfe15e5f980fea1fd21f - languageName: node - linkType: hard - "figures@npm:^3.0.0": version: 3.2.0 resolution: "figures@npm:3.2.0" @@ -7530,15 +7494,6 @@ __metadata: languageName: node linkType: hard -"file-entry-cache@npm:^5.0.1": - version: 5.0.1 - resolution: "file-entry-cache@npm:5.0.1" - dependencies: - flat-cache: ^2.0.1 - checksum: 9014b17766815d59b8b789633aed005242ef857348c09be558bd85b4a24e16b0ad1e0e5229ccea7a2109f74ef1b3db1a559b58afe12b884f09019308711376fd - languageName: node - linkType: hard - "file-entry-cache@npm:^6.0.1": version: 6.0.1 resolution: "file-entry-cache@npm:6.0.1" @@ -7624,14 +7579,15 @@ __metadata: languageName: node linkType: hard -"flat-cache@npm:^2.0.1": - version: 2.0.1 - resolution: "flat-cache@npm:2.0.1" +"findup-sync@npm:^5.0.0": + version: 5.0.0 + resolution: "findup-sync@npm:5.0.0" dependencies: - flatted: ^2.0.0 - rimraf: 2.6.3 - write: 1.0.3 - checksum: 0f5e66467658039e6fcaaccb363b28f43906ba72fab7ff2a4f6fcd5b4899679e13ca46d9fc6cc48b68ac925ae93137106d4aaeb79874c13f21f87a361705f1b1 + detect-file: ^1.0.0 + is-glob: ^4.0.3 + micromatch: ^4.0.4 + resolve-dir: ^1.0.1 + checksum: 576716c77a0e8330b17ae9cba27d1fda8907c8cda7bf33a47f1999e16e089bfc6df4dd62933e0760f430736183c054348c34aa45dd882d49c8c098f55b89ee1d languageName: node linkType: hard @@ -7665,13 +7621,6 @@ __metadata: languageName: node linkType: hard -"flatted@npm:^2.0.0": - version: 2.0.2 - resolution: "flatted@npm:2.0.2" - checksum: 473c754db7a529e125a22057098f1a4c905ba17b8cc269c3acf77352f0ffa6304c851eb75f6a1845f74461f560e635129ca6b0b8a78fb253c65cea4de3d776f2 - languageName: node - linkType: hard - "flatted@npm:^3.1.0": version: 3.2.7 resolution: "flatted@npm:3.2.7" @@ -8079,15 +8028,6 @@ __metadata: languageName: node linkType: hard -"get-stream@npm:^5.0.0": - version: 5.2.0 - resolution: "get-stream@npm:5.2.0" - dependencies: - pump: ^3.0.0 - checksum: 8bc1a23174a06b2b4ce600df38d6c98d2ef6d84e020c1ddad632ad75bac4e092eeb40e4c09e0761c35fc2dbc5e7fff5dab5e763a383582c4a167dd69a905bd12 - languageName: node - linkType: hard - "get-stream@npm:^6.0.0, get-stream@npm:^6.0.1": version: 6.0.1 resolution: "get-stream@npm:6.0.1" @@ -8291,7 +8231,7 @@ __metadata: languageName: node linkType: hard -"glob@npm:^7.0.0, glob@npm:^7.1.2, glob@npm:^7.1.3, glob@npm:^7.1.4, glob@npm:^7.1.6, glob@npm:^7.2.3": +"glob@npm:^7.0.0, glob@npm:^7.1.3, glob@npm:^7.1.4, glob@npm:^7.1.6, glob@npm:^7.2.3": version: 7.2.3 resolution: "glob@npm:7.2.3" dependencies: @@ -8305,6 +8245,30 @@ __metadata: languageName: node linkType: hard +"glob@npm:^8.0.3": + version: 8.1.0 + resolution: "glob@npm:8.1.0" + dependencies: + fs.realpath: ^1.0.0 + inflight: ^1.0.4 + inherits: 2 + minimatch: ^5.0.1 + once: ^1.3.0 + checksum: 92fbea3221a7d12075f26f0227abac435de868dd0736a17170663783296d0dd8d3d532a5672b4488a439bf5d7fb85cdd07c11185d6cd39184f0385cbdfb86a47 + languageName: node + linkType: hard + +"global-modules@npm:^1.0.0": + version: 1.0.0 + resolution: "global-modules@npm:1.0.0" + dependencies: + global-prefix: ^1.0.1 + is-windows: ^1.0.1 + resolve-dir: ^1.0.0 + checksum: 10be68796c1e1abc1e2ba87ec4ea507f5629873b119ab0cd29c07284ef2b930f1402d10df01beccb7391dedd9cd479611dd6a24311c71be58937beaf18edf85e + languageName: node + linkType: hard + "global-modules@npm:^2.0.0": version: 2.0.0 resolution: "global-modules@npm:2.0.0" @@ -8314,6 +8278,19 @@ __metadata: languageName: node linkType: hard +"global-prefix@npm:^1.0.1": + version: 1.0.2 + resolution: "global-prefix@npm:1.0.2" + dependencies: + expand-tilde: ^2.0.2 + homedir-polyfill: ^1.0.1 + ini: ^1.3.4 + is-windows: ^1.0.1 + which: ^1.2.14 + checksum: 061b43470fe498271bcd514e7746e8a8535032b17ab9570517014ae27d700ff0dca749f76bbde13ba384d185be4310d8ba5712cb0e74f7d54d59390db63dd9a0 + languageName: node + linkType: hard + "global-prefix@npm:^3.0.0": version: 3.0.0 resolution: "global-prefix@npm:3.0.0" @@ -8325,14 +8302,14 @@ __metadata: languageName: node linkType: hard -"globals@npm:^11.1.0, globals@npm:^11.7.0": +"globals@npm:^11.1.0": version: 11.12.0 resolution: "globals@npm:11.12.0" checksum: 67051a45eca3db904aee189dfc7cd53c20c7d881679c93f6146ddd4c9f4ab2268e68a919df740d39c71f4445d2b38ee360fc234428baea1dbdfe68bbcb46979e languageName: node linkType: hard -"globals@npm:^13.15.0, globals@npm:^13.19.0": +"globals@npm:^13.19.0": version: 13.20.0 resolution: "globals@npm:13.20.0" dependencies: @@ -8436,10 +8413,10 @@ __metadata: languageName: node linkType: hard -"grapheme-splitter@npm:^1.0.4": - version: 1.0.4 - resolution: "grapheme-splitter@npm:1.0.4" - checksum: 0c22ec54dee1b05cd480f78cf14f732cb5b108edc073572c4ec205df4cd63f30f8db8025afc5debc8835a8ddeacf648a1c7992fe3dcd6ad38f9a476d84906620 +"graphemer@npm:^1.4.0": + version: 1.4.0 + resolution: "graphemer@npm:1.4.0" + checksum: bab8f0be9b568857c7bec9fda95a89f87b783546d02951c40c33f84d05bb7da3fd10f863a9beb901463669b6583173a8c8cc6d6b306ea2b9b9d5d3d943c3a673 languageName: node linkType: hard @@ -8515,13 +8492,13 @@ __metadata: languageName: node linkType: hard -"hardhat-cannon@npm:2.5.1": - version: 2.5.1 - resolution: "hardhat-cannon@npm:2.5.1" +"hardhat-cannon@npm:2.7.1": + version: 2.7.1 + resolution: "hardhat-cannon@npm:2.7.1" dependencies: "@iarna/toml": ^3.0.0 - "@usecannon/builder": ^2.5.1 - "@usecannon/cli": ^2.5.1 + "@usecannon/builder": ^2.7.1 + "@usecannon/cli": ^2.7.1 adm-zip: ^0.5.9 chalk: ^4.1.2 debug: ^4.3.3 @@ -8534,10 +8511,10 @@ __metadata: prompts: ^2.4.2 table: ^6.8.0 peerDependencies: - "@nomiclabs/hardhat-ethers": ^2.0.0 - "@nomiclabs/hardhat-etherscan": ^3.0.0 - hardhat: ^2.0.0 - checksum: 043c553eda90bd2fc7fe7a08aaf067141941a9ae194ae6a02d36d374e24675a17539fb6a6b5f884f7b3e142f5a0bf6d27418f7998910b623f30ab35bd44af5ae + "@nomiclabs/hardhat-ethers": ">=2.0.0" + "@nomiclabs/hardhat-etherscan": ">=3.0.0" + hardhat: ">=2.0.0" + checksum: 1bf091eb6de901a6d7af12d144e43dd6a3a19c1dbb3ccb2c7a417ba95fc4f82358da1b49c542296f7f921a085b4651f3a606441d38bbb14b5cddd31ae76056b6 languageName: node linkType: hard @@ -8578,27 +8555,26 @@ __metadata: languageName: node linkType: hard -"hardhat@npm:2.15.0": - version: 2.15.0 - resolution: "hardhat@npm:2.15.0" +"hardhat@npm:2.17.2": + version: 2.17.2 + resolution: "hardhat@npm:2.17.2" dependencies: "@ethersproject/abi": ^5.1.2 "@metamask/eth-sig-util": ^4.0.0 - "@nomicfoundation/ethereumjs-block": 5.0.1 - "@nomicfoundation/ethereumjs-blockchain": 7.0.1 - "@nomicfoundation/ethereumjs-common": 4.0.1 - "@nomicfoundation/ethereumjs-evm": 2.0.1 - "@nomicfoundation/ethereumjs-rlp": 5.0.1 - "@nomicfoundation/ethereumjs-statemanager": 2.0.1 - "@nomicfoundation/ethereumjs-trie": 6.0.1 - "@nomicfoundation/ethereumjs-tx": 5.0.1 - "@nomicfoundation/ethereumjs-util": 9.0.1 - "@nomicfoundation/ethereumjs-vm": 7.0.1 + "@nomicfoundation/ethereumjs-block": 5.0.2 + "@nomicfoundation/ethereumjs-blockchain": 7.0.2 + "@nomicfoundation/ethereumjs-common": 4.0.2 + "@nomicfoundation/ethereumjs-evm": 2.0.2 + "@nomicfoundation/ethereumjs-rlp": 5.0.2 + "@nomicfoundation/ethereumjs-statemanager": 2.0.2 + "@nomicfoundation/ethereumjs-trie": 6.0.2 + "@nomicfoundation/ethereumjs-tx": 5.0.2 + "@nomicfoundation/ethereumjs-util": 9.0.2 + "@nomicfoundation/ethereumjs-vm": 7.0.2 "@nomicfoundation/solidity-analyzer": ^0.1.0 "@sentry/node": ^5.18.1 "@types/bn.js": ^5.1.0 "@types/lru-cache": ^5.1.0 - abort-controller: ^3.0.0 adm-zip: ^0.4.16 aggregate-error: ^3.0.0 ansi-escapes: ^4.3.0 @@ -8621,7 +8597,6 @@ __metadata: mnemonist: ^0.38.0 mocha: ^10.0.0 p-map: ^4.0.0 - qs: ^6.7.0 raw-body: ^2.4.1 resolve: 1.17.0 semver: ^6.3.0 @@ -8642,7 +8617,7 @@ __metadata: optional: true bin: hardhat: internal/cli/bootstrap.js - checksum: 46767f0eb75f08e1f47585d3aec3261932251b47909051bfffcbff317f7efe06fdab7cb8686cb67c46cc7ed4cedb80d0c21157fe03f103054001b2762085ef92 + checksum: 7c80f45354c82e812e04ab75e6cab40c1e561969265762f5d254365beecd6bb261186d3da445de5963ca2e1125bf495f3263aa9f762f436d8920ca4551e31204 languageName: node linkType: hard @@ -8790,6 +8765,15 @@ __metadata: languageName: node linkType: hard +"homedir-polyfill@npm:^1.0.1": + version: 1.0.3 + resolution: "homedir-polyfill@npm:1.0.3" + dependencies: + parse-passwd: ^1.0.0 + checksum: 18dd4db87052c6a2179d1813adea0c4bfcfa4f9996f0e226fefb29eb3d548e564350fa28ec46b0bf1fbc0a1d2d6922ceceb80093115ea45ff8842a4990139250 + languageName: node + linkType: hard + "hosted-git-info@npm:^2.1.4": version: 2.8.9 resolution: "hosted-git-info@npm:2.8.9" @@ -8902,13 +8886,6 @@ __metadata: languageName: node linkType: hard -"human-signals@npm:^1.1.1": - version: 1.1.1 - resolution: "human-signals@npm:1.1.1" - checksum: d587647c9e8ec24e02821b6be7de5a0fc37f591f6c4e319b3054b43fd4c35a70a94c46fc74d8c1a43c47fde157d23acd7421f375e1c1365b09a16835b8300205 - languageName: node - linkType: hard - "human-signals@npm:^2.1.0": version: 2.1.0 resolution: "human-signals@npm:2.1.0" @@ -8916,6 +8893,13 @@ __metadata: languageName: node linkType: hard +"human-signals@npm:^4.3.0": + version: 4.3.1 + resolution: "human-signals@npm:4.3.1" + checksum: 6f12958df3f21b6fdaf02d90896c271df00636a31e2bbea05bddf817a35c66b38a6fdac5863e2df85bd52f34958997f1f50350ff97249e1dff8452865d5235d1 + languageName: node + linkType: hard + "humanize-ms@npm:^1.2.1": version: 1.2.1 resolution: "humanize-ms@npm:1.2.1" @@ -8966,14 +8950,7 @@ __metadata: languageName: node linkType: hard -"ignore@npm:^4.0.6": - version: 4.0.6 - resolution: "ignore@npm:4.0.6" - checksum: 248f82e50a430906f9ee7f35e1158e3ec4c3971451dd9f99c9bc1548261b4db2b99709f60ac6c6cac9333494384176cc4cc9b07acbe42d52ac6a09cad734d800 - languageName: node - linkType: hard - -"ignore@npm:^5.1.1, ignore@npm:^5.1.4, ignore@npm:^5.1.8, ignore@npm:^5.2.0": +"ignore@npm:^5.1.1, ignore@npm:^5.1.8, ignore@npm:^5.2.0, ignore@npm:^5.2.4": version: 5.2.4 resolution: "ignore@npm:5.2.4" checksum: 3d4c309c6006e2621659311783eaea7ebcd41fe4ca1d78c91c473157ad6666a57a2df790fe0d07a12300d9aac2888204d7be8d59f9aaf665b1c7fcdb432517ef @@ -9001,24 +8978,14 @@ __metadata: languageName: node linkType: hard -"immutable@npm:^4.0.0, immutable@npm:^4.0.0-rc.12": +"immutable@npm:^4.0.0-rc.12": version: 4.3.0 resolution: "immutable@npm:4.3.0" checksum: bbd7ea99e2752e053323543d6ff1cc71a4b4614fa6121f321ca766db2bd2092f3f1e0a90784c5431350b7344a4f792fa002eac227062d59b9377b6c09063b58b languageName: node linkType: hard -"import-fresh@npm:^2.0.0": - version: 2.0.0 - resolution: "import-fresh@npm:2.0.0" - dependencies: - caller-path: ^2.0.0 - resolve-from: ^3.0.0 - checksum: 610255f9753cc6775df00be08e9f43691aa39f7703e3636c45afe22346b8b545e600ccfe100c554607546fc8e861fa149a0d1da078c8adedeea30fff326eef79 - languageName: node - linkType: hard - -"import-fresh@npm:^3.0.0, import-fresh@npm:^3.2.1": +"import-fresh@npm:^3.2.1, import-fresh@npm:^3.3.0": version: 3.3.0 resolution: "import-fresh@npm:3.3.0" dependencies: @@ -9085,27 +9052,6 @@ __metadata: languageName: node linkType: hard -"inquirer@npm:^6.2.2": - version: 6.5.2 - resolution: "inquirer@npm:6.5.2" - dependencies: - ansi-escapes: ^3.2.0 - chalk: ^2.4.2 - cli-cursor: ^2.1.0 - cli-width: ^2.0.0 - external-editor: ^3.0.3 - figures: ^2.0.0 - lodash: ^4.17.12 - mute-stream: 0.0.7 - run-async: ^2.2.0 - rxjs: ^6.4.0 - string-width: ^2.1.0 - strip-ansi: ^5.1.0 - through: ^2.3.6 - checksum: 175ad4cd1ebed493b231b240185f1da5afeace5f4e8811dfa83cf55dcae59c3255eaed990aa71871b0fd31aa9dc212f43c44c50ed04fb529364405e72f484d28 - languageName: node - linkType: hard - "inquirer@npm:^8.2.4": version: 8.2.5 resolution: "inquirer@npm:8.2.5" @@ -9165,15 +9111,6 @@ __metadata: languageName: node linkType: hard -"invariant@npm:2.2.4": - version: 2.2.4 - resolution: "invariant@npm:2.2.4" - dependencies: - loose-envify: ^1.0.0 - checksum: cc3182d793aad82a8d1f0af697b462939cb46066ec48bbf1707c150ad5fad6406137e91a262022c269702e01621f35ef60269f6c0d7fd178487959809acdfb14 - languageName: node - linkType: hard - "io-ts@npm:1.10.4": version: 1.10.4 resolution: "io-ts@npm:1.10.4" @@ -9460,13 +9397,6 @@ __metadata: languageName: node linkType: hard -"is-directory@npm:^0.3.1": - version: 0.3.1 - resolution: "is-directory@npm:0.3.1" - checksum: dce9a9d3981e38f2ded2a80848734824c50ee8680cd09aa477bef617949715cfc987197a2ca0176c58a9fb192a1a0d69b535c397140d241996a609d5906ae524 - languageName: node - linkType: hard - "is-docker@npm:^2.0.0": version: 2.2.1 resolution: "is-docker@npm:2.2.1" @@ -9504,6 +9434,13 @@ __metadata: languageName: node linkType: hard +"is-fullwidth-code-point@npm:^4.0.0": + version: 4.0.0 + resolution: "is-fullwidth-code-point@npm:4.0.0" + checksum: 8ae89bf5057bdf4f57b346fb6c55e9c3dd2549983d54191d722d5c739397a903012cc41a04ee3403fd872e811243ef91a7c5196da7b5841dc6b6aae31a264a8d + languageName: node + linkType: hard + "is-generator-fn@npm:^2.0.0": version: 2.1.0 resolution: "is-generator-fn@npm:2.1.0" @@ -9652,6 +9589,13 @@ __metadata: languageName: node linkType: hard +"is-stream@npm:^3.0.0": + version: 3.0.0 + resolution: "is-stream@npm:3.0.0" + checksum: 172093fe99119ffd07611ab6d1bcccfe8bc4aa80d864b15f43e63e54b7abc71e779acd69afdb854c4e2a67fdc16ae710e370eda40088d1cfc956a50ed82d8f16 + languageName: node + linkType: hard + "is-string@npm:^1.0.5, is-string@npm:^1.0.7": version: 1.0.7 resolution: "is-string@npm:1.0.7" @@ -9715,7 +9659,7 @@ __metadata: languageName: node linkType: hard -"is-windows@npm:^1.0.2": +"is-windows@npm:^1.0.1, is-windows@npm:^1.0.2": version: 1.0.2 resolution: "is-windows@npm:1.0.2" checksum: 438b7e52656fe3b9b293b180defb4e448088e7023a523ec21a91a80b9ff8cdb3377ddb5b6e60f7c7de4fa8b63ab56e121b6705fe081b3cf1b828b0a380009ad7 @@ -10456,7 +10400,7 @@ __metadata: languageName: node linkType: hard -"js-tokens@npm:^3.0.0 || ^4.0.0, js-tokens@npm:^4.0.0": +"js-tokens@npm:^4.0.0": version: 4.0.0 resolution: "js-tokens@npm:4.0.0" checksum: 8a95213a5a77deb6cbe94d86340e8d9ace2b93bc367790b260101d2f36a2eaf4e4e22d9fa9cf459b38af3a32fb4190e638024cf82ec95ef708680e405ea7cc78 @@ -10475,7 +10419,7 @@ __metadata: languageName: node linkType: hard -"js-yaml@npm:3.14.1, js-yaml@npm:3.x, js-yaml@npm:^3.12.0, js-yaml@npm:^3.13.0, js-yaml@npm:^3.13.1, js-yaml@npm:^3.14.0, js-yaml@npm:^3.14.1": +"js-yaml@npm:3.14.1, js-yaml@npm:3.x, js-yaml@npm:^3.13.1, js-yaml@npm:^3.14.0, js-yaml@npm:^3.14.1": version: 3.14.1 resolution: "js-yaml@npm:3.14.1" dependencies: @@ -10831,16 +10775,6 @@ __metadata: languageName: node linkType: hard -"levn@npm:^0.3.0, levn@npm:~0.3.0": - version: 0.3.0 - resolution: "levn@npm:0.3.0" - dependencies: - prelude-ls: ~1.1.2 - type-check: ~0.3.2 - checksum: 0d084a524231a8246bb10fec48cdbb35282099f6954838604f3c7fc66f2e16fa66fd9cc2f3f20a541a113c4dafdf181e822c887c8a319c9195444e6c64ac395e - languageName: node - linkType: hard - "levn@npm:^0.4.1": version: 0.4.1 resolution: "levn@npm:0.4.1" @@ -10851,6 +10785,16 @@ __metadata: languageName: node linkType: hard +"levn@npm:~0.3.0": + version: 0.3.0 + resolution: "levn@npm:0.3.0" + dependencies: + prelude-ls: ~1.1.2 + type-check: ~0.3.2 + checksum: 0d084a524231a8246bb10fec48cdbb35282099f6954838604f3c7fc66f2e16fa66fd9cc2f3f20a541a113c4dafdf181e822c887c8a319c9195444e6c64ac395e + languageName: node + linkType: hard + "libnpmaccess@npm:^7.0.2": version: 7.0.2 resolution: "libnpmaccess@npm:7.0.2" @@ -10877,6 +10821,13 @@ __metadata: languageName: node linkType: hard +"lilconfig@npm:2.1.0": + version: 2.1.0 + resolution: "lilconfig@npm:2.1.0" + checksum: 8549bb352b8192375fed4a74694cd61ad293904eee33f9d4866c2192865c44c4eb35d10782966242634e0cbc1e91fe62b1247f148dc5514918e3a966da7ea117 + languageName: node + linkType: hard + "lines-and-columns@npm:^1.1.6": version: 1.2.4 resolution: "lines-and-columns@npm:1.2.4" @@ -10884,6 +10835,45 @@ __metadata: languageName: node linkType: hard +"lint-staged@npm:^14.0.1": + version: 14.0.1 + resolution: "lint-staged@npm:14.0.1" + dependencies: + chalk: 5.3.0 + commander: 11.0.0 + debug: 4.3.4 + execa: 7.2.0 + lilconfig: 2.1.0 + listr2: 6.6.1 + micromatch: 4.0.5 + pidtree: 0.6.0 + string-argv: 0.3.2 + yaml: 2.3.1 + bin: + lint-staged: bin/lint-staged.js + checksum: 8c5d740cb3c90fab2d970fa6bbffe5ddf35ec66ed374a52caf3a3cf83d8f4d5fd01a949994822bce5ea18c0b8dc8fa4ce087ef886a8c11db674139a063cdfe4f + languageName: node + linkType: hard + +"listr2@npm:6.6.1": + version: 6.6.1 + resolution: "listr2@npm:6.6.1" + dependencies: + cli-truncate: ^3.1.0 + colorette: ^2.0.20 + eventemitter3: ^5.0.1 + log-update: ^5.0.1 + rfdc: ^1.3.0 + wrap-ansi: ^8.1.0 + peerDependencies: + enquirer: ">= 2.3.0 < 3" + peerDependenciesMeta: + enquirer: + optional: true + checksum: 99600e8a51f838f7208bce7e16d6b3d91d361f13881e6aa91d0b561a9a093ddcf63b7bc2a7b47aec7fdbff9d0e8c9f68cb66e6dfe2d857e5b1df8ab045c26ce8 + languageName: node + linkType: hard + "load-json-file@npm:^4.0.0": version: 4.0.0 resolution: "load-json-file@npm:4.0.0" @@ -10946,6 +10936,13 @@ __metadata: languageName: node linkType: hard +"lodash-es@npm:4.17.21": + version: 4.17.21 + resolution: "lodash-es@npm:4.17.21" + checksum: 05cbffad6e2adbb331a4e16fbd826e7faee403a1a04873b82b42c0f22090f280839f85b95393f487c1303c8a3d2a010048bf06151a6cbe03eee4d388fb0a12d2 + languageName: node + linkType: hard + "lodash.camelcase@npm:^4.3.0": version: 4.3.0 resolution: "lodash.camelcase@npm:4.3.0" @@ -11093,7 +11090,7 @@ __metadata: languageName: node linkType: hard -"lodash@npm:4.17.21, lodash@npm:^4.17.11, lodash@npm:^4.17.12, lodash@npm:^4.17.14, lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.20, lodash@npm:^4.17.21": +"lodash@npm:^4.17.11, lodash@npm:^4.17.14, lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.20, lodash@npm:^4.17.21": version: 4.17.21 resolution: "lodash@npm:4.17.21" checksum: eb835a2e51d381e561e508ce932ea50a8e5a68f4ebdd771ea240d3048244a8d13658acbd502cd4829768c56f2e16bdd4340b9ea141297d472517b83868e677f7 @@ -11119,6 +11116,19 @@ __metadata: languageName: node linkType: hard +"log-update@npm:^5.0.1": + version: 5.0.1 + resolution: "log-update@npm:5.0.1" + dependencies: + ansi-escapes: ^5.0.0 + cli-cursor: ^4.0.0 + slice-ansi: ^5.0.0 + strip-ansi: ^7.0.1 + wrap-ansi: ^8.0.1 + checksum: 2c6b47dcce6f9233df6d232a37d9834cb3657a0749ef6398f1706118de74c55f158587d4128c225297ea66803f35c5ac3db4f3f617046d817233c45eedc32ef1 + languageName: node + linkType: hard + "long@npm:^4.0.0": version: 4.0.0 resolution: "long@npm:4.0.0" @@ -11423,7 +11433,7 @@ __metadata: languageName: node linkType: hard -"micromatch@npm:^4.0.4": +"micromatch@npm:4.0.5, micromatch@npm:^4.0.4": version: 4.0.5 resolution: "micromatch@npm:4.0.5" dependencies: @@ -11449,13 +11459,6 @@ __metadata: languageName: node linkType: hard -"mimic-fn@npm:^1.0.0": - version: 1.2.0 - resolution: "mimic-fn@npm:1.2.0" - checksum: 69c08205156a1f4906d9c46f9b4dc08d18a50176352e77fdeb645cedfe9f20c0b19865d465bd2dec27a5c432347f24dc07fc3695e11159d193f892834233e939 - languageName: node - linkType: hard - "mimic-fn@npm:^2.1.0": version: 2.1.0 resolution: "mimic-fn@npm:2.1.0" @@ -11463,6 +11466,13 @@ __metadata: languageName: node linkType: hard +"mimic-fn@npm:^4.0.0": + version: 4.0.0 + resolution: "mimic-fn@npm:4.0.0" + checksum: 995dcece15ee29aa16e188de6633d43a3db4611bcf93620e7e62109ec41c79c0f34277165b8ce5e361205049766e371851264c21ac64ca35499acb5421c2ba56 + languageName: node + linkType: hard + "min-indent@npm:^1.0.0": version: 1.0.1 resolution: "min-indent@npm:1.0.1" @@ -11715,7 +11725,7 @@ __metadata: languageName: node linkType: hard -"mocha-junit-reporter@npm:2.2.1": +"mocha-junit-reporter@npm:^2.2.1": version: 2.2.1 resolution: "mocha-junit-reporter@npm:2.2.1" dependencies: @@ -11730,38 +11740,6 @@ __metadata: languageName: node linkType: hard -"mocha@npm:10.2.0, mocha@npm:^10.0.0": - version: 10.2.0 - resolution: "mocha@npm:10.2.0" - dependencies: - ansi-colors: 4.1.1 - browser-stdout: 1.3.1 - chokidar: 3.5.3 - debug: 4.3.4 - diff: 5.0.0 - escape-string-regexp: 4.0.0 - find-up: 5.0.0 - glob: 7.2.0 - he: 1.2.0 - js-yaml: 4.1.0 - log-symbols: 4.1.0 - minimatch: 5.0.1 - ms: 2.1.3 - nanoid: 3.3.3 - serialize-javascript: 6.0.0 - strip-json-comments: 3.1.1 - supports-color: 8.1.1 - workerpool: 6.2.1 - yargs: 16.2.0 - yargs-parser: 20.2.4 - yargs-unparser: 2.0.0 - bin: - _mocha: bin/_mocha - mocha: bin/mocha.js - checksum: 406c45eab122ffd6ea2003c2f108b2bc35ba036225eee78e0c784b6fa2c7f34e2b13f1dbacef55a4fdf523255d76e4f22d1b5aacda2394bd11666febec17c719 - languageName: node - linkType: hard - "mocha@npm:7.1.2": version: 7.1.2 resolution: "mocha@npm:7.1.2" @@ -11797,6 +11775,38 @@ __metadata: languageName: node linkType: hard +"mocha@npm:^10.0.0, mocha@npm:^10.2.0": + version: 10.2.0 + resolution: "mocha@npm:10.2.0" + dependencies: + ansi-colors: 4.1.1 + browser-stdout: 1.3.1 + chokidar: 3.5.3 + debug: 4.3.4 + diff: 5.0.0 + escape-string-regexp: 4.0.0 + find-up: 5.0.0 + glob: 7.2.0 + he: 1.2.0 + js-yaml: 4.1.0 + log-symbols: 4.1.0 + minimatch: 5.0.1 + ms: 2.1.3 + nanoid: 3.3.3 + serialize-javascript: 6.0.0 + strip-json-comments: 3.1.1 + supports-color: 8.1.1 + workerpool: 6.2.1 + yargs: 16.2.0 + yargs-parser: 20.2.4 + yargs-unparser: 2.0.0 + bin: + _mocha: bin/_mocha + mocha: bin/mocha.js + checksum: 406c45eab122ffd6ea2003c2f108b2bc35ba036225eee78e0c784b6fa2c7f34e2b13f1dbacef55a4fdf523255d76e4f22d1b5aacda2394bd11666febec17c719 + languageName: node + linkType: hard + "mocha@npm:^7.1.1": version: 7.2.0 resolution: "mocha@npm:7.2.0" @@ -11846,13 +11856,6 @@ __metadata: languageName: node linkType: hard -"mri@npm:^1.1.5": - version: 1.2.0 - resolution: "mri@npm:1.2.0" - checksum: 83f515abbcff60150873e424894a2f65d68037e5a7fcde8a9e2b285ee9c13ac581b63cfc1e6826c4732de3aeb84902f7c1e16b7aff46cd3f897a0f757a894e85 - languageName: node - linkType: hard - "ms@npm:2.1.1": version: 2.1.1 resolution: "ms@npm:2.1.1" @@ -11916,19 +11919,6 @@ __metadata: languageName: node linkType: hard -"multimatch@npm:^4.0.0": - version: 4.0.0 - resolution: "multimatch@npm:4.0.0" - dependencies: - "@types/minimatch": ^3.0.3 - array-differ: ^3.0.0 - array-union: ^2.1.0 - arrify: ^2.0.1 - minimatch: ^3.0.4 - checksum: bdb6a98dad4e919d9a1a2a0db872f44fa2337315f2fd5827d91ae005cf22f4425782bdfa97c10b80d567f0cb3c226c31f4e85f8f6a4a4be4facf9af0de1bb0c2 - languageName: node - linkType: hard - "multimatch@npm:^5.0.0": version: 5.0.0 resolution: "multimatch@npm:5.0.0" @@ -11951,13 +11941,6 @@ __metadata: languageName: node linkType: hard -"mute-stream@npm:0.0.7": - version: 0.0.7 - resolution: "mute-stream@npm:0.0.7" - checksum: a9d4772c1c84206aa37c218ed4751cd060239bf1d678893124f51e037f6f22f4a159b2918c030236c93252638a74beb29c9b1fd3267c9f24d4b3253cf1eaa86f - languageName: node - linkType: hard - "mute-stream@npm:0.0.8": version: 0.0.8 resolution: "mute-stream@npm:0.0.8" @@ -12362,7 +12345,7 @@ __metadata: languageName: node linkType: hard -"npm-run-path@npm:^4.0.0, npm-run-path@npm:^4.0.1": +"npm-run-path@npm:^4.0.1": version: 4.0.1 resolution: "npm-run-path@npm:4.0.1" dependencies: @@ -12371,6 +12354,15 @@ __metadata: languageName: node linkType: hard +"npm-run-path@npm:^5.1.0": + version: 5.1.0 + resolution: "npm-run-path@npm:5.1.0" + dependencies: + path-key: ^4.0.0 + checksum: dc184eb5ec239d6a2b990b43236845332ef12f4e0beaa9701de724aa797fe40b6bbd0157fb7639d24d3ab13f5d5cf22d223a19c6300846b8126f335f788bee66 + languageName: node + linkType: hard + "npmlog@npm:^6.0.0": version: 6.0.2 resolution: "npmlog@npm:6.0.2" @@ -12539,15 +12531,6 @@ __metadata: languageName: node linkType: hard -"onetime@npm:^2.0.0": - version: 2.0.1 - resolution: "onetime@npm:2.0.1" - dependencies: - mimic-fn: ^1.0.0 - checksum: bb44015ac7a525d0fb43b029a583d4ad359834632b4424ca209b438aacf6d669dda81b5edfbdb42c22636e607b276ba5589f46694a729e3bc27948ce26f4cc1a - languageName: node - linkType: hard - "onetime@npm:^5.1.0, onetime@npm:^5.1.2": version: 5.1.2 resolution: "onetime@npm:5.1.2" @@ -12557,7 +12540,16 @@ __metadata: languageName: node linkType: hard -"optionator@npm:^0.8.1, optionator@npm:^0.8.2": +"onetime@npm:^6.0.0": + version: 6.0.0 + resolution: "onetime@npm:6.0.0" + dependencies: + mimic-fn: ^4.0.0 + checksum: 0846ce78e440841335d4e9182ef69d5762e9f38aa7499b19f42ea1c4cd40f0b4446094c455c713f9adac3f4ae86f613bb5e30c99e52652764d06a89f709b3788 + languageName: node + linkType: hard + +"optionator@npm:^0.8.1": version: 0.8.3 resolution: "optionator@npm:0.8.3" dependencies: @@ -12571,17 +12563,17 @@ __metadata: languageName: node linkType: hard -"optionator@npm:^0.9.1": - version: 0.9.1 - resolution: "optionator@npm:0.9.1" +"optionator@npm:^0.9.3": + version: 0.9.3 + resolution: "optionator@npm:0.9.3" dependencies: + "@aashutoshrathi/word-wrap": ^1.2.3 deep-is: ^0.1.3 fast-levenshtein: ^2.0.6 levn: ^0.4.1 prelude-ls: ^1.2.1 type-check: ^0.4.0 - word-wrap: ^1.2.3 - checksum: dbc6fa065604b24ea57d734261914e697bd73b69eff7f18e967e8912aa2a40a19a9f599a507fa805be6c13c24c4eae8c71306c239d517d42d4c041c942f508a0 + checksum: 09281999441f2fe9c33a5eeab76700795365a061563d66b098923eb719251a42bdbe432790d35064d0816ead9296dbeb1ad51a733edf4167c96bd5d0882e428a languageName: node linkType: hard @@ -12886,6 +12878,13 @@ __metadata: languageName: node linkType: hard +"parse-passwd@npm:^1.0.0": + version: 1.0.0 + resolution: "parse-passwd@npm:1.0.0" + checksum: 4e55e0231d58f828a41d0f1da2bf2ff7bcef8f4cb6146e69d16ce499190de58b06199e6bd9b17fbf0d4d8aef9052099cdf8c4f13a6294b1a522e8e958073066e + languageName: node + linkType: hard + "parse-path@npm:^7.0.0": version: 7.0.0 resolution: "parse-path@npm:7.0.0" @@ -12935,13 +12934,6 @@ __metadata: languageName: node linkType: hard -"path-is-inside@npm:^1.0.2": - version: 1.0.2 - resolution: "path-is-inside@npm:1.0.2" - checksum: 0b5b6c92d3018b82afb1f74fe6de6338c4c654de4a96123cb343f2b747d5606590ac0c890f956ed38220a4ab59baddfd7b713d78a62d240b20b14ab801fa02cb - languageName: node - linkType: hard - "path-key@npm:^2.0.1": version: 2.0.1 resolution: "path-key@npm:2.0.1" @@ -12956,6 +12948,13 @@ __metadata: languageName: node linkType: hard +"path-key@npm:^4.0.0": + version: 4.0.0 + resolution: "path-key@npm:4.0.0" + checksum: 8e6c314ae6d16b83e93032c61020129f6f4484590a777eed709c4a01b50e498822b00f76ceaf94bc64dbd90b327df56ceadce27da3d83393790f1219e07721d7 + languageName: node + linkType: hard + "path-parse@npm:^1.0.6, path-parse@npm:^1.0.7": version: 1.0.7 resolution: "path-parse@npm:1.0.7" @@ -13049,6 +13048,15 @@ __metadata: languageName: node linkType: hard +"pidtree@npm:0.6.0": + version: 0.6.0 + resolution: "pidtree@npm:0.6.0" + bin: + pidtree: bin/pidtree.js + checksum: 8fbc073ede9209dd15e80d616e65eb674986c93be49f42d9ddde8dbbd141bb53d628a7ca4e58ab5c370bb00383f67d75df59a9a226dede8fa801267a7030c27a + languageName: node + linkType: hard + "pify@npm:^2.3.0": version: 2.3.0 resolution: "pify@npm:2.3.0" @@ -13130,7 +13138,7 @@ __metadata: languageName: node linkType: hard -"pre-commit@npm:1.2.2": +"pre-commit@npm:^1.2.2": version: 1.2.2 resolution: "pre-commit@npm:1.2.2" dependencies: @@ -13155,23 +13163,32 @@ __metadata: languageName: node linkType: hard -"prettier-plugin-solidity@npm:1.0.0": - version: 1.0.0 - resolution: "prettier-plugin-solidity@npm:1.0.0" +"prettier-plugin-solidity@npm:^1.1.3": + version: 1.1.3 + resolution: "prettier-plugin-solidity@npm:1.1.3" dependencies: - "@solidity-parser/parser": ^0.14.5 - emoji-regex: ^10.2.1 - escape-string-regexp: ^4.0.0 + "@solidity-parser/parser": ^0.16.0 semver: ^7.3.8 solidity-comments-extractor: ^0.0.7 - string-width: ^4.2.3 peerDependencies: - prettier: ^2.3.0 - checksum: 2ca347d66f12dcb397ce3fcf441563c0413f17c8835bea6422625fb190458a6edbdb7c5775ccc8347f049f55f15443361b8fd3ea546a426b4f521c59a16aaf84 + prettier: ">=2.3.0 || >=3.0.0-alpha.0" + checksum: d5aadfa411a4d983a2bd204048726fd91fbcaffbfa26d818ef0d6001fb65f82d0eae082e935e96c79e65e09ed979b186311ddb8c38be2f0ce5dd5f5265df77fe languageName: node linkType: hard -"prettier@npm:1.19.1, prettier@npm:^1.14.3": +"prettier-plugin-toml@npm:^1.0.0": + version: 1.0.0 + resolution: "prettier-plugin-toml@npm:1.0.0" + dependencies: + "@toml-tools/lexer": ^1.0.0 + "@toml-tools/parser": ^1.0.0 + peerDependencies: + prettier: ^3.0.0 + checksum: 6c883670611831df2f86f3f638d4e3f2079d26942c89484ece2d9821d90ee2cd6019fd96d0f8b52e59d48ec9e171b37077ef581d3fe18a8db7305002ce240402 + languageName: node + linkType: hard + +"prettier@npm:1.19.1": version: 1.19.1 resolution: "prettier@npm:1.19.1" bin: @@ -13180,7 +13197,7 @@ __metadata: languageName: node linkType: hard -"prettier@npm:^2.3.1, prettier@npm:^2.8.8": +"prettier@npm:^2.3.1, prettier@npm:^2.8.3": version: 2.8.8 resolution: "prettier@npm:2.8.8" bin: @@ -13189,6 +13206,15 @@ __metadata: languageName: node linkType: hard +"prettier@npm:^3.0.3": + version: 3.0.3 + resolution: "prettier@npm:3.0.3" + bin: + prettier: bin/prettier.cjs + checksum: e10b9af02b281f6c617362ebd2571b1d7fc9fb8a3bd17e371754428cda992e5e8d8b7a046e8f7d3e2da1dcd21aa001e2e3c797402ebb6111b5cd19609dd228e0 + languageName: node + linkType: hard + "pretty-format@npm:^29.0.0, pretty-format@npm:^29.5.0": version: 29.5.0 resolution: "pretty-format@npm:29.5.0" @@ -13200,24 +13226,6 @@ __metadata: languageName: node linkType: hard -"pretty-quick@npm:3.1.3": - version: 3.1.3 - resolution: "pretty-quick@npm:3.1.3" - dependencies: - chalk: ^3.0.0 - execa: ^4.0.0 - find-up: ^4.1.0 - ignore: ^5.1.4 - mri: ^1.1.5 - multimatch: ^4.0.0 - peerDependencies: - prettier: ">=2.0.0" - bin: - pretty-quick: bin/pretty-quick.js - checksum: 28bdc32571e6308e049497f58a9245f272275973782b6ed7fbcf98937101cc605a81b3ab48629dba4687b7e86c87a3733febacdc0746ca4da5d1c80a0b88cf45 - languageName: node - linkType: hard - "proc-log@npm:^3.0.0": version: 3.0.0 resolution: "proc-log@npm:3.0.0" @@ -13248,13 +13256,6 @@ __metadata: languageName: node linkType: hard -"progress@npm:^2.0.0": - version: 2.0.3 - resolution: "progress@npm:2.0.3" - checksum: f67403fe7b34912148d9252cb7481266a354bd99ce82c835f79070643bb3c6583d10dbcfda4d41e04bbc1d8437e9af0fb1e1f2135727878f5308682a579429b7 - languageName: node - linkType: hard - "promise-all-reject-late@npm:^1.0.0": version: 1.0.1 resolution: "promise-all-reject-late@npm:1.0.1" @@ -13388,16 +13389,6 @@ __metadata: languageName: node linkType: hard -"pump@npm:^3.0.0": - version: 3.0.0 - resolution: "pump@npm:3.0.0" - dependencies: - end-of-stream: ^1.1.0 - once: ^1.3.1 - checksum: e42e9229fba14732593a718b04cb5e1cfef8254544870997e0ecd9732b189a48e1256e4e5478148ecb47c8511dca2b09eae56b4d0aad8009e6fac8072923cfc9 - languageName: node - linkType: hard - "punycode@npm:^1.3.2": version: 1.4.1 resolution: "punycode@npm:1.4.1" @@ -13442,7 +13433,7 @@ __metadata: languageName: node linkType: hard -"qs@npm:^6.4.0, qs@npm:^6.7.0": +"qs@npm:^6.4.0": version: 6.11.2 resolution: "qs@npm:6.11.2" dependencies: @@ -13458,16 +13449,6 @@ __metadata: languageName: node linkType: hard -"query-ast@npm:^1.0.3": - version: 1.0.5 - resolution: "query-ast@npm:1.0.5" - dependencies: - invariant: 2.2.4 - lodash: ^4.17.21 - checksum: 4b7ae79bc907d0614c8d306d77fc82a19d40f5900bace286943839b875d84a52aa4993a73fdb8f4e989461b88474c47a60a48c7a42964b53253d5abe1452e9ad - languageName: node - linkType: hard - "queue-microtask@npm:^1.2.2, queue-microtask@npm:^1.2.3": version: 1.2.3 resolution: "queue-microtask@npm:1.2.3" @@ -13724,20 +13705,6 @@ __metadata: languageName: node linkType: hard -"regexpp@npm:^2.0.1": - version: 2.0.1 - resolution: "regexpp@npm:2.0.1" - checksum: 1f41cf80ac08514c6665812e3dcc0673569431d3285db27053f8b237a758992fb55d6ddfbc264db399ff4f7a7db432900ca3a029daa28a75e0436231872091b1 - languageName: node - linkType: hard - -"regexpp@npm:^3.2.0": - version: 3.2.0 - resolution: "regexpp@npm:3.2.0" - checksum: a78dc5c7158ad9ddcfe01aa9144f46e192ddbfa7b263895a70a5c6c73edd9ce85faf7c0430e59ac38839e1734e275b9c3de5c57ee3ab6edc0e0b1bdebefccef8 - languageName: node - linkType: hard - "release-zalgo@npm:^1.0.0": version: 1.0.0 resolution: "release-zalgo@npm:1.0.0" @@ -13854,6 +13821,16 @@ __metadata: languageName: node linkType: hard +"resolve-dir@npm:^1.0.0, resolve-dir@npm:^1.0.1": + version: 1.0.1 + resolution: "resolve-dir@npm:1.0.1" + dependencies: + expand-tilde: ^2.0.0 + global-modules: ^1.0.0 + checksum: ef736b8ed60d6645c3b573da17d329bfb50ec4e1d6c5ffd6df49e3497acef9226f9810ea6823b8ece1560e01dcb13f77a9f6180d4f242d00cc9a8f4de909c65c + languageName: node + linkType: hard + "resolve-from@npm:^3.0.0": version: 3.0.0 resolution: "resolve-from@npm:3.0.0" @@ -13940,23 +13917,23 @@ __metadata: languageName: node linkType: hard -"restore-cursor@npm:^2.0.0": - version: 2.0.0 - resolution: "restore-cursor@npm:2.0.0" +"restore-cursor@npm:^3.1.0": + version: 3.1.0 + resolution: "restore-cursor@npm:3.1.0" dependencies: - onetime: ^2.0.0 + onetime: ^5.1.0 signal-exit: ^3.0.2 - checksum: 482e13d02d834b6e5e3aa90304a8b5e840775d6f06916cc92a50038adf9f098dcc72405b567da8a37e137ae40ad3e31896fa3136ae62f7a426c2fbf53d036536 + checksum: f877dd8741796b909f2a82454ec111afb84eb45890eb49ac947d87991379406b3b83ff9673a46012fca0d7844bb989f45cc5b788254cf1a39b6b5a9659de0630 languageName: node linkType: hard -"restore-cursor@npm:^3.1.0": - version: 3.1.0 - resolution: "restore-cursor@npm:3.1.0" +"restore-cursor@npm:^4.0.0": + version: 4.0.0 + resolution: "restore-cursor@npm:4.0.0" dependencies: onetime: ^5.1.0 signal-exit: ^3.0.2 - checksum: f877dd8741796b909f2a82454ec111afb84eb45890eb49ac947d87991379406b3b83ff9673a46012fca0d7844bb989f45cc5b788254cf1a39b6b5a9659de0630 + checksum: 5b675c5a59763bf26e604289eab35711525f11388d77f409453904e1e69c0d37ae5889295706b2c81d23bd780165084d040f9b68fffc32cc921519031c4fa4af languageName: node linkType: hard @@ -13981,24 +13958,13 @@ __metadata: languageName: node linkType: hard -"rfdc@npm:1.3.0": +"rfdc@npm:1.3.0, rfdc@npm:^1.3.0": version: 1.3.0 resolution: "rfdc@npm:1.3.0" checksum: fb2ba8512e43519983b4c61bd3fa77c0f410eff6bae68b08614437bc3f35f91362215f7b4a73cbda6f67330b5746ce07db5dd9850ad3edc91271ad6deea0df32 languageName: node linkType: hard -"rimraf@npm:2.6.3": - version: 2.6.3 - resolution: "rimraf@npm:2.6.3" - dependencies: - glob: ^7.1.3 - bin: - rimraf: ./bin.js - checksum: 3ea587b981a19016297edb96d1ffe48af7e6af69660e3b371dbfc73722a73a0b0e9be5c88089fbeeb866c389c1098e07f64929c7414290504b855f54f901ab10 - languageName: node - linkType: hard - "rimraf@npm:^2.2.8, rimraf@npm:^2.6.3": version: 2.7.1 resolution: "rimraf@npm:2.7.1" @@ -14042,7 +14008,7 @@ __metadata: languageName: node linkType: hard -"run-async@npm:^2.2.0, run-async@npm:^2.4.0": +"run-async@npm:^2.4.0": version: 2.4.1 resolution: "run-async@npm:2.4.1" checksum: a2c88aa15df176f091a2878eb840e68d0bdee319d8d97bbb89112223259cebecb94bc0defd735662b83c2f7a30bed8cddb7d1674eb48ae7322dc602b22d03797 @@ -14074,15 +14040,6 @@ __metadata: languageName: node linkType: hard -"rxjs@npm:^6.4.0": - version: 6.6.7 - resolution: "rxjs@npm:6.6.7" - dependencies: - tslib: ^1.9.0 - checksum: bc334edef1bb8bbf56590b0b25734ba0deaf8825b703256a93714308ea36dff8a11d25533671adf8e104e5e8f256aa6fdfe39b2e248cdbd7a5f90c260acbbd1b - languageName: node - linkType: hard - "rxjs@npm:^7.5.5": version: 7.8.1 resolution: "rxjs@npm:7.8.1" @@ -14136,19 +14093,6 @@ __metadata: languageName: node linkType: hard -"sass@npm:^1.29.0": - version: 1.63.6 - resolution: "sass@npm:1.63.6" - dependencies: - chokidar: ">=3.0.0 <4.0.0" - immutable: ^4.0.0 - source-map-js: ">=0.6.2 <2.0.0" - bin: - sass: sass.js - checksum: 3372319904658eeafaf78a09a6fcb3368a68e6d76fe3c43c2d009f4f72e475ab22b82ef483ef5c00fcda3ab00066846c0bd88c36b42771b855f6ab80c7eda541 - languageName: node - linkType: hard - "sc-istanbul@npm:^0.4.5": version: 0.4.6 resolution: "sc-istanbul@npm:0.4.6" @@ -14187,16 +14131,6 @@ __metadata: languageName: node linkType: hard -"scss-parser@npm:^1.0.4": - version: 1.0.6 - resolution: "scss-parser@npm:1.0.6" - dependencies: - invariant: 2.2.4 - lodash: 4.17.21 - checksum: f1424d73e9c6aec006df16da7222a590efc3ee9b2abb622caffb5e19ed029baf66cf0d2d7aaad1e3d84e5d7f75cf7a3f761570341f26b318b499b08a7e5cd91c - languageName: node - linkType: hard - "secp256k1@npm:^4.0.1": version: 4.0.3 resolution: "secp256k1@npm:4.0.3" @@ -14223,7 +14157,7 @@ __metadata: languageName: node linkType: hard -"semver@npm:2 || 3 || 4 || 5, semver@npm:^5.5.0, semver@npm:^5.5.1, semver@npm:^5.6.0, semver@npm:^5.7.0": +"semver@npm:2 || 3 || 4 || 5, semver@npm:^5.5.0, semver@npm:^5.6.0, semver@npm:^5.7.0": version: 5.7.1 resolution: "semver@npm:5.7.1" bin: @@ -14254,14 +14188,14 @@ __metadata: languageName: node linkType: hard -"semver@npm:7.x, semver@npm:^7.0.0, semver@npm:^7.1.1, semver@npm:^7.3.2, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.3.8": - version: 7.5.3 - resolution: "semver@npm:7.5.3" +"semver@npm:7.x, semver@npm:^7.0.0, semver@npm:^7.1.1, semver@npm:^7.3.2, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.3.8, semver@npm:^7.5.2": + version: 7.5.4 + resolution: "semver@npm:7.5.4" dependencies: lru-cache: ^6.0.0 bin: semver: bin/semver.js - checksum: 9d58db16525e9f749ad0a696a1f27deabaa51f66e91d2fa2b0db3de3e9644e8677de3b7d7a03f4c15bc81521e0c3916d7369e0572dbde250d9bedf5194e2a8a7 + checksum: 12d8ad952fa353b0995bf180cdac205a4068b759a140e5d3c608317098b3575ac2f1e09182206bf2eb26120e1c0ed8fb92c48c592f6099680de56bb071423ca3 languageName: node linkType: hard @@ -14461,17 +14395,6 @@ __metadata: languageName: node linkType: hard -"slice-ansi@npm:^2.1.0": - version: 2.1.0 - resolution: "slice-ansi@npm:2.1.0" - dependencies: - ansi-styles: ^3.2.0 - astral-regex: ^1.0.0 - is-fullwidth-code-point: ^2.0.0 - checksum: 4e82995aa59cef7eb03ef232d73c2239a15efa0ace87a01f3012ebb942e963fbb05d448ce7391efcd52ab9c32724164aba2086f5143e0445c969221dde3b6b1e - languageName: node - linkType: hard - "slice-ansi@npm:^4.0.0": version: 4.0.0 resolution: "slice-ansi@npm:4.0.0" @@ -14483,6 +14406,16 @@ __metadata: languageName: node linkType: hard +"slice-ansi@npm:^5.0.0": + version: 5.0.0 + resolution: "slice-ansi@npm:5.0.0" + dependencies: + ansi-styles: ^6.0.0 + is-fullwidth-code-point: ^4.0.0 + checksum: 7e600a2a55e333a21ef5214b987c8358fe28bfb03c2867ff2cbf919d62143d1812ac27b4297a077fdaf27a03da3678e49551c93e35f9498a3d90221908a1180e + languageName: node + linkType: hard + "smart-buffer@npm:^4.2.0": version: 4.2.0 resolution: "smart-buffer@npm:4.2.0" @@ -14547,24 +14480,7 @@ __metadata: languageName: node linkType: hard -"solc@npm:^0.8.17": - version: 0.8.20 - resolution: "solc@npm:0.8.20" - dependencies: - command-exists: ^1.2.8 - commander: ^8.1.0 - follow-redirects: ^1.12.1 - js-sha3: 0.8.0 - memorystream: ^0.3.1 - semver: ^5.5.0 - tmp: 0.0.33 - bin: - solcjs: solc.js - checksum: 8ff85f5e4aeda2018a97d1383284ed982ccc93fe528e1e78e3a8897e8da69848c7d44a8b1562e2ca9082b72c7a547827543eda6bcb12210e6a191e9e64baa5c8 - languageName: node - linkType: hard - -"solhint-plugin-numcast@npm:1.0.0": +"solhint-plugin-numcast@npm:^1.0.0": version: 1.0.0 resolution: "solhint-plugin-numcast@npm:1.0.0" peerDependencies: @@ -14573,31 +14489,34 @@ __metadata: languageName: node linkType: hard -"solhint@npm:3.3.7": - version: 3.3.7 - resolution: "solhint@npm:3.3.7" +"solhint@npm:^3.3.7": + version: 3.6.2 + resolution: "solhint@npm:3.6.2" dependencies: - "@solidity-parser/parser": ^0.14.1 - ajv: ^6.6.1 - antlr4: 4.7.1 - ast-parents: 0.0.1 - chalk: ^2.4.2 - commander: 2.18.0 - cosmiconfig: ^5.0.7 - eslint: ^5.6.0 - fast-diff: ^1.1.2 - glob: ^7.1.3 - ignore: ^4.0.6 - js-yaml: ^3.12.0 - lodash: ^4.17.11 - prettier: ^1.14.3 - semver: ^6.3.0 + "@solidity-parser/parser": ^0.16.0 + ajv: ^6.12.6 + antlr4: ^4.11.0 + ast-parents: ^0.0.1 + chalk: ^4.1.2 + commander: ^10.0.0 + cosmiconfig: ^8.0.0 + fast-diff: ^1.2.0 + glob: ^8.0.3 + ignore: ^5.2.4 + js-yaml: ^4.1.0 + lodash: ^4.17.21 + pluralize: ^8.0.0 + prettier: ^2.8.3 + semver: ^7.5.2 + strip-ansi: ^6.0.1 + table: ^6.8.1 + text-table: ^0.2.0 dependenciesMeta: prettier: optional: true bin: solhint: solhint.js - checksum: 140a4660b691ea78aa7de19aca2123991fb4f9bc7be574e1573ae428b356e12919805df56c2892ddbdd031a4a4db477a81425ad85aac6672f3fb73f4887c2abb + checksum: 96c2ab3c1444624facb45b929682c65d83019f392c7331463a45e8ed61f08122e24b6709a721b6086ddfb0d5e3c3d4281f175f74eb308415072917556bdeba22 languageName: node linkType: hard @@ -14793,7 +14712,7 @@ __metadata: languageName: node linkType: hard -"source-map-js@npm:>=0.6.2 <2.0.0, source-map-js@npm:^1.0.2": +"source-map-js@npm:^1.0.2": version: 1.0.2 resolution: "source-map-js@npm:1.0.2" checksum: c049a7fc4deb9a7e9b481ae3d424cc793cb4845daa690bc5a05d428bf41bf231ced49b4cf0c9e77f9d42fdb3d20d6187619fc586605f5eabe995a316da8d377c @@ -15004,6 +14923,13 @@ __metadata: languageName: node linkType: hard +"string-argv@npm:0.3.2": + version: 0.3.2 + resolution: "string-argv@npm:0.3.2" + checksum: 8703ad3f3db0b2641ed2adbb15cf24d3945070d9a751f9e74a924966db9f325ac755169007233e8985a39a6a292f14d4fee20482989b89b96e473c4221508a0f + languageName: node + linkType: hard + "string-format@npm:^2.0.0": version: 2.0.0 resolution: "string-format@npm:2.0.0" @@ -15032,7 +14958,7 @@ __metadata: languageName: node linkType: hard -"string-width@npm:^1.0.2 || 2, string-width@npm:^2.1.0, string-width@npm:^2.1.1": +"string-width@npm:^1.0.2 || 2, string-width@npm:^2.1.1": version: 2.1.1 resolution: "string-width@npm:2.1.1" dependencies: @@ -15053,7 +14979,7 @@ __metadata: languageName: node linkType: hard -"string-width@npm:^5.0.1, string-width@npm:^5.1.2": +"string-width@npm:^5.0.0, string-width@npm:^5.0.1, string-width@npm:^5.1.2": version: 5.1.2 resolution: "string-width@npm:5.1.2" dependencies: @@ -15179,6 +15105,13 @@ __metadata: languageName: node linkType: hard +"strip-final-newline@npm:^3.0.0": + version: 3.0.0 + resolution: "strip-final-newline@npm:3.0.0" + checksum: 23ee263adfa2070cd0f23d1ac14e2ed2f000c9b44229aec9c799f1367ec001478469560abefd00c5c99ee6f0b31c137d53ec6029c53e9f32a93804e18c201050 + languageName: node + linkType: hard + "strip-hex-prefix@npm:1.0.0": version: 1.0.0 resolution: "strip-hex-prefix@npm:1.0.0" @@ -15197,14 +15130,14 @@ __metadata: languageName: node linkType: hard -"strip-json-comments@npm:2.0.1, strip-json-comments@npm:^2.0.1": +"strip-json-comments@npm:2.0.1": version: 2.0.1 resolution: "strip-json-comments@npm:2.0.1" checksum: 1074ccb63270d32ca28edfb0a281c96b94dc679077828135141f27d52a5a398ef5e78bcf22809d23cadc2b81dfbe345eb5fd8699b385c8b1128907dec4a7d1e1 languageName: node linkType: hard -"strip-json-comments@npm:3.1.1, strip-json-comments@npm:^3.1.0, strip-json-comments@npm:^3.1.1": +"strip-json-comments@npm:3.1.1, strip-json-comments@npm:^3.1.1": version: 3.1.1 resolution: "strip-json-comments@npm:3.1.1" checksum: 492f73e27268f9b1c122733f28ecb0e7e8d8a531a6662efbd08e22cccb3f9475e90a1b82cab06a392f6afae6d2de636f977e231296400d0ec5304ba70f166443 @@ -15311,28 +15244,28 @@ __metadata: resolution: "synthetix-v3@workspace:." dependencies: "@ethersproject/abi": ^5.7.0 - "@ethersproject/providers": ^5.0.0 + "@ethersproject/providers": ^5.7.2 "@lerna-lite/cli": 1.17.0 "@lerna-lite/exec": 1.17.0 "@nomiclabs/hardhat-ethers": ^2.2.3 "@synthetixio/deps": "workspace:*" - "@types/mocha": 10.0.1 - "@types/node": 18.11.10 - "@typescript-eslint/eslint-plugin": 5.45.0 - "@typescript-eslint/parser": 5.45.0 - "@usecannon/cli": ^2.5.1 - eslint: 8.29.0 - eslint-config-prettier: 8.5.0 - eslint-plugin-no-only-tests: 3.1.0 - mocha: 10.2.0 - mocha-junit-reporter: 2.2.1 - pre-commit: 1.2.2 - prettier: ^2.8.8 - prettier-plugin-solidity: 1.0.0 - pretty-quick: 3.1.3 - solhint: 3.3.7 - solhint-plugin-numcast: 1.0.0 - typescript: 4.9.3 + "@types/mocha": ^10.0.1 + "@types/node": ^18.16.0 + "@typescript-eslint/eslint-plugin": ^5.45.0 + "@typescript-eslint/parser": ^5.45.0 + "@usecannon/cli": ^2.7.1 + eslint: ^8.29.0 + eslint-plugin-no-only-tests: ^3.1.0 + lint-staged: ^14.0.1 + mocha: ^10.2.0 + mocha-junit-reporter: ^2.2.1 + pre-commit: ^1.2.2 + prettier: ^3.0.3 + prettier-plugin-solidity: ^1.1.3 + prettier-plugin-toml: ^1.0.0 + solhint: ^3.3.7 + solhint-plugin-numcast: ^1.0.0 + typescript: ^4.9.3 languageName: unknown linkType: soft @@ -15348,19 +15281,7 @@ __metadata: languageName: node linkType: hard -"table@npm:^5.2.3": - version: 5.4.6 - resolution: "table@npm:5.4.6" - dependencies: - ajv: ^6.10.2 - lodash: ^4.17.14 - slice-ansi: ^2.1.0 - string-width: ^3.0.0 - checksum: 9e35d3efa788edc17237eef8852f8e4b9178efd65a7d115141777b2ee77df4b7796c05f4ed3712d858f98894ac5935a481ceeb6dcb9895e2f67a61cce0e63b6c - languageName: node - linkType: hard - -"table@npm:^6.8.0": +"table@npm:^6.8.0, table@npm:^6.8.1": version: 6.8.1 resolution: "table@npm:6.8.1" dependencies: @@ -15714,7 +15635,7 @@ __metadata: languageName: node linkType: hard -"tslib@npm:^1.8.1, tslib@npm:^1.9.0, tslib@npm:^1.9.3": +"tslib@npm:^1.8.1, tslib@npm:^1.9.3": version: 1.14.1 resolution: "tslib@npm:1.14.1" checksum: dbe628ef87f66691d5d2959b3e41b9ca0045c3ee3c7c7b906cc1e328b39f199bb1ad9e671c39025bd56122ac57dfbf7385a94843b1cc07c60a4db74795829acd @@ -15861,6 +15782,13 @@ __metadata: languageName: node linkType: hard +"type-fest@npm:^1.0.2": + version: 1.4.0 + resolution: "type-fest@npm:1.4.0" + checksum: b011c3388665b097ae6a109a437a04d6f61d81b7357f74cbcb02246f2f5bd72b888ae33631b99871388122ba0a87f4ff1c94078e7119ff22c70e52c0ff828201 + languageName: node + linkType: hard + "typechain@npm:8.1.1": version: 8.1.1 resolution: "typechain@npm:8.1.1" @@ -15921,23 +15849,23 @@ __metadata: languageName: node linkType: hard -"typescript@npm:4.9.3": - version: 4.9.3 - resolution: "typescript@npm:4.9.3" +"typescript@npm:^4.9.3": + version: 4.9.5 + resolution: "typescript@npm:4.9.5" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 17b8f816050b412403e38d48eef0e893deb6be522d6dc7caf105e54a72e34daf6835c447735fd2b28b66784e72bfbf87f627abb4818a8e43d1fa8106396128dc + checksum: ee000bc26848147ad423b581bd250075662a354d84f0e06eb76d3b892328d8d4440b7487b5a83e851b12b255f55d71835b008a66cbf8f255a11e4400159237db languageName: node linkType: hard -"typescript@patch:typescript@4.9.3#~builtin": - version: 4.9.3 - resolution: "typescript@patch:typescript@npm%3A4.9.3#~builtin::version=4.9.3&hash=a66ed4" +"typescript@patch:typescript@^4.9.3#~builtin": + version: 4.9.5 + resolution: "typescript@patch:typescript@npm%3A4.9.5#~builtin::version=4.9.5&hash=289587" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: d7bdcf5e18193f709339540d69577f7b0389000265db2bf10edfaa67336a29d6bcbee11828084150f7fdd110d605794cfa6df33bebc0a2e33daad2dbe2a7a59f + checksum: 1f8f3b6aaea19f0f67cba79057674ba580438a7db55057eb89cc06950483c5d632115c14077f6663ea76fd09fce3c190e6414bb98582ec80aa5a4eaf345d5b68 languageName: node linkType: hard @@ -16383,7 +16311,7 @@ __metadata: languageName: node linkType: hard -"which@npm:1.3.1, which@npm:^1.1.1, which@npm:^1.2.9, which@npm:^1.3.1": +"which@npm:1.3.1, which@npm:^1.1.1, which@npm:^1.2.14, which@npm:^1.2.9, which@npm:^1.3.1": version: 1.3.1 resolution: "which@npm:1.3.1" dependencies: @@ -16443,7 +16371,7 @@ __metadata: languageName: node linkType: hard -"word-wrap@npm:^1.2.3, word-wrap@npm:~1.2.3": +"word-wrap@npm:~1.2.3": version: 1.2.3 resolution: "word-wrap@npm:1.2.3" checksum: 30b48f91fcf12106ed3186ae4fa86a6a1842416df425be7b60485de14bec665a54a68e4b5156647dec3a70f25e84d270ca8bc8cd23182ed095f5c7206a938c1f @@ -16507,7 +16435,7 @@ __metadata: languageName: node linkType: hard -"wrap-ansi@npm:^8.1.0": +"wrap-ansi@npm:^8.0.1, wrap-ansi@npm:^8.1.0": version: 8.1.0 resolution: "wrap-ansi@npm:8.1.0" dependencies: @@ -16607,15 +16535,6 @@ __metadata: languageName: node linkType: hard -"write@npm:1.0.3": - version: 1.0.3 - resolution: "write@npm:1.0.3" - dependencies: - mkdirp: ^0.5.1 - checksum: 6496197ceb2d6faeeb8b5fe2659ca804e801e4989dff9fb8a66fe76179ce4ccc378c982ef906733caea1220c8dbe05a666d82127959ac4456e70111af8b8df73 - languageName: node - linkType: hard - "ws@npm:7.4.6": version: 7.4.6 resolution: "ws@npm:7.4.6" @@ -16748,6 +16667,13 @@ __metadata: languageName: node linkType: hard +"yaml@npm:2.3.1": + version: 2.3.1 + resolution: "yaml@npm:2.3.1" + checksum: 2c7bc9a7cd4c9f40d3b0b0a98e370781b68b8b7c4515720869aced2b00d92f5da1762b4ffa947f9e795d6cd6b19f410bd4d15fdd38aca7bd96df59bd9486fb54 + languageName: node + linkType: hard + "yargs-parser@npm:13.1.2, yargs-parser@npm:^13.1.2": version: 13.1.2 resolution: "yargs-parser@npm:13.1.2"