From a2a5503a91cdc457a5126bae3cf896255ce5b6b6 Mon Sep 17 00:00:00 2001 From: Ryan Date: Wed, 29 Oct 2025 23:49:28 -0700 Subject: [PATCH 1/6] Updated project configurations --- .env.example | 42 ++++++-------------------------------- .github/workflows/test.yml | 5 +++++ .gitignore | 4 ++++ .prettierignore | 7 +++---- .prettierrc.json | 7 +++++++ foundry.toml | 25 ++++++++++++++++------- 6 files changed, 43 insertions(+), 47 deletions(-) diff --git a/.env.example b/.env.example index a66199c..346ee7b 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,9 @@ # Wallet Configuration +# Using Private Key PRIVATE_KEY="YOUR_PRIVATE_KEY" +# Using Mnemonic MNEMONIC="YOUR_MNEMONIC" EOA_INDEX=0 # Optional (Default to 0) @@ -10,14 +12,13 @@ EOA_INDEX=0 # Optional (Default to 0) CHAINS="ethereum,optimism,base,arbitrum" # Chains to deploy -# Etherscan +# Etherscan Configuration ETHERSCAN_API_KEY="YOUR_ETHERSCAN_API_KEY" -# RPC Provider - -# Using Alchemy RPC URL +# RPC Provider Configuration +# Using Alchemy RPC_API_KEY="YOUR_ALCHEMY_API_KEY" RPC_ETHEREUM="https://eth-mainnet.g.alchemy.com/v2/${RPC_API_KEY}" @@ -26,12 +27,6 @@ RPC_SEPOLIA="https://eth-sepolia.g.alchemy.com/v2/${RPC_API_KEY}" RPC_OPTIMISM="https://opt-mainnet.g.alchemy.com/v2/${RPC_API_KEY}" RPC_OPTIMISM_SEPOLIA="https://opt-sepolia.g.alchemy.com/v2/${RPC_API_KEY}" -RPC_BNB="https://bnb-mainnet.g.alchemy.com/v2//${RPC_API_KEY}" -RPC_BNB_TESTNET="https://bnb-testnet.g.alchemy.com/v2/${RPC_API_KEY}" - -RPC_UNICHAIN="https://unichain-mainnet.g.alchemy.com/v2/${RPC_API_KEY}" -RPC_UNICHAIN_SEPOLIA="https://unichain-sepolia.g.alchemy.com/v2/${RPC_API_KEY}" - RPC_POLYGON="https://polygon-mainnet.g.alchemy.com/v2/${RPC_API_KEY}" RPC_POLYGON_AMOY="https://polygon-amoy.g.alchemy.com/v2/${RPC_API_KEY}" @@ -41,17 +36,7 @@ RPC_BASE_SEPOLIA="https://base-sepolia.g.alchemy.com/v2/${RPC_API_KEY}" RPC_ARBITRUM="https://arb-mainnet.g.alchemy.com/v2/${RPC_API_KEY}" RPC_ARBITRUM_SEPOLIA="https://arb-sepolia.g.alchemy.com/v2/${RPC_API_KEY}" -RPC_AVALANCHE="https://avax-mainnet.g.alchemy.com/v2/${RPC_API_KEY}" -RPC_AVALANCHE_FUJI="https://avax-fuji.g.alchemy.com/v2/${RPC_API_KEY}" - -RPC_LINEA="https://linea-mainnet.g.alchemy.com/v2/${RPC_API_KEY}" -RPC_LINEA_SEPOLIA="https://linea-sepolia.g.alchemy.com/v2/${RPC_API_KEY}" - -RPC_SCROLL="https://scroll-mainnet.g.alchemy.com/v2/${RPC_API_KEY}" -RPC_SCROLL_SEPOLIA="https://scroll-sepolia.g.alchemy.com/v2/${RPC_API_KEY}" - -# Using Infura RPC URL - +# Using Infura RPC_API_KEY="YOUR_INFURA_API_KEY" RPC_ETHEREUM="https://mainnet.infura.io/v3/${RPC_API_KEY}" @@ -60,12 +45,6 @@ RPC_SEPOLIA="https://sepolia.infura.io/v3/${RPC_API_KEY}" RPC_OPTIMISM="https://optimism-mainnet.infura.io/v3/${RPC_API_KEY}" RPC_OPTIMISM_SEPOLIA="https://optimism-sepolia.infura.io/v3/${RPC_API_KEY}" -RPC_BNB="https://bsc-mainnet.infura.io/v3/${RPC_API_KEY}" -RPC_BNB_TESTNET="https://bsc-testnet.infura.io/v3/${RPC_API_KEY}" - -RPC_UNICHAIN="https://unichain-mainnet.infura.io/v3/${RPC_API_KEY}" -RPC_UNICHAIN_SEPOLIA="https://unichain-sepolia.infura.io/v3/${RPC_API_KEY}" - RPC_POLYGON="https://polygon-mainnet.infura.io/v3/${RPC_API_KEY}" RPC_POLYGON_AMOY="https://polygon-amoy.infura.io/v3/${RPC_API_KEY}" @@ -74,12 +53,3 @@ RPC_BASE_SEPOLIA="https://base-sepolia.infura.io/v3/${RPC_API_KEY}" RPC_ARBITRUM="https://arbitrum-mainnet.infura.io/v3/${RPC_API_KEY}" RPC_ARBITRUM_SEPOLIA="https://arbitrum-sepolia.infura.io/v3/${RPC_API_KEY}" - -RPC_AVALANCHE="https://avalanche-mainnet.infura.io/v3/${RPC_API_KEY}" -RPC_AVALANCHE_FUJI="https://avalanche-fuji.infura.io/v3/${RPC_API_KEY}" - -RPC_LINEA="https://linea-mainnet.infura.io/v3/${RPC_API_KEY}" -RPC_LINEA_SEPOLIA="https://linea-sepolia.infura.io/v3/${RPC_API_KEY}" - -RPC_SCROLL="https://scroll-mainnet.infura.io/v3/${RPC_API_KEY}" -RPC_SCROLL_SEPOLIA="https://scroll-sepolia.infura.io/v3/${RPC_API_KEY}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 76f1680..ace0b64 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,6 +33,11 @@ jobs: run: | forge --version + - name: Run Forge fmt + run: | + forge fmt --check + id: fmt + - name: Run Forge build run: | forge build --sizes diff --git a/.gitignore b/.gitignore index 79547ba..e3c12bb 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,8 @@ docs/ # Dotenv file .env +# OS files +.DS_Store + +# NPM node_modules \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index 46a933e..5fd1fb1 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,5 +1,4 @@ -foundry.toml -out/ -lib/ +.github/ cache/ -.github/ \ No newline at end of file +lib/ +out/ \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json index 34da83f..4ce4ce3 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -3,12 +3,19 @@ "tabWidth": 4, "useTabs": true, "singleQuote": false, + "trailingComma": "all", "overrides": [ { "files": "*.sol", "options": { "bracketSpacing": false } + }, + { + "files": ["*.ts", "*.js", "*.json"], + "options": { + "bracketSpacing": true + } } ] } diff --git a/foundry.toml b/foundry.toml index 5217dd1..101a768 100644 --- a/foundry.toml +++ b/foundry.toml @@ -9,16 +9,17 @@ bytecode_hash = "none" cbor_metadata = false dynamic_test_linking = true ffi = true +ignored_error_codes = [2394] optimizer = true optimizer_runs = 1000000 +verbosity = 2 via_ir = true fs_permissions = [ - { access = "read-write", path = "./config"}, - { access = "read-write", path = "./deployments"}, - { access = "read", path = "./out"}, - { access = "read", path = "./script" }, - { access = "read", path = "./test"} + { access = "read-write", path = "config" }, + { access = "read-write", path = "deployments" }, + { access = "read", path = "out" }, + { access = "read", path = "script" } ] gas_reports = ["ChainlinkRouter"] @@ -26,12 +27,22 @@ gas_reports = ["ChainlinkRouter"] remappings = [ "forge-std/=lib/forge-std/src/", "@openzeppelin/=lib/openzeppelin-contracts/contracts", - "@proxy-forge/=lib/proxy-forge/src/" + "proxy-forge/=lib/proxy-forge/src/" ] [fuzz] runs = 1000 -max_test_rejects = 1000000 + +[fmt] +line_length = 120 +tab_width = 4 +quote_style = "double" +func_attrs_with_params_multiline = true +inline_attribute_style = "compact" +return_statement = "inline" + +[lint] +lint_on_build = false [rpc_endpoints] ethereum = "${RPC_ETHEREUM}" From 3163b1b6b76a7dde47b06bb78ff3fe1fdf40d56f Mon Sep 17 00:00:00 2001 From: Ryan Date: Wed, 29 Oct 2025 23:49:36 -0700 Subject: [PATCH 2/6] Updated project configurations --- config/feeds/42161.json | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/config/feeds/42161.json b/config/feeds/42161.json index 1ca9c15..2b8ae56 100644 --- a/config/feeds/42161.json +++ b/config/feeds/42161.json @@ -391,20 +391,6 @@ "base": "0xf6718b2701D4a6498eF77D7c152b2137Ab28b8A3", "quote": "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f" }, - { - "aggregator": "0xded2c52b75B24732e9107377B7Ba93eC1fFa4BAf", - "description": "STETH / ETH", - "decimals": 18, - "base": "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84", - "quote": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1" - }, - { - "aggregator": "0x07C5b924399cc23c24a95c8743DE4006a32b7f2a", - "description": "STETH / USD", - "decimals": 8, - "base": "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84", - "quote": "0x0000000000000000000000000000000000000348" - }, { "aggregator": "0xe74d69E233faB0d8F48921f2D93aDfDe44cEb3B7", "description": "STG / USD", @@ -531,13 +517,6 @@ "base": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", "quote": "0x0000000000000000000000000000000000000348" }, - { - "aggregator": "0x20bAe7e1De9c596f5F7615aeaa1342Ba99294e12", - "description": "weETH / eETH Exchange Rate", - "decimals": 18, - "base": "0x35751007a407ca6FEFfE80b3cB397736D2cf4dbe", - "quote": "0x35fA164735182de50811E8e2E824cFb9B6118ac2" - }, { "aggregator": "0xE141425bc1594b8039De6390db1cDaf4397EA22b", "description": "weETH / ETH", @@ -559,13 +538,6 @@ "base": "0x5979D7b546E38E414F7E9822514be443A4800529", "quote": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1" }, - { - "aggregator": "0xB1552C5e96B312d0Bf8b554186F846C40614a540", - "description": "wstETH-stETH Exchange Rate", - "decimals": 18, - "base": "0x5979D7b546E38E414F7E9822514be443A4800529", - "quote": "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84" - }, { "aggregator": "0x806c532D543352e7C344ba6C7F3F00Bfbd309Af1", "description": "XAI / USD", From 3d6bfaeb8b281580bc02fe0b9eadf717c170371a Mon Sep 17 00:00:00 2001 From: Ryan Date: Wed, 29 Oct 2025 23:52:37 -0700 Subject: [PATCH 3/6] Formatted ts files --- script/ts/src/encode-feeds.ts | 4 +- script/ts/src/extract.ts | 40 ++++++------ script/ts/src/fetch-feeds.ts | 2 +- script/ts/src/types/index.ts | 118 +--------------------------------- script/ts/src/utils/index.ts | 12 ++-- 5 files changed, 30 insertions(+), 146 deletions(-) diff --git a/script/ts/src/encode-feeds.ts b/script/ts/src/encode-feeds.ts index aa45c6b..5e373e7 100644 --- a/script/ts/src/encode-feeds.ts +++ b/script/ts/src/encode-feeds.ts @@ -20,9 +20,9 @@ const main = async () => { (acc, { aggregator, base, quote }) => solidityPacked( ["bytes", "bytes"], - [acc, solidityPacked(["address", "address", "address"], [aggregator, base, quote])] + [acc, solidityPacked(["address", "address", "address"], [aggregator, base, quote])], ), - "0x" + "0x", ); process.stdout.write(data); diff --git a/script/ts/src/extract.ts b/script/ts/src/extract.ts index 0ccfc7e..2f68831 100644 --- a/script/ts/src/extract.ts +++ b/script/ts/src/extract.ts @@ -136,7 +136,7 @@ const main = async (): Promise => { const processDeployment = async ( { chain: chainId, commit, timestamp, transactions }: Deployment, rpcUrl: string, - forceFlag: boolean + forceFlag: boolean, ): Promise => { const path = join(DEPLOYMENTS, "json", `${chainId}.json`); @@ -171,7 +171,7 @@ const processDeployment = async ( ( acc: Array & { contractName: string; input: ContractInput }>, { arguments: constructorArguments, contractAddress, contractName, hash }, - idx + idx, ) => { if (contractName === "ForgeProxy" || contractName === "TransparentUpgradeableProxy") { console.warn(`\nSkipping unexpected proxy: ${contractName} (${contractAddress})\n`); @@ -226,7 +226,7 @@ const processDeployment = async ( (tx) => (tx.contractName === "ForgeProxy" || tx.contractName === "TransparentUpgradeableProxy") && - getChecksumAddress(tx.arguments[0]) === contractAddress + getChecksumAddress(tx.arguments[0]) === contractAddress, ); // CASE: new upgradeable contract @@ -279,12 +279,12 @@ const processDeployment = async ( input: { constructor: parseConstructorInputs(contractName, constructorArguments) }, }); }, - [] + [], ) .sort((a, b) => (a.contractName.toLowerCase() < b.contractName.toLowerCase() ? -1 : 1)) .reduce( (acc, { contractName, ...rest }) => ({ ...acc, [contractName]: rest }), - {} as DeploymentHistory["contracts"] + {} as DeploymentHistory["contracts"], ); if (!Object.keys(contracts).length) { @@ -363,7 +363,7 @@ const renderTableOfContents = (contracts: DeploymentRecord["latest"], history: D content += history .map( ({ timestamp }) => - `[${format(timestamp, "timestamp-long")}](#${format(format(timestamp, "timestamp-long"), "link")})` + `[${format(timestamp, "timestamp-long")}](#${format(format(timestamp, "timestamp-long"), "link")})`, ) .join("\n\t-\t"); @@ -386,7 +386,7 @@ const renderDeploymentSummary = (contracts: DeploymentRecord["latest"], explorer { tag: "td", content: renderElement({ tag: "code", content: format(version, "version") }) }, ], ]), - [headers] + [headers], ); return renderTable({ rows }); @@ -398,15 +398,15 @@ const renderDeploymentDetails = (contracts: DeploymentRecord["latest"], explorer ([contractName, contract]) => `### ${format(contractName, "display")!}\n${renderDeploymentDetail( contract, - explorerUrl - )}${renderImplementationHistory(contract, explorerUrl)}` + explorerUrl, + )}${renderImplementationHistory(contract, explorerUrl)}`, ) .join("\n\n---\n\n"); }; const renderDeploymentDetail = ( { address, commit, hash, implementation, proxyAdmin, timestamp, version }: ContractInfo, - explorerUrl: string + explorerUrl: string, ) => { const rows: Array> = []; @@ -416,7 +416,7 @@ const renderDeploymentDetail = ( tag: "td", content: renderAnchor( PROJECT_URL.concat(`/commit/${commit}`), - renderElement({ tag: "code", content: commit }) + renderElement({ tag: "code", content: commit }), ), }, ]); @@ -492,7 +492,7 @@ const renderImplementationHistory = ({ commit, hash, implementation, version }: tag: "td", content: renderAnchor( `${PROJECT_URL}/commit/${commit}`, - renderElement({ tag: "code", content: commit }) + renderElement({ tag: "code", content: commit }), ), }, { @@ -515,15 +515,15 @@ const renderDeploymentHistory = (history: DeploymentRecord["history"], explorerU ([contractName, contract]) => `\n
\n${renderAnchor( getContractPath(contractName), - contractName + contractName, )}${renderDeploymentDetail( { commit, timestamp, ...contract }, - explorerUrl - )}\n
` + explorerUrl, + )}\n`, ) - .join("\n")}` + .join("\n")}`, ), - "" + "", ); }; @@ -541,7 +541,7 @@ const renderElement = ({ !!attributes ? Object.entries(attributes).reduce((acc, [key, value]) => acc.concat(formatAttribute(key, value)), " ") : "", - !!content ? `>${content}` : " />" + !!content ? `>${content}` : " />", ) .trim()}`; }; @@ -580,7 +580,7 @@ const renderTable = ({ content += rows.reduce( (acc, row) => acc.concat(`\n\t\n\t\t${row.map(renderElement).join("\n\t\t")}\n\t`), - "" + "", ); return `\n${content}\n
`; @@ -631,7 +631,7 @@ const processProperties = >(properties: T): Strict value !== null && value !== undefined ? { ...acc, [key]: !!isAddress(value) ? getChecksumAddress(value)! : value } : acc, - {} as Strict + {} as Strict, ); }; diff --git a/script/ts/src/fetch-feeds.ts b/script/ts/src/fetch-feeds.ts index 7044419..d87ccc3 100644 --- a/script/ts/src/fetch-feeds.ts +++ b/script/ts/src/fetch-feeds.ts @@ -8,7 +8,7 @@ const main = async () => { const argument = process.argv[2]; const chain = CHAINS.find(({ chainAlias, chainId }) => - !!isNaN(+argument) ? chainAlias === argument : chainId === +argument + !!isNaN(+argument) ? chainAlias === argument : chainId === +argument, ); if (!chain) { diff --git a/script/ts/src/types/index.ts b/script/ts/src/types/index.ts index 984ce0c..ce1060b 100644 --- a/script/ts/src/types/index.ts +++ b/script/ts/src/types/index.ts @@ -1,18 +1,6 @@ import { ChainId } from "../constants"; -export type Mapping = { [key: string | number]: T }; - -export type Mutable = { -readonly [K in keyof T]: T[K] }; - -// export type NonNullable = T extends null | undefined ? never : T; - -// export type Strict = { [K in keyof T]-?: T[K] }; - -export type OptionalKeys = { [K in keyof T]-?: {} extends Pick ? K : never }[keyof T]; - -export type RequiredKeys = { [K in keyof T]-?: {} extends Pick ? never : K }[keyof T]; - -export type StrictRequired = Pick>; +type RequiredKeys = { [K in keyof T]-?: {} extends Pick ? never : K }[keyof T]; export type Strict = { [K in RequiredKeys]: NonNullable }; @@ -217,107 +205,3 @@ export interface BroadcastReceipt { to: string; contractAddress: string | null; } - -export type HTMLElementType = - | "a" - | "abbr" - | "address" - | "area" - | "article" - | "aside" - | "audio" - | "b" - | "bdi" - | "bdo" - | "blockquote" - | "body" - | "br" - | "button" - | "canvas" - | "caption" - | "cite" - | "code" - | "col" - | "colgroup" - | "data" - | "datalist" - | "dd" - | "del" - | "details" - | "dfn" - | "dialog" - | "div" - | "dl" - | "dt" - | "em" - | "embed" - | "fieldset" - | "figcaption" - | "figure" - | "footer" - | "form" - | "h1" - | "h2" - | "h3" - | "h4" - | "h5" - | "h6" - | "header" - | "hgroup" - | "hr" - | "i" - | "iframe" - | "img" - | "input" - | "ins" - | "kbd" - | "label" - | "legend" - | "li" - | "main" - | "map" - | "mark" - | "menu" - | "meter" - | "nav" - | "object" - | "ol" - | "optgroup" - | "option" - | "output" - | "p" - | "pre" - | "progress" - | "q" - | "rp" - | "rt" - | "ruby" - | "s" - | "samp" - | "search" - | "section" - | "select" - | "slot" - | "small" - | "source" - | "span" - | "strong" - | "sub" - | "summary" - | "sup" - | "table" - | "thead" - | "tbody" - | "tfoot" - | "tr" - | "th" - | "td" - | "template" - | "textarea" - | "time" - | "track" - | "u" - | "ul" - | "var" - | "video" - | "wbr"; diff --git a/script/ts/src/utils/index.ts b/script/ts/src/utils/index.ts index dcb3a59..bfce5e5 100644 --- a/script/ts/src/utils/index.ts +++ b/script/ts/src/utils/index.ts @@ -7,7 +7,7 @@ import { Chain, ContractArtifact } from "../types"; export const format = ( value: any, - option: "argument" | "contract" | "display" | "link" | "timestamp-long" | "timestamp-short" | "version" + option: "argument" | "contract" | "display" | "link" | "timestamp-long" | "timestamp-short" | "version", ): string | undefined => { if (typeof value === "number" || typeof value === "bigint") value = value.toString(); if (!value || typeof value !== "string") return; @@ -71,7 +71,7 @@ export const getContractABI = (contractName: string): ContractArtifact["abi"] => export const getContractPath = ( contractName: string, - option: { baseDir: string; maxDepth: number } = { baseDir: "src", maxDepth: 5 } + option: { baseDir: string; maxDepth: number } = { baseDir: "src", maxDepth: 5 }, ): string => { if (contractName === "ForgeProxy" || contractName === "ForgeProxyAdmin") { return execSync("git remote get-url origin | cut -d '/' -f 1-4", { encoding: "utf-8" }) @@ -95,7 +95,7 @@ export const getContractPath = ( if (!!path) return path; } } - } catch (error) { + } catch (e) { // Directory not accessible, skip } }; @@ -118,7 +118,7 @@ export const getProxyAdmin = (proxy: string, rpcUrl: string): string | undefined `cast storage ${proxy} ${ERC1967_ADMIN_SLOT} --rpc-url ${rpcUrl} | cast parse-bytes32-address`, { encoding: "utf-8", - } + }, ) .trim() .replaceAll('"', ""); @@ -129,7 +129,7 @@ export const getProxyImplementation = (proxy: string, rpcUrl: string): string | try { return execSync( `cast storage ${proxy} ${ERC1967_IMPLEMENTATION_SLOT} --rpc-url ${rpcUrl} | cast parse-bytes32-address`, - { encoding: "utf-8" } + { encoding: "utf-8" }, ) .trim() .replaceAll('"', ""); @@ -147,7 +147,7 @@ export const getRevision = (address: string, rpcUrl: string): string | undefined export const getProjectName = (): string => { return format( execSync("git remote get-url origin | cut -d '/' -f 5 | cut -d '.' -f 1", { encoding: "utf-8" }).trim(), - "display" + "display", )!; }; From f658b18d5a3e4cdc74d3760b27290c59a28ecc10 Mon Sep 17 00:00:00 2001 From: Ryan Date: Thu, 30 Oct 2025 00:06:00 -0700 Subject: [PATCH 4/6] Ran forge fmt to format contracts with new configuration --- script/BaseScript.sol | 106 +- script/Deploy.s.sol | 92 +- script/Register.s.sol | 37 +- src/ChainlinkRouter.sol | 917 +- src/base/Initializable.sol | 234 +- src/base/Ownable.sol | 136 +- src/interfaces/IChainlinkRouter.sol | 232 +- .../external/AggregatorInterface.sol | 39 +- src/libraries/BytesParser.sol | 148 +- src/libraries/Denominations.sol | 82 +- src/libraries/FullMath.sol | 152 +- src/libraries/PriceMath.sol | 162 +- src/types/BitMap.sol | 276 +- src/types/FeedConfig.sol | 199 +- test/ChainlinkRouter.t.sol | 873 +- test/libraries/FullMath.t.sol | 24 +- test/libraries/PriceMath.t.sol | 274 +- test/shared/env/BaseTest.sol | 56 +- test/shared/env/Constants.sol | 102 +- test/shared/env/Fixtures.sol | 31 +- test/shared/env/JavascriptFfi.sol | 24 +- test/shared/helpers/Chains.sol | 219 +- test/shared/helpers/ProxyHelpers.sol | 142 +- test/shared/helpers/SolArray.sol | 12178 ++++++++-------- test/types/BitMap.t.sol | 216 +- test/types/FeedConfig.t.sol | 25 +- 26 files changed, 8102 insertions(+), 8874 deletions(-) diff --git a/script/BaseScript.sol b/script/BaseScript.sol index af027d8..675c739 100644 --- a/script/BaseScript.sol +++ b/script/BaseScript.sol @@ -4,68 +4,68 @@ pragma solidity ^0.8.30; import {Script} from "forge-std/Script.sol"; abstract contract BaseScript is Script { - error UnsupportedChainId(uint256 chainId); + error UnsupportedChainId(uint256 chainId); - string private constant TEST_MNEMONIC = "test test test test test test test test test test test junk"; + string private constant DEFAULT_MNEMONIC = "test test test test test test test test test test test junk"; - uint256 internal constant ETHEREUM_CHAIN_ID = 1; - uint256 internal constant SEPOLIA_CHAIN_ID = 11155111; + uint256 internal constant ETHEREUM_CHAIN_ID = 1; + uint256 internal constant SEPOLIA_CHAIN_ID = 11155111; - uint256 internal constant OPTIMISM_CHAIN_ID = 10; - uint256 internal constant OPTIMISM_SEPOLIA_CHAIN_ID = 11155420; + uint256 internal constant OPTIMISM_CHAIN_ID = 10; + uint256 internal constant OPTIMISM_SEPOLIA_CHAIN_ID = 11155420; - uint256 internal constant POLYGON_CHAIN_ID = 137; - uint256 internal constant POLYGON_AMOY_CHAIN_ID = 80002; + uint256 internal constant POLYGON_CHAIN_ID = 137; + uint256 internal constant POLYGON_AMOY_CHAIN_ID = 80002; - uint256 internal constant BASE_CHAIN_ID = 8453; - uint256 internal constant BASE_SEPOLIA_CHAIN_ID = 84532; + uint256 internal constant BASE_CHAIN_ID = 8453; + uint256 internal constant BASE_SEPOLIA_CHAIN_ID = 84532; - uint256 internal constant ARBITRUM_CHAIN_ID = 42161; - uint256 internal constant ARBITRUM_SEPOLIA_CHAIN_ID = 421614; + uint256 internal constant ARBITRUM_CHAIN_ID = 42161; + uint256 internal constant ARBITRUM_SEPOLIA_CHAIN_ID = 421614; - address broadcaster; + address broadcaster; - modifier broadcast() { - vm.startBroadcast(broadcaster); - _; - vm.stopBroadcast(); - } + modifier broadcast() { + vm.startBroadcast(broadcaster); + _; + vm.stopBroadcast(); + } - function setUp() public virtual { - uint256 privateKey = vm.envOr({ - name: "PRIVATE_KEY", - defaultValue: vm.deriveKey({ - mnemonic: vm.envOr({name: "MNEMONIC", defaultValue: TEST_MNEMONIC}), - index: uint8(vm.envOr({name: "EOA_INDEX", defaultValue: uint256(0)})) - }) - }); + function setUp() public virtual { + uint256 privateKey = vm.envOr({ + name: "PRIVATE_KEY", + defaultValue: vm.deriveKey({ + mnemonic: vm.envOr({name: "MNEMONIC", defaultValue: DEFAULT_MNEMONIC}), + index: uint8(vm.envOr({name: "EOA_INDEX", defaultValue: uint256(0)})) + }) + }); - broadcaster = vm.rememberKey(privateKey); - } + broadcaster = vm.rememberKey(privateKey); + } - function forkChain(uint256 chainId) internal virtual { - if (chainId == ETHEREUM_CHAIN_ID) { - vm.createSelectFork("ethereum"); - } else if (chainId == SEPOLIA_CHAIN_ID) { - vm.createSelectFork("sepolia"); - } else if (chainId == OPTIMISM_CHAIN_ID) { - vm.createSelectFork("optimism"); - } else if (chainId == OPTIMISM_SEPOLIA_CHAIN_ID) { - vm.createSelectFork("optimism-sepolia"); - } else if (chainId == POLYGON_CHAIN_ID) { - vm.createSelectFork("polygon"); - } else if (chainId == POLYGON_AMOY_CHAIN_ID) { - vm.createSelectFork("polygon-amoy"); - } else if (chainId == BASE_CHAIN_ID) { - vm.createSelectFork("base"); - } else if (chainId == BASE_SEPOLIA_CHAIN_ID) { - vm.createSelectFork("base-sepolia"); - } else if (chainId == ARBITRUM_CHAIN_ID) { - vm.createSelectFork("arbitrum"); - } else if (chainId == ARBITRUM_SEPOLIA_CHAIN_ID) { - vm.createSelectFork("arbitrum-sepolia"); - } else { - revert UnsupportedChainId(chainId); - } - } + function forkChain(uint256 chainId) internal virtual { + if (chainId == ETHEREUM_CHAIN_ID) { + vm.createSelectFork("ethereum"); + } else if (chainId == SEPOLIA_CHAIN_ID) { + vm.createSelectFork("sepolia"); + } else if (chainId == OPTIMISM_CHAIN_ID) { + vm.createSelectFork("optimism"); + } else if (chainId == OPTIMISM_SEPOLIA_CHAIN_ID) { + vm.createSelectFork("optimism-sepolia"); + } else if (chainId == POLYGON_CHAIN_ID) { + vm.createSelectFork("polygon"); + } else if (chainId == POLYGON_AMOY_CHAIN_ID) { + vm.createSelectFork("polygon-amoy"); + } else if (chainId == BASE_CHAIN_ID) { + vm.createSelectFork("base"); + } else if (chainId == BASE_SEPOLIA_CHAIN_ID) { + vm.createSelectFork("base-sepolia"); + } else if (chainId == ARBITRUM_CHAIN_ID) { + vm.createSelectFork("arbitrum"); + } else if (chainId == ARBITRUM_SEPOLIA_CHAIN_ID) { + vm.createSelectFork("arbitrum-sepolia"); + } else { + revert UnsupportedChainId(chainId); + } + } } diff --git a/script/Deploy.s.sol b/script/Deploy.s.sol index 6baa6ce..edb834b 100644 --- a/script/Deploy.s.sol +++ b/script/Deploy.s.sol @@ -2,54 +2,54 @@ pragma solidity ^0.8.30; import {stdJson} from "forge-std/StdJson.sol"; -import {ForgeProxy} from "@proxy-forge/ForgeProxy.sol"; +import {ForgeProxy} from "proxy-forge/ForgeProxy.sol"; import {ChainlinkRouter} from "src/ChainlinkRouter.sol"; import {BaseScript} from "./BaseScript.sol"; contract Deploy is BaseScript { - using stdJson for string; - - bytes32 internal constant DEFAULT_SALT = bytes32("chainlink.router.1.0.0"); - - bytes32 internal salt; - address internal owner; - address internal proxyOwner; - - function setUp() public virtual override { - super.setUp(); - - salt = vm.envOr({name: "SALT", defaultValue: DEFAULT_SALT}); - owner = vm.envOr({name: "OWNER", defaultValue: broadcaster}); - proxyOwner = vm.envOr({name: "PROXY_OWNER", defaultValue: broadcaster}); - } - - function run() external { - string[] memory chainAliases = vm.envString("CHAINS", ","); - for (uint256 i; i < chainAliases.length; ++i) { - vm.createSelectFork(chainAliases[i]); - deployToChain(chainAliases[i]); - } - } - - function deployToChain(string memory chainAlias) internal virtual broadcast { - bytes memory data = abi.encodeCall(ChainlinkRouter.initialize, (owner)); - - address logic = address(new ChainlinkRouter{salt: salt}()); - address proxy = address(new ForgeProxy{salt: salt}(logic, proxyOwner, data)); - address proxyAdmin = vm.computeCreateAddress(proxy, 1); - - string memory deployment = "deployment"; - deployment.serialize("chainAlias", chainAlias); - deployment.serialize("chainId", block.chainid); - deployment.serialize("logic", logic); - deployment.serialize("owner", proxyOwner); - deployment.serialize("proxy", proxy); - deployment.serialize("proxyAdmin", proxyAdmin); - deployment.serialize("salt", vm.toString(salt)); - deployment.serialize("timestamp", block.timestamp); - deployment = deployment.serialize("broadcaster", broadcaster); - - string memory path = string.concat("./deployments/", vm.toString(block.chainid), ".json"); - deployment.write(path); - } + using stdJson for string; + + bytes32 internal constant DEFAULT_SALT = bytes32("chainlink.router.1.0.0"); + + bytes32 internal salt; + address internal owner; + address internal proxyOwner; + + function setUp() public virtual override { + super.setUp(); + + salt = vm.envOr({name: "SALT", defaultValue: DEFAULT_SALT}); + owner = vm.envOr({name: "OWNER", defaultValue: broadcaster}); + proxyOwner = vm.envOr({name: "PROXY_OWNER", defaultValue: broadcaster}); + } + + function run() external { + string[] memory chainAliases = vm.envString("CHAINS", ","); + for (uint256 i; i < chainAliases.length; ++i) { + vm.createSelectFork(chainAliases[i]); + deployToChain(chainAliases[i]); + } + } + + function deployToChain(string memory chainAlias) internal virtual broadcast { + bytes memory data = abi.encodeCall(ChainlinkRouter.initialize, (owner)); + + address logic = address(new ChainlinkRouter{salt: salt}()); + address proxy = address(new ForgeProxy{salt: salt}(logic, proxyOwner, data)); + address proxyAdmin = vm.computeCreateAddress(proxy, 1); + + string memory deployment = "deployment"; + deployment.serialize("chainAlias", chainAlias); + deployment.serialize("chainId", block.chainid); + deployment.serialize("logic", logic); + deployment.serialize("owner", proxyOwner); + deployment.serialize("proxy", proxy); + deployment.serialize("proxyAdmin", proxyAdmin); + deployment.serialize("salt", salt); + deployment.serialize("timestamp", block.timestamp); + deployment = deployment.serialize("broadcaster", broadcaster); + + string memory path = string.concat("./deployments/", vm.toString(block.chainid), ".json"); + deployment.write(path); + } } diff --git a/script/Register.s.sol b/script/Register.s.sol index 411de9c..4952870 100644 --- a/script/Register.s.sol +++ b/script/Register.s.sol @@ -6,29 +6,30 @@ import {ChainlinkRouter} from "src/ChainlinkRouter.sol"; import {BaseScript} from "./BaseScript.sol"; contract Register is BaseScript { - using stdJson for string; + using stdJson for string; - ChainlinkRouter internal router; + ChainlinkRouter internal router; - function setUp() public virtual override { - super.setUp(); + function setUp() public virtual override { + super.setUp(); - forkChain(block.chainid); + forkChain(block.chainid); - string memory json = vm.readFile(string.concat("./deployments/", vm.toString(block.chainid), ".json")); + string memory path = string.concat("./deployments/", vm.toString(block.chainid), ".json"); + string memory json = vm.readFile(path); - router = ChainlinkRouter(json.readAddress("$.proxy")); - vm.assertTrue(address(router).code.length != 0); - } + router = ChainlinkRouter(json.readAddress("$.proxy")); + vm.assertTrue(address(router).code.length != 0); + } - function run() external broadcast { - string[] memory cmd = new string[](4); - cmd[0] = "npx"; - cmd[1] = "ts-node"; - cmd[2] = "script/ts/encode-feeds.ts"; - cmd[3] = vm.toString(block.chainid); + function run() external broadcast { + string[] memory cmd = new string[](4); + cmd[0] = "npx"; + cmd[1] = "ts-node"; + cmd[2] = "script/ts/encode-feeds.ts"; + cmd[3] = vm.toString(block.chainid); - bytes memory params = vm.ffi(cmd); - router.register(params); - } + bytes memory params = vm.ffi(cmd); + router.register(params); + } } diff --git a/src/ChainlinkRouter.sol b/src/ChainlinkRouter.sol index 07fb8fe..36dd51b 100644 --- a/src/ChainlinkRouter.sol +++ b/src/ChainlinkRouter.sol @@ -39,462 +39,463 @@ import {Ownable} from "src/base/Ownable.sol"; /// /// @author fomoweth contract ChainlinkRouter is IChainlinkRouter, Initializable, Ownable { - using BytesParser for bytes; - using Denominations for address; - using PriceMath for uint256; - - /// @custom:storage-location erc7201:chainlink.router.storage - struct Storage { - mapping(address base => mapping(address quote => FeedConfig configuration)) feeds; - mapping(address asset => BitMap configuration) configurationMaps; - mapping(address asset => uint8 assetId) assetIds; - mapping(uint256 assetId => address asset) assets; - uint16 numAssets; - } - - /// @notice Storage slot calculated using ERC-7201 pattern - /// @dev keccak256(abi.encode(uint256(keccak256("chainlink.router.storage")) - 1)) & ~bytes32(uint256(0xff)) - uint256 private constant STORAGE_SLOT = 0xb4b1a749a23d159bc5ca72fecf3e094397bd4f0cb6afce4c7164622c60453c00; - - /// @notice Maximum number of assets supported by the system - uint256 internal constant MAX_ASSETS = 256; - - /// @notice Maximum number of hops allowed in a price routing path - uint256 internal constant MAX_HOPS = 4; - - /// @notice Reserved asset ID for USD denomination - uint256 internal constant USD_ID = 0; - - /// @notice Contract revision number for upgrade tracking - uint256 public constant REVISION = 0x01; - - /// @dev Constructor disables initializers to prevent direct initialization of implementation contract - constructor() { - _disableInitializers(); - } - - /// @notice Initializes the contract by setting the owner and registering USD - /// @param initialOwner The address that will be granted ownership of the contract - function initialize(address initialOwner) external initializer { - _checkNewOwner(initialOwner); - _setOwner(initialOwner); - _registerAsset(_getStorage(), Denominations.USD); - } - - /// @inheritdoc IChainlinkRouter - function register(bytes calldata params) external payable onlyOwner { - Storage storage $ = _getStorage(); - address feed; - address base; - address quote; - - while (true) { - if (params.length == 0) return; - (feed, base, quote, params) = params.parseFeedParams(); - _registerFeed($, feed, base, quote); - } - } - - /// @inheritdoc IChainlinkRouter - function deregister(bytes calldata params) external payable onlyOwner { - Storage storage $ = _getStorage(); - address base; - address quote; - - while (true) { - if (params.length == 0) return; - (base, quote, params) = params.parseAssetPair(); - _deregisterFeed($, base, quote); - } - } - - /// @inheritdoc IChainlinkRouter - function registerAsset(address asset) external payable onlyOwner { - _registerAsset(_getStorage(), asset); - } - - /// @inheritdoc IChainlinkRouter - function deregisterAsset(address asset) external payable onlyOwner { - _deregisterAsset(_getStorage(), asset); - } - - /// @notice Internal function to register a price feed - /// @dev Handles asset registration, BitMap updates, and feed storage - /// Automatically registers assets if they don't exist - /// @param $ Storage reference for gas optimization - /// @param feed Address of the Chainlink aggregator contract - /// @param base Address of the base asset - /// @param quote Address of the quote asset - function _registerFeed(Storage storage $, address feed, address base, address quote) internal virtual { - if (feed == address(0)) revert InvalidFeed(); - if (base == quote) revert IdenticalAssets(); - - // Register assets if they don't exist, otherwise get existing IDs - uint8 baseId = $.assetIds[base]; - if (base != Denominations.USD && baseId == USD_ID) baseId = _registerAsset($, base); - - uint8 quoteId = $.assetIds[quote]; - if (quote != Denominations.USD && quoteId == USD_ID) quoteId = _registerAsset($, quote); - - // Update asset configurations to reflect the new price feed relationship - $.configurationMaps[base] = $.configurationMaps[base].set(quoteId); - $.configurationMaps[quote] = $.configurationMaps[quote].set(baseId); - - // Store the feed configuration with all necessary metadata - $.feeds[base][quote] = toFeedConfig(feed, baseId, base.decimals(), quoteId, quote.decimals()); - - emit FeedRegistered(feed, base, quote); - } - - /// @notice Internal function to deregister a price feed - /// @dev Removes feed configuration and cleans up unused assets - /// Automatically deregisters assets that have no remaining feeds (except USD) - /// @param $ Storage reference for gas optimization - /// @param base Address of the base asset - /// @param quote Address of the quote asset - function _deregisterFeed(Storage storage $, address base, address quote) internal virtual { - if (base == quote) revert IdenticalAssets(); - - // Remove the feed relationship from both assets' BitMaps - $.configurationMaps[base] = $.configurationMaps[base].unset($.assetIds[quote]); - $.configurationMaps[quote] = $.configurationMaps[quote].unset($.assetIds[base]); - - // Clean up assets that no longer have any feeds (preserve USD) - if (base != Denominations.USD && $.configurationMaps[base].isZero()) _deregisterAsset($, base); - if (quote != Denominations.USD && $.configurationMaps[quote].isZero()) _deregisterAsset($, quote); - - // Clear the feed configuration - $.feeds[base][quote] = FeedConfig.wrap(0); - - emit FeedDeregistered(base, quote); - } - - /// @notice Internal function to register a new asset - /// @dev Assigns a unique ID and updates all relevant mappings - /// @param $ Storage reference for gas optimization - /// @param asset Address of the asset to register - /// @return assetId The assigned asset ID (0-255) - function _registerAsset(Storage storage $, address asset) internal virtual returns (uint8 assetId) { - if ($.numAssets == MAX_ASSETS) revert ExceededMaxAssets(); - if (asset == address(0)) revert InvalidAsset(); - if (asset != Denominations.USD && $.assetIds[asset] != USD_ID) revert AssetAlreadyExists(asset); - - unchecked { - // Find the first available asset ID slot - while (assetId < $.numAssets) { - if ($.assets[assetId] == address(0)) break; - ++assetId; - } - ++$.numAssets; - } - - // Register the asset with its assigned ID - $.assets[assetId] = asset; - $.assetIds[asset] = assetId; - - emit AssetAdded(asset, assetId); - } - - /// @notice Internal function to deregister an asset - /// @dev Removes all associated feeds and cleans up storage - /// @param $ Storage reference for gas optimization - /// @param asset Address of the asset to remove - /// @return assetId The asset ID that was freed - function _deregisterAsset(Storage storage $, address asset) internal virtual returns (uint8 assetId) { - if (asset == address(0) || asset == Denominations.USD) revert InvalidAsset(); - if ((assetId = $.assetIds[asset]) == USD_ID) revert AssetNotExists(asset); - - // Get the asset's current configuration BitMap - BitMap configuration = $.configurationMaps[asset]; - - // Remove this asset from all other assets' configuration maps - while (!configuration.isZero()) { - uint256 tokenId = configuration.findFirstSet(); - address token = $.assets[tokenId]; - configuration.unset(tokenId); - $.configurationMaps[token] = $.configurationMaps[token].unset(assetId); - } - - // Clear the asset's configuration and update counters - $.configurationMaps[asset] = configuration; - --$.numAssets; - - // Clean up storage mappings - delete $.assets[assetId]; - delete $.assetIds[asset]; - - emit AssetRemoved(asset, assetId); - } - - /// @inheritdoc IChainlinkRouter - function query(address base, address quote) external view returns (address[] memory path, uint256 accumulated) { - if (base == quote) revert IdenticalAssets(); - - FeedConfig[] memory feeds; - uint256 hops; - (feeds, accumulated, hops) = _queryPath(base, quote); - - // Resize the array to match actual hops used + 1 for path length - assembly ("memory-safe") { - if lt(hops, MAX_HOPS) { - mstore(feeds, add(hops, 0x01)) - } - path := feeds - } - } - - /// @inheritdoc IChainlinkRouter - function queryFeed(address base, address quote) external view returns (address feed) { - if (base == quote) revert IdenticalAssets(); - Storage storage $ = _getStorage(); - return _queryFeed($, base, quote).feed(); - } - - /// @inheritdoc IChainlinkRouter - function getFeed(address base, address quote) external view returns (address feed) { - if (base == quote) revert IdenticalAssets(); - Storage storage $ = _getStorage(); - return $.feeds[base][quote].feed(); - } - - /// @inheritdoc IChainlinkRouter - function getFeedConfiguration(address base, address quote) external view returns (FeedConfig) { - if (base == quote) revert IdenticalAssets(); - Storage storage $ = _getStorage(); - return $.feeds[base][quote]; - } - - /// @inheritdoc IChainlinkRouter - function getAssetConfiguration(address asset) external view returns (BitMap) { - Storage storage $ = _getStorage(); - return $.configurationMaps[asset]; - } - - /// @inheritdoc IChainlinkRouter - function getAssetId(address asset) external view returns (uint256) { - Storage storage $ = _getStorage(); - return $.assetIds[asset]; - } - - /// @inheritdoc IChainlinkRouter - function getAsset(uint256 id) external view returns (address) { - Storage storage $ = _getStorage(); - return $.assets[id]; - } - - /// @inheritdoc IChainlinkRouter - function numAssets() external view returns (uint256) { - Storage storage $ = _getStorage(); - return $.numAssets; - } - - /// @notice Internal function to find optimal routing path and calculate accumulated price across hops - /// @dev Implements iterative path-finding algorithm with automatic intermediate asset discovery - /// Uses breadth-first approach to find shortest path with maximum 4-hop limit - /// Handles price accumulation with proper decimal normalization and direction inversion - /// @param base Starting asset address for the pricing path - /// @param quote Target asset address for the pricing path - /// @return path Array of FeedConfig objects representing the complete routing path - /// @return accumulated Final calculated price after traversing all hops with proper scaling - /// @return hops Number of routing hops required - /// @dev Algorithm flow: - /// 1. Try direct path (base -> quote) - /// 2. If no direct path, find intermediate asset (base -> intermediate -> quote) - /// 3. Accumulate prices with proper inversion and decimal handling - /// 4. Repeat until target reached or max hops exceeded - function _queryPath( - address base, - address quote - ) internal view virtual returns (FeedConfig[] memory path, uint256 accumulated, uint256 hops) { - // Retrieve storage reference using ERC-7201 pattern - Storage storage $ = _getStorage(); - - // Pre-allocate array for maximum possible hops - path = new FeedConfig[](MAX_HOPS); - - // Track current position in the routing path - address baseCurrent = base; - address quoteCurrent = quote; - - while (hops < MAX_HOPS) { - // Attempt to find direct feed between current base and quote - FeedConfig feed = _queryFeed($, baseCurrent, quoteCurrent); - - if (feed.isZero()) { - // No direct feed found, search for intermediate asset - address intermediate = _queryIntermediate($, baseCurrent, quoteCurrent); - - // Validate that intermediate asset was found - if (intermediate == address(0)) revert FeedNotFound(baseCurrent, quoteCurrent); - - // Route through intermediate asset - feed = _queryFeed($, baseCurrent, quoteCurrent = intermediate); - } - - // Store the feed configuration for this hop - path[hops] = feed; - - // Fetch current price from the Chainlink aggregator - uint256 answer = _fetchLatestAnswer(feed); - - if (hops == 0) { - // First hop: establish base price with potential inversion - accumulated = _queryDirection($, feed, quoteCurrent, baseCurrent) - ? answer.invert(feed.quoteDecimals(), feed.baseDecimals()) - : answer; - } else { - // Subsequent hops: accumulate price through derivation - accumulated = _accumulateAnswer($, feed, baseCurrent, quoteCurrent, accumulated, answer); - } - - // Check if the target asset was reached - if (quoteCurrent == quote) break; - - // Continue routing towards target asset - baseCurrent = quoteCurrent; - quoteCurrent = quote; - - unchecked { - ++hops; - } - } - - // Validate that the target asset was reached successfully - if (quoteCurrent != quote) revert FeedNotFound(base, quote); - } - - /// @notice Internal function to find the intermediate asset for routing between two assets - /// @dev Uses BitMap intersection to find common connections, falls back to base connections - /// @param $ Storage reference for gas optimization - /// @param base The source asset - /// @param quote The target asset - /// @return intermediate The address of the intermediate asset - function _queryIntermediate( - Storage storage $, - address base, - address quote - ) internal view virtual returns (address intermediate) { - BitMap baseConfiguration = $.configurationMaps[base]; - BitMap quoteConfiguration = $.configurationMaps[quote]; - - // Find assets connected to both base and quote (optimal routing) - BitMap intersection = baseConfiguration & quoteConfiguration; - - // If no common connections, use any asset connected to base - if (intersection.isZero()) intersection = baseConfiguration; - - uint256 assetId = intersection.findFirstSet(); - return $.assets[assetId]; - } - - /// @notice Internal function to find a feed for an asset pair with bidirectional search - /// @dev Checks both base/quote and quote/base directions for feed existence - /// @param $ Storage reference for gas optimization - /// @param base The base asset address - /// @param quote The quote asset address - /// @return feed The found FeedConfig, or zero if no feed exists - function _queryFeed( - Storage storage $, - address base, - address quote - ) internal view virtual returns (FeedConfig feed) { - // Try direct lookup first, then reverse direction - if ((feed = $.feeds[base][quote]).isZero()) feed = $.feeds[quote][base]; - } - - /// @notice Internal function to determine if a feed requires price inversion for the desired direction - /// @dev Compares feed's stored base/quote IDs with requested asset IDs - /// @param $ Storage reference for gas optimization - /// @param feed The feed configuration to check - /// @param base The desired base asset - /// @param quote The desired quote asset - /// @return inverse True if the feed's direction matches the request (no inversion needed) - function _queryDirection( - Storage storage $, - FeedConfig feed, - address base, - address quote - ) internal view returns (bool inverse) { - return feed.baseId() == $.assetIds[base] && feed.quoteId() == $.assetIds[quote]; - } - - /// @notice Internal function to accumulate price data across multiple routing hops - /// @dev Handles price derivation with proper decimal normalization and inversion - /// @dev Combines previously accumulated price with current feed price using mathematical derivation - /// Handles automatic price inversion when feed direction doesn't match desired routing direction - /// Essential for multi-hop price discovery where intermediate assets are used - /// @param $ Storage reference for gas optimization - /// @param feed The current feed configuration - /// @param base Current base asset - /// @param quote Current quote asset - /// @param accumulated Accumulated price from previous hops - /// @param answer Current price fetched from feed - /// @return result Updated accumulated price after this hop - function _accumulateAnswer( - Storage storage $, - FeedConfig feed, - address base, - address quote, - uint256 accumulated, - uint256 answer - ) internal view virtual returns (uint256 result) { - // Determine if the feed's natural direction matches our desired routing direction - bool inverse = _queryDirection($, feed, base, quote); - - // Extract decimal configuration from the feed metadata - uint8 baseDecimals = feed.baseDecimals(); - uint8 quoteDecimals = feed.quoteDecimals(); - - // Feed is in opposite direction (quote/base instead of base/quote) - if (inverse) { - // Invert the price - answer = answer.invert(baseDecimals, quoteDecimals); - - // Swap decimal configuration to match the inverted price direction - // This ensures proper decimal handling in subsequent calculations - quoteDecimals = baseDecimals; - } - - // Calculate derived price from accumulated price and current feed price - result = accumulated.derive(answer, base.decimals(), quoteDecimals, quote.decimals()); - } - - /// @notice Internal function to fetch the latest price from a Chainlink aggregator - /// @param feed The FeedConfig containing the aggregator address - /// @return answer The latest price from the feed - function _fetchLatestAnswer(FeedConfig feed) internal view virtual returns (uint256 answer) { - assembly ("memory-safe") { - mstore(0x00, 0x50d25bcd) // latestAnswer() - - // Execute static call to the feed address extracted from FeedConfig - if iszero(staticcall(gas(), shr(0x60, shl(0x60, feed)), 0x1c, 0x04, 0x00, 0x20)) { - let ptr := mload(0x40) - returndatacopy(ptr, 0x00, returndatasize()) - revert(ptr, returndatasize()) - } - - // Validate that the price is not a negative number nor zero - if iszero(sgt(mload(0x00), 0x00)) { - mstore(0x00, 0x00bfc921) // InvalidPrice() - revert(0x1c, 0x04) - } - - answer := mload(0x00) - } - } - - /// @notice Internal function to get storage reference using ERC-7201 pattern - /// @return $ Reference to the storage struct - function _getStorage() internal pure virtual returns (Storage storage $) { - assembly ("memory-safe") { - $.slot := STORAGE_SLOT - } - } - - /// @notice Internal function to get the contract revision number for upgrade compatibility - /// @dev Required override from parent contract for version tracking - /// @return The current contract revision - function _getRevision() internal pure virtual override returns (uint256) { - return REVISION; - } + using BytesParser for bytes; + using Denominations for address; + using PriceMath for uint256; + + /// @custom:storage-location erc7201:chainlink.router.storage + struct Storage { + mapping(address base => mapping(address quote => FeedConfig configuration)) feeds; + mapping(address asset => BitMap configuration) configurationMaps; + mapping(address asset => uint8 assetId) assetIds; + mapping(uint256 assetId => address asset) assets; + uint16 numAssets; + } + + /// @notice Storage slot calculated using ERC-7201 pattern + /// @dev keccak256(abi.encode(uint256(keccak256("chainlink.router.storage")) - 1)) & ~bytes32(uint256(0xff)) + uint256 private constant STORAGE_SLOT = 0xb4b1a749a23d159bc5ca72fecf3e094397bd4f0cb6afce4c7164622c60453c00; + + /// @notice Maximum number of assets supported by the system + uint256 internal constant MAX_ASSETS = 256; + + /// @notice Maximum number of hops allowed in a price routing path + uint256 internal constant MAX_HOPS = 4; + + /// @notice Reserved asset ID for USD denomination + uint256 internal constant USD_ID = 0; + + /// @notice Contract revision number for upgrade tracking + uint256 public constant REVISION = 0x01; + + /// @dev Constructor disables initializers to prevent direct initialization of implementation contract + constructor() { + _disableInitializers(); + } + + /// @notice Initializes the contract by setting the owner and registering USD + /// @param initialOwner The address that will be granted ownership of the contract + function initialize(address initialOwner) external initializer { + _checkNewOwner(initialOwner); + _setOwner(initialOwner); + _registerAsset(_getStorage(), Denominations.USD); + } + + /// @inheritdoc IChainlinkRouter + function register(bytes calldata params) external payable onlyOwner { + Storage storage $ = _getStorage(); + address feed; + address base; + address quote; + + while (true) { + if (params.length == 0) return; + (feed, base, quote, params) = params.parseFeedParams(); + _registerFeed($, feed, base, quote); + } + } + + /// @inheritdoc IChainlinkRouter + function deregister(bytes calldata params) external payable onlyOwner { + Storage storage $ = _getStorage(); + address base; + address quote; + + while (true) { + if (params.length == 0) return; + (base, quote, params) = params.parseAssetPair(); + _deregisterFeed($, base, quote); + } + } + + /// @inheritdoc IChainlinkRouter + function registerAsset(address asset) external payable onlyOwner { + _registerAsset(_getStorage(), asset); + } + + /// @inheritdoc IChainlinkRouter + function deregisterAsset(address asset) external payable onlyOwner { + _deregisterAsset(_getStorage(), asset); + } + + /// @notice Internal function to register a price feed + /// @dev Handles asset registration, BitMap updates, and feed storage + /// Automatically registers assets if they don't exist + /// @param $ Storage reference for gas optimization + /// @param feed Address of the Chainlink aggregator contract + /// @param base Address of the base asset + /// @param quote Address of the quote asset + function _registerFeed(Storage storage $, address feed, address base, address quote) internal virtual { + if (feed == address(0)) revert InvalidFeed(); + if (base == quote) revert IdenticalAssets(); + + // Register assets if they don't exist, otherwise get existing IDs + uint8 baseId = $.assetIds[base]; + if (base != Denominations.USD && baseId == USD_ID) baseId = _registerAsset($, base); + + uint8 quoteId = $.assetIds[quote]; + if (quote != Denominations.USD && quoteId == USD_ID) quoteId = _registerAsset($, quote); + + // Update asset configurations to reflect the new price feed relationship + $.configurationMaps[base] = $.configurationMaps[base].set(quoteId); + $.configurationMaps[quote] = $.configurationMaps[quote].set(baseId); + + // Store the feed configuration with all necessary metadata + $.feeds[base][quote] = toFeedConfig(feed, baseId, base.decimals(), quoteId, quote.decimals()); + + emit FeedRegistered(feed, base, quote); + } + + /// @notice Internal function to deregister a price feed + /// @dev Removes feed configuration and cleans up unused assets + /// Automatically deregisters assets that have no remaining feeds (except USD) + /// @param $ Storage reference for gas optimization + /// @param base Address of the base asset + /// @param quote Address of the quote asset + function _deregisterFeed(Storage storage $, address base, address quote) internal virtual { + if (base == quote) revert IdenticalAssets(); + + // Remove the feed relationship from both assets' BitMaps + $.configurationMaps[base] = $.configurationMaps[base].unset($.assetIds[quote]); + $.configurationMaps[quote] = $.configurationMaps[quote].unset($.assetIds[base]); + + // Clean up assets that no longer have any feeds (preserve USD) + if (base != Denominations.USD && $.configurationMaps[base].isZero()) _deregisterAsset($, base); + if (quote != Denominations.USD && $.configurationMaps[quote].isZero()) _deregisterAsset($, quote); + + // Clear the feed configuration + $.feeds[base][quote] = FeedConfig.wrap(0); + + emit FeedDeregistered(base, quote); + } + + /// @notice Internal function to register a new asset + /// @dev Assigns a unique ID and updates all relevant mappings + /// @param $ Storage reference for gas optimization + /// @param asset Address of the asset to register + /// @return assetId The assigned asset ID (0-255) + function _registerAsset(Storage storage $, address asset) internal virtual returns (uint8 assetId) { + if ($.numAssets == MAX_ASSETS) revert ExceededMaxAssets(); + if (asset == address(0)) revert InvalidAsset(); + if (asset != Denominations.USD && $.assetIds[asset] != USD_ID) revert AssetAlreadyExists(asset); + + unchecked { + // Find the first available asset ID slot + while (assetId < $.numAssets) { + if ($.assets[assetId] == address(0)) break; + ++assetId; + } + ++$.numAssets; + } + + // Register the asset with its assigned ID + $.assets[assetId] = asset; + $.assetIds[asset] = assetId; + + emit AssetAdded(asset, assetId); + } + + /// @notice Internal function to deregister an asset + /// @dev Removes all associated feeds and cleans up storage + /// @param $ Storage reference for gas optimization + /// @param asset Address of the asset to remove + /// @return assetId The asset ID that was freed + function _deregisterAsset(Storage storage $, address asset) internal virtual returns (uint8 assetId) { + if (asset == address(0) || asset == Denominations.USD) revert InvalidAsset(); + if ((assetId = $.assetIds[asset]) == USD_ID) revert AssetNotExists(asset); + + // Get the asset's current configuration BitMap + BitMap configuration = $.configurationMaps[asset]; + + // Remove this asset from all other assets' configuration maps + while (!configuration.isZero()) { + uint256 tokenId = configuration.findFirstSet(); + address token = $.assets[tokenId]; + configuration.unset(tokenId); + $.configurationMaps[token] = $.configurationMaps[token].unset(assetId); + } + + // Clear the asset's configuration and update counters + $.configurationMaps[asset] = configuration; + --$.numAssets; + + // Clean up storage mappings + delete $.assets[assetId]; + delete $.assetIds[asset]; + + emit AssetRemoved(asset, assetId); + } + + /// @inheritdoc IChainlinkRouter + function query(address base, address quote) external view returns (address[] memory path, uint256 accumulated) { + if (base == quote) revert IdenticalAssets(); + + FeedConfig[] memory feeds; + uint256 hops; + (feeds, accumulated, hops) = _queryPath(base, quote); + + // Resize the array to match actual hops used + 1 for path length + assembly ("memory-safe") { + if lt(hops, MAX_HOPS) { mstore(feeds, add(hops, 0x01)) } + path := feeds + } + } + + /// @inheritdoc IChainlinkRouter + function queryFeed(address base, address quote) external view returns (address feed) { + if (base == quote) revert IdenticalAssets(); + Storage storage $ = _getStorage(); + return _queryFeed($, base, quote).feed(); + } + + /// @inheritdoc IChainlinkRouter + function getFeed(address base, address quote) external view returns (address feed) { + if (base == quote) revert IdenticalAssets(); + Storage storage $ = _getStorage(); + return $.feeds[base][quote].feed(); + } + + /// @inheritdoc IChainlinkRouter + function getFeedConfiguration(address base, address quote) external view returns (FeedConfig) { + if (base == quote) revert IdenticalAssets(); + Storage storage $ = _getStorage(); + return $.feeds[base][quote]; + } + + /// @inheritdoc IChainlinkRouter + function getAssetConfiguration(address asset) external view returns (BitMap) { + Storage storage $ = _getStorage(); + return $.configurationMaps[asset]; + } + + /// @inheritdoc IChainlinkRouter + function getAssetId(address asset) external view returns (uint256) { + Storage storage $ = _getStorage(); + return $.assetIds[asset]; + } + + /// @inheritdoc IChainlinkRouter + function getAsset(uint256 id) external view returns (address) { + Storage storage $ = _getStorage(); + return $.assets[id]; + } + + /// @inheritdoc IChainlinkRouter + function numAssets() external view returns (uint256) { + Storage storage $ = _getStorage(); + return $.numAssets; + } + + /// @notice Internal function to find optimal routing path and calculate accumulated price across hops + /// @dev Implements iterative path-finding algorithm with automatic intermediate asset discovery + /// Uses breadth-first approach to find shortest path with maximum 4-hop limit + /// Handles price accumulation with proper decimal normalization and direction inversion + /// @param base Starting asset address for the pricing path + /// @param quote Target asset address for the pricing path + /// @return path Array of FeedConfig objects representing the complete routing path + /// @return accumulated Final calculated price after traversing all hops with proper scaling + /// @return hops Number of routing hops required + /// @dev Algorithm flow: + /// 1. Try direct path (base -> quote) + /// 2. If no direct path, find intermediate asset (base -> intermediate -> quote) + /// 3. Accumulate prices with proper inversion and decimal handling + /// 4. Repeat until target reached or max hops exceeded + function _queryPath(address base, address quote) + internal + view + virtual + returns (FeedConfig[] memory path, uint256 accumulated, uint256 hops) + { + // Retrieve storage reference using ERC-7201 pattern + Storage storage $ = _getStorage(); + + // Pre-allocate array for maximum possible hops + path = new FeedConfig[](MAX_HOPS); + + // Track current position in the routing path + address baseCurrent = base; + address quoteCurrent = quote; + + while (hops < MAX_HOPS) { + // Attempt to find direct feed between current base and quote + FeedConfig feed = _queryFeed($, baseCurrent, quoteCurrent); + + if (feed.isZero()) { + // No direct feed found, search for intermediate asset + address intermediate = _queryIntermediate($, baseCurrent, quoteCurrent); + + // Validate that intermediate asset was found + if (intermediate == address(0)) revert FeedNotFound(baseCurrent, quoteCurrent); + + // Route through intermediate asset + feed = _queryFeed($, baseCurrent, quoteCurrent = intermediate); + } + + // Store the feed configuration for this hop + path[hops] = feed; + + // Fetch current price from the Chainlink aggregator + uint256 answer = _fetchLatestAnswer(feed); + + if (hops == 0) { + // First hop: establish base price with potential inversion + accumulated = _queryDirection($, feed, quoteCurrent, baseCurrent) + ? answer.invert(feed.quoteDecimals(), feed.baseDecimals()) + : answer; + } else { + // Subsequent hops: accumulate price through derivation + accumulated = _accumulateAnswer($, feed, baseCurrent, quoteCurrent, accumulated, answer); + } + + // Check if the target asset was reached + if (quoteCurrent == quote) break; + + // Continue routing towards target asset + baseCurrent = quoteCurrent; + quoteCurrent = quote; + + unchecked { + ++hops; + } + } + + // Validate that the target asset was reached successfully + if (quoteCurrent != quote) revert FeedNotFound(base, quote); + } + + /// @notice Internal function to find the intermediate asset for routing between two assets + /// @dev Uses BitMap intersection to find common connections, falls back to base connections + /// @param $ Storage reference for gas optimization + /// @param base The source asset + /// @param quote The target asset + /// @return intermediate The address of the intermediate asset + function _queryIntermediate(Storage storage $, address base, address quote) + internal + view + virtual + returns (address intermediate) + { + BitMap baseConfiguration = $.configurationMaps[base]; + BitMap quoteConfiguration = $.configurationMaps[quote]; + + // Find assets connected to both base and quote (optimal routing) + BitMap intersection = baseConfiguration & quoteConfiguration; + + // If no common connections, use any asset connected to base + if (intersection.isZero()) intersection = baseConfiguration; + + uint256 assetId = intersection.findFirstSet(); + return $.assets[assetId]; + } + + /// @notice Internal function to find a feed for an asset pair with bidirectional search + /// @dev Checks both base/quote and quote/base directions for feed existence + /// @param $ Storage reference for gas optimization + /// @param base The base asset address + /// @param quote The quote asset address + /// @return feed The found FeedConfig, or zero if no feed exists + function _queryFeed(Storage storage $, address base, address quote) + internal + view + virtual + returns (FeedConfig feed) + { + // Try direct lookup first, then reverse direction + if ((feed = $.feeds[base][quote]).isZero()) feed = $.feeds[quote][base]; + } + + /// @notice Internal function to determine if a feed requires price inversion for the desired direction + /// @dev Compares feed's stored base/quote IDs with requested asset IDs + /// @param $ Storage reference for gas optimization + /// @param feed The feed configuration to check + /// @param base The desired base asset + /// @param quote The desired quote asset + /// @return inverse True if the feed's direction matches the request (no inversion needed) + function _queryDirection(Storage storage $, FeedConfig feed, address base, address quote) + internal + view + returns (bool inverse) + { + return feed.baseId() == $.assetIds[base] && feed.quoteId() == $.assetIds[quote]; + } + + /// @notice Internal function to accumulate price data across multiple routing hops + /// @dev Handles price derivation with proper decimal normalization and inversion + /// @dev Combines previously accumulated price with current feed price using mathematical derivation + /// Handles automatic price inversion when feed direction doesn't match desired routing direction + /// Essential for multi-hop price discovery where intermediate assets are used + /// @param $ Storage reference for gas optimization + /// @param feed The current feed configuration + /// @param base Current base asset + /// @param quote Current quote asset + /// @param accumulated Accumulated price from previous hops + /// @param answer Current price fetched from feed + /// @return result Updated accumulated price after this hop + function _accumulateAnswer( + Storage storage $, + FeedConfig feed, + address base, + address quote, + uint256 accumulated, + uint256 answer + ) internal view virtual returns (uint256 result) { + // Determine if the feed's natural direction matches our desired routing direction + bool inverse = _queryDirection($, feed, base, quote); + + // Extract decimal configuration from the feed metadata + uint8 baseDecimals = feed.baseDecimals(); + uint8 quoteDecimals = feed.quoteDecimals(); + + // Feed is in opposite direction (quote/base instead of base/quote) + if (inverse) { + // Invert the price + answer = answer.invert(baseDecimals, quoteDecimals); + + // Swap decimal configuration to match the inverted price direction + // This ensures proper decimal handling in subsequent calculations + quoteDecimals = baseDecimals; + } + + // Calculate derived price from accumulated price and current feed price + result = accumulated.derive(answer, base.decimals(), quoteDecimals, quote.decimals()); + } + + /// @notice Internal function to fetch the latest price from a Chainlink aggregator + /// @param feed The FeedConfig containing the aggregator address + /// @return answer The latest price from the feed + function _fetchLatestAnswer(FeedConfig feed) internal view virtual returns (uint256 answer) { + assembly ("memory-safe") { + mstore(0x00, 0x50d25bcd) // latestAnswer() + + // Execute static call to the feed address extracted from FeedConfig + if iszero(staticcall(gas(), shr(0x60, shl(0x60, feed)), 0x1c, 0x04, 0x00, 0x20)) { + let ptr := mload(0x40) + returndatacopy(ptr, 0x00, returndatasize()) + revert(ptr, returndatasize()) + } + + // Validate that the price is not a negative number nor zero + if iszero(sgt(mload(0x00), 0x00)) { + mstore(0x00, 0x00bfc921) // InvalidPrice() + revert(0x1c, 0x04) + } + + answer := mload(0x00) + } + } + + /// @notice Internal function to get storage reference using ERC-7201 pattern + /// @return $ Reference to the storage struct + function _getStorage() internal pure virtual returns (Storage storage $) { + assembly ("memory-safe") { + $.slot := STORAGE_SLOT + } + } + + /// @notice Internal function to get the contract revision number for upgrade compatibility + /// @dev Required override from parent contract for version tracking + /// @return The current contract revision + function _getRevision() internal pure virtual override returns (uint256) { + return REVISION; + } } diff --git a/src/base/Initializable.sol b/src/base/Initializable.sol index df098a1..008389b 100644 --- a/src/base/Initializable.sol +++ b/src/base/Initializable.sol @@ -7,121 +7,121 @@ pragma solidity ^0.8.30; /// Modified from https://github.com/aave/aave-v3-core/blob/master/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol /// @author fomoweth abstract contract Initializable { - /// @notice Thrown when initialization is attempted in invalid state - /// @dev This occurs when: - /// - Contract is already initialized with current or higher revision - /// - Attempting to initialize during construction inappropriately - /// - Disabling initializers when already initializing or disabled - error InvalidInitialization(); - - /// @notice Thrown when a function requires initializing state but contract is not initializing - /// @dev Used by `onlyInitializing` modifier to restrict function access - error NotInitializing(); - - /// @notice Emitted when the contract is initialized to a specific revision - /// @param version The revision number that was initialized - event Initialized(uint64 version); - - /// @notice Pre-computed keccak256 hash of the {Initialized} event signature - /// @dev keccak256("Initialized(uint64)") - uint256 private constant INITIALIZED_EVENT_SIGNATURE = - 0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2; - - /// @notice Transient storage slot for `initializing` flag (EIP-1153) - /// @dev keccak256(abi.encode(uint256(keccak256("Initializable.transient.initializing")) - 1)) & ~bytes32(uint256(0xff)) - uint256 private constant INITIALIZING_SLOT = 0xeca7f472cf9c3c8c4bc0b06bb5d562cccb95e77b81864611903b081e99f1f800; - - /// @notice Persistent storage slot for initialized revision number - /// @dev keccak256(abi.encode(uint256(keccak256("Initializable.storage.initialized")) - 1)) & ~bytes32(uint256(0xff)) - uint256 private constant INITIALIZED_SLOT = 0xeb0c2ce5f191d27e756051385ba4f8f2e0c18127de8ff7207a5891e3b49bb400; - - /// @notice Maximum initialization revision number - /// @dev Used as a sentinel value to permanently disable initializers - uint64 private constant MAX_REVISION = (1 << 64) - 1; - - /// @notice Allows initialization to a specific revision which can be invoked at most once - modifier initializer() { - // Get the target revision from the implementing contract - uint256 revision = _getRevision(); - bool isTopLevelCall; - - assembly ("memory-safe") { - // Check if this is a top-level initialization call - isTopLevelCall := iszero(tload(INITIALIZING_SLOT)) - - // Validation logic: - // 1. If this is a top-level call AND not in constructor AND revision <= current initialized version - // 2. Then this is an invalid initialization attempt - if and( - and(isTopLevelCall, iszero(iszero(extcodesize(address())))), - iszero(gt(revision, sload(INITIALIZED_SLOT))) - ) { - mstore(0x00, 0xf92ee8a9) // InvalidInitialization() - revert(0x1c, 0x04) - } - - // If this is a top-level call, set up initialization state - if isTopLevelCall { - // Mark as `initializing` in transient storage - tstore(INITIALIZING_SLOT, 0x01) - // Store the new revision number in persistent storage - // Mask ensures we only store 64 bits - sstore(INITIALIZED_SLOT, and(revision, MAX_REVISION)) - } - } - _; - assembly ("memory-safe") { - // Clean up if this was a top-level call - if isTopLevelCall { - // Clear the `initializing` flag (automatic with transient storage, but explicit for clarity) - tstore(INITIALIZING_SLOT, 0x00) - // Store revision in memory for event data - mstore(0x20, and(revision, MAX_REVISION)) - // Emit {Initialized} event - log1(0x20, 0x20, INITIALIZED_EVENT_SIGNATURE) - } - } - } - - /// @notice Restricts function access to initialization phase only - /// @dev Functions with this modifier can only be called during initialization - modifier onlyInitializing() { - _checkInitializing(); - _; - } - - /// @notice Permanently disables initializers to prevent future initialization - function _disableInitializers() internal virtual { - assembly ("memory-safe") { - // Check for invalid states: - // 1. Currently initializing (would break the current initialization) - // 2. Already disabled (redundant call) - if or(tload(INITIALIZING_SLOT), eq(sload(INITIALIZED_SLOT), MAX_REVISION)) { - mstore(0x00, 0xf92ee8a9) // InvalidInitialization() - revert(0x1c, 0x04) - } - - // Set revision to maximum value to permanently disable - sstore(INITIALIZED_SLOT, MAX_REVISION) - // Emit {Initialized} event with max version to signal disabling - mstore(0x20, MAX_REVISION) - log1(0x20, 0x20, INITIALIZED_EVENT_SIGNATURE) - } - } - - /// @notice Internal function to verify contract is in initializing state - function _checkInitializing() internal view virtual { - assembly ("memory-safe") { - if iszero(tload(INITIALIZING_SLOT)) { - mstore(0x00, 0xd7e6bcf8) // NotInitializing() - revert(0x1c, 0x04) - } - } - } - - /// @notice Abstract function that must be implemented by derived contracts - /// @dev This defines the target revision for initialization - /// Should return a constant value that increases with contract upgrades - /// @return The revision number for this contract version - function _getRevision() internal pure virtual returns (uint256); + /// @notice Thrown when initialization is attempted in invalid state + /// @dev This occurs when: + /// - Contract is already initialized with current or higher revision + /// - Attempting to initialize during construction inappropriately + /// - Disabling initializers when already initializing or disabled + error InvalidInitialization(); + + /// @notice Thrown when a function requires initializing state but contract is not initializing + /// @dev Used by `onlyInitializing` modifier to restrict function access + error NotInitializing(); + + /// @notice Emitted when the contract is initialized to a specific revision + /// @param version The revision number that was initialized + event Initialized(uint64 version); + + /// @notice Pre-computed keccak256 hash of the {Initialized} event signature + /// @dev keccak256("Initialized(uint64)") + uint256 private constant INITIALIZED_EVENT_SIGNATURE = + 0xc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2; + + /// @notice Transient storage slot for `initializing` flag (EIP-1153) + /// @dev keccak256(abi.encode(uint256(keccak256("Initializable.transient.initializing")) - 1)) & ~bytes32(uint256(0xff)) + uint256 private constant INITIALIZING_SLOT = 0xeca7f472cf9c3c8c4bc0b06bb5d562cccb95e77b81864611903b081e99f1f800; + + /// @notice Persistent storage slot for initialized revision number + /// @dev keccak256(abi.encode(uint256(keccak256("Initializable.storage.initialized")) - 1)) & ~bytes32(uint256(0xff)) + uint256 private constant INITIALIZED_SLOT = 0xeb0c2ce5f191d27e756051385ba4f8f2e0c18127de8ff7207a5891e3b49bb400; + + /// @notice Maximum initialization revision number + /// @dev Used as a sentinel value to permanently disable initializers + uint64 private constant MAX_REVISION = (1 << 64) - 1; + + /// @notice Allows initialization to a specific revision which can be invoked at most once + modifier initializer() { + // Get the target revision from the implementing contract + uint256 revision = _getRevision(); + bool isTopLevelCall; + + assembly ("memory-safe") { + // Check if this is a top-level initialization call + isTopLevelCall := iszero(tload(INITIALIZING_SLOT)) + + // Validation logic: + // 1. If this is a top-level call AND not in constructor AND revision <= current initialized version + // 2. Then this is an invalid initialization attempt + if and( + and(isTopLevelCall, iszero(iszero(extcodesize(address())))), + iszero(gt(revision, sload(INITIALIZED_SLOT))) + ) { + mstore(0x00, 0xf92ee8a9) // InvalidInitialization() + revert(0x1c, 0x04) + } + + // If this is a top-level call, set up initialization state + if isTopLevelCall { + // Mark as `initializing` in transient storage + tstore(INITIALIZING_SLOT, 0x01) + // Store the new revision number in persistent storage + // Mask ensures we only store 64 bits + sstore(INITIALIZED_SLOT, and(revision, MAX_REVISION)) + } + } + _; + assembly ("memory-safe") { + // Clean up if this was a top-level call + if isTopLevelCall { + // Clear the `initializing` flag (automatic with transient storage, but explicit for clarity) + tstore(INITIALIZING_SLOT, 0x00) + // Store revision in memory for event data + mstore(0x20, and(revision, MAX_REVISION)) + // Emit {Initialized} event + log1(0x20, 0x20, INITIALIZED_EVENT_SIGNATURE) + } + } + } + + /// @notice Restricts function access to initialization phase only + /// @dev Functions with this modifier can only be called during initialization + modifier onlyInitializing() { + _checkInitializing(); + _; + } + + /// @notice Permanently disables initializers to prevent future initialization + function _disableInitializers() internal virtual { + assembly ("memory-safe") { + // Check for invalid states: + // 1. Currently initializing (would break the current initialization) + // 2. Already disabled (redundant call) + if or(tload(INITIALIZING_SLOT), eq(sload(INITIALIZED_SLOT), MAX_REVISION)) { + mstore(0x00, 0xf92ee8a9) // InvalidInitialization() + revert(0x1c, 0x04) + } + + // Set revision to maximum value to permanently disable + sstore(INITIALIZED_SLOT, MAX_REVISION) + // Emit {Initialized} event with max version to signal disabling + mstore(0x20, MAX_REVISION) + log1(0x20, 0x20, INITIALIZED_EVENT_SIGNATURE) + } + } + + /// @notice Internal function to verify contract is in initializing state + function _checkInitializing() internal view virtual { + assembly ("memory-safe") { + if iszero(tload(INITIALIZING_SLOT)) { + mstore(0x00, 0xd7e6bcf8) // NotInitializing() + revert(0x1c, 0x04) + } + } + } + + /// @notice Abstract function that must be implemented by derived contracts + /// @dev This defines the target revision for initialization + /// Should return a constant value that increases with contract upgrades + /// @return The revision number for this contract version + function _getRevision() internal pure virtual returns (uint256); } diff --git a/src/base/Ownable.sol b/src/base/Ownable.sol index 1aa592a..b137b07 100644 --- a/src/base/Ownable.sol +++ b/src/base/Ownable.sol @@ -6,83 +6,83 @@ pragma solidity ^0.8.30; /// @dev Modified from https://github.com/Vectorized/solady/blob/main/src/auth/Ownable.sol /// @author fomoweth abstract contract Ownable { - /// @notice Thrown when an invalid owner address is provided - error InvalidNewOwner(); + /// @notice Thrown when an invalid owner address is provided + error InvalidNewOwner(); - /// @notice Thrown when unauthorized account attempts restricted operation - error UnauthorizedAccount(address account); + /// @notice Thrown when unauthorized account attempts restricted operation + error UnauthorizedAccount(address account); - /// @notice Emitted when the ownership is transferred - /// @dev Compatible with EIP-173 for indexer support - /// @param previousOwner The address of the previous owner - /// @param newOwner The address of the new owner - event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); + /// @notice Emitted when the ownership is transferred + /// @dev Compatible with EIP-173 for indexer support + /// @param previousOwner The address of the previous owner + /// @param newOwner The address of the new owner + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); - /// @notice Pre-computed keccak256 hash of the {OwnershipTransferred} event signature - /// @dev keccak256("OwnershipTransferred(address,address)") - uint256 private constant OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE = - 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0; + /// @notice Pre-computed keccak256 hash of the {OwnershipTransferred} event signature + /// @dev keccak256("OwnershipTransferred(address,address)") + uint256 private constant OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE = + 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0; - /// @notice Storage slot for owner address - /// @dev keccak256(abi.encode(uint256(keccak256("Ownable.storage.owner")) - 1)) & ~bytes32(uint256(0xff)) - uint256 private constant OWNER_SLOT = 0xb037133c75dfcd4f094c94d0d9c23d2de13583ebafe40c8a35ad4c5b3b86e300; + /// @notice Storage slot for owner address + /// @dev keccak256(abi.encode(uint256(keccak256("Ownable.storage.owner")) - 1)) & ~bytes32(uint256(0xff)) + uint256 private constant OWNER_SLOT = 0xb037133c75dfcd4f094c94d0d9c23d2de13583ebafe40c8a35ad4c5b3b86e300; - /// @notice Restricts function access to the contract owner only - modifier onlyOwner() { - _checkOwner(); - _; - } + /// @notice Restricts function access to the contract owner only + modifier onlyOwner() { + _checkOwner(); + _; + } - /// @notice Transfers ownership of the contract to a new account - /// @param account The address to transfer ownership to - function transferOwnership(address account) public payable virtual onlyOwner { - _checkNewOwner(account); - _setOwner(account); - } + /// @notice Transfers ownership of the contract to a new account + /// @param account The address to transfer ownership to + function transferOwnership(address account) public payable virtual onlyOwner { + _checkNewOwner(account); + _setOwner(account); + } - /// @notice Renounces ownership, leaving the contract without an owner - function renounceOwnership() public payable virtual onlyOwner { - _setOwner(address(0)); - } + /// @notice Renounces ownership, leaving the contract without an owner + function renounceOwnership() public payable virtual onlyOwner { + _setOwner(address(0)); + } - /// @notice Internal function to set the owner - function _setOwner(address account) internal virtual { - assembly ("memory-safe") { - // Clean the upper 96 bits of the address to ensure it's properly formatted - account := shr(0x60, shl(0x60, account)) - // Emit {OwnershipTransferred} event - log3(0x00, 0x00, OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(OWNER_SLOT), account) - // Store the new owner in the owner slot - sstore(OWNER_SLOT, or(account, shl(0xff, iszero(account)))) - } - } + /// @notice Internal function to set the owner + function _setOwner(address account) internal virtual { + assembly ("memory-safe") { + // Clean the upper 96 bits of the address to ensure it's properly formatted + account := shr(0x60, shl(0x60, account)) + // Emit {OwnershipTransferred} event + log3(0x00, 0x00, OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(OWNER_SLOT), account) + // Store the new owner in the owner slot + sstore(OWNER_SLOT, or(account, shl(0xff, iszero(account)))) + } + } - /// @notice Returns the address of the current owner - /// @return account The current owner address - function owner() public view virtual returns (address account) { - assembly ("memory-safe") { - account := sload(OWNER_SLOT) - } - } + /// @notice Returns the address of the current owner + /// @return account The current owner address + function owner() public view virtual returns (address account) { + assembly ("memory-safe") { + account := sload(OWNER_SLOT) + } + } - /// @notice Internal function to validate new owner address - function _checkNewOwner(address account) internal view virtual { - assembly ("memory-safe") { - if iszero(shl(0x60, account)) { - mstore(0x00, 0x54a56786) // InvalidNewOwner() - revert(0x1c, 0x04) - } - } - } + /// @notice Internal function to validate new owner address + function _checkNewOwner(address account) internal view virtual { + assembly ("memory-safe") { + if iszero(shl(0x60, account)) { + mstore(0x00, 0x54a56786) // InvalidNewOwner() + revert(0x1c, 0x04) + } + } + } - /// @notice Internal function to check if caller is the owner - function _checkOwner() internal view virtual { - assembly ("memory-safe") { - if iszero(eq(caller(), sload(OWNER_SLOT))) { - mstore(0x00, 0x32b2baa3) // UnauthorizedAccount(address) - mstore(0x20, caller()) - revert(0x1c, 0x24) - } - } - } + /// @notice Internal function to check if caller is the owner + function _checkOwner() internal view virtual { + assembly ("memory-safe") { + if iszero(eq(caller(), sload(OWNER_SLOT))) { + mstore(0x00, 0x32b2baa3) // UnauthorizedAccount(address) + mstore(0x20, caller()) + revert(0x1c, 0x24) + } + } + } } diff --git a/src/interfaces/IChainlinkRouter.sol b/src/interfaces/IChainlinkRouter.sol index e88f589..94d57ee 100644 --- a/src/interfaces/IChainlinkRouter.sol +++ b/src/interfaces/IChainlinkRouter.sol @@ -11,120 +11,120 @@ import {FeedConfig} from "src/types/FeedConfig.sol"; /// feed resolution and price path derivation using intermediate assets. /// @author fomoweth interface IChainlinkRouter { - /// @notice Thrown when attempting to register an asset that already exists - /// @param asset The address of the asset that already exists in the registry - error AssetAlreadyExists(address asset); - - /// @notice Thrown when attempting to operate on an asset that doesn't exist - /// @param asset The address of the asset that was not found in the registry - error AssetNotExists(address asset); - - /// @notice Thrown when the maximum number of supported assets is exceeded - /// @dev Current limit is 256 assets due to BitMap implementation constraints - error ExceededMaxAssets(); - - /// @notice Thrown when no price feed path can be found between two assets - /// @param base The base asset for which no path was found - /// @param quote The quote asset for which no path was found - error FeedNotFound(address base, address quote); - - /// @notice Thrown when base and quote assets are identical - /// @dev Price feeds require two different assets to form a valid trading pair - error IdenticalAssets(); - - /// @notice Thrown when an invalid asset address is provided - /// @dev Typically occurs when address(0) is used or other validation fails - error InvalidAsset(); - - /// @notice Thrown when an invalid feed address is provided - /// @dev Occurs when feed address is address(0) or fails other validation - error InvalidFeed(); - - /// @notice Emitted when a new asset is registered in the system - /// @param asset The address of the registered asset - /// @param assetId The unique identifier assigned to the asset (0-255) - event AssetAdded(address indexed asset, uint256 indexed assetId); - - /// @notice Emitted when an asset is removed from the system - /// @param asset The address of the removed asset - /// @param assetId The unique identifier that was assigned to the asset - event AssetRemoved(address indexed asset, uint256 indexed assetId); - - /// @notice Emitted when a new price feed is registered in the system - /// @param feed The address of the Chainlink aggregator contract - /// @param base The address of the base asset in the price pair - /// @param quote The address of the quote asset in the price pair - event FeedRegistered(address indexed feed, address indexed base, address indexed quote); - - /// @notice Emitted when a price feed is deregistered from the system - /// @param base The address of the base asset in the removed price pair - /// @param quote The address of the quote asset in the removed price pair - event FeedDeregistered(address indexed base, address indexed quote); - - /// @notice Queries optimal price path between two assets and returns the calculated price - /// @dev Uses breadth-first search algorithm to discover shortest routing path - /// Handles automatic intermediate asset discovery and price accumulation - /// @param base The base asset address to price - /// @param quote The quote asset address to price against - /// @return path Array of feed addresses used for price derivation - /// @return answer The calculated price after following the complete path - function query(address base, address quote) external view returns (address[] memory path, uint256 answer); - - /// @notice Returns the feed address for a specific asset pair (bidirectional lookup) - /// @dev Searches both base/quote and quote/base directions - /// @param base The base asset address - /// @param quote The quote asset address - /// @return feed The address of the Chainlink aggregator - function queryFeed(address base, address quote) external view returns (address feed); - - /// @notice Returns the feed address for a specific asset pair (unidirectional lookup) - /// @dev Only searches in the exact base/quote direction specified - /// @param base The base asset address - /// @param quote The quote asset address - /// @return feed The address of the Chainlink aggregator - function getFeed(address base, address quote) external view returns (address feed); - - /// @notice Returns the complete feed configuration for an asset pair - /// @param base The base asset address - /// @param quote The quote asset address - /// @return config The packed feed configuration containing all feed metadata - function getFeedConfiguration(address base, address quote) external view returns (FeedConfig config); - - /// @notice Returns the asset address from its unique identifier - /// @param id The asset identifier (0-255) - /// @return asset The address of the asset - function getAsset(uint256 id) external view returns (address asset); - - /// @notice Returns the BitMap configuration for an asset's connections - /// @dev Shows which other assets this asset has direct feeds with - /// @param asset The asset address to query - /// @return configuration The BitMap representing connected assets - function getAssetConfiguration(address asset) external view returns (BitMap configuration); - - /// @notice Returns the unique identifier for an asset - /// @param asset The asset address - /// @return id The unique identifier assigned to the asset - function getAssetId(address asset) external view returns (uint256 id); - - /// @notice Returns the total number of registered assets - /// @return The count of assets currently registered in the system - function numAssets() external view returns (uint256); - - /// @notice Registers new feeds in batch - /// @dev Processes feeds sequentially until all calldata is consumed - /// @param params Packed bytes containing feed configurations (20 bytes each for feed, base, quote) - function register(bytes calldata params) external payable; - - /// @notice Deregisters existing feeds in batch - /// @dev Removes feed configurations and cleans up unused assets - /// @param params Packed bytes containing asset pairs (20 bytes each for base, quote) - function deregister(bytes calldata params) external payable; - - /// @notice Registers a new asset in the system - /// @param asset The address of the asset to register - function registerAsset(address asset) external payable; - - /// @notice Deregisters an existing asset and removes all associated feeds from the system - /// @param asset The address of the asset to deregister - function deregisterAsset(address asset) external payable; + /// @notice Thrown when attempting to register an asset that already exists + /// @param asset The address of the asset that already exists in the registry + error AssetAlreadyExists(address asset); + + /// @notice Thrown when attempting to operate on an asset that doesn't exist + /// @param asset The address of the asset that was not found in the registry + error AssetNotExists(address asset); + + /// @notice Thrown when the maximum number of supported assets is exceeded + /// @dev Current limit is 256 assets due to BitMap implementation constraints + error ExceededMaxAssets(); + + /// @notice Thrown when no price feed path can be found between two assets + /// @param base The base asset for which no path was found + /// @param quote The quote asset for which no path was found + error FeedNotFound(address base, address quote); + + /// @notice Thrown when base and quote assets are identical + /// @dev Price feeds require two different assets to form a valid trading pair + error IdenticalAssets(); + + /// @notice Thrown when an invalid asset address is provided + /// @dev Typically occurs when address(0) is used or other validation fails + error InvalidAsset(); + + /// @notice Thrown when an invalid feed address is provided + /// @dev Occurs when feed address is address(0) or fails other validation + error InvalidFeed(); + + /// @notice Emitted when a new asset is registered in the system + /// @param asset The address of the registered asset + /// @param assetId The unique identifier assigned to the asset (0-255) + event AssetAdded(address indexed asset, uint256 indexed assetId); + + /// @notice Emitted when an asset is removed from the system + /// @param asset The address of the removed asset + /// @param assetId The unique identifier that was assigned to the asset + event AssetRemoved(address indexed asset, uint256 indexed assetId); + + /// @notice Emitted when a new price feed is registered in the system + /// @param feed The address of the Chainlink aggregator contract + /// @param base The address of the base asset in the price pair + /// @param quote The address of the quote asset in the price pair + event FeedRegistered(address indexed feed, address indexed base, address indexed quote); + + /// @notice Emitted when a price feed is deregistered from the system + /// @param base The address of the base asset in the removed price pair + /// @param quote The address of the quote asset in the removed price pair + event FeedDeregistered(address indexed base, address indexed quote); + + /// @notice Queries optimal price path between two assets and returns the calculated price + /// @dev Uses breadth-first search algorithm to discover shortest routing path + /// Handles automatic intermediate asset discovery and price accumulation + /// @param base The base asset address to price + /// @param quote The quote asset address to price against + /// @return path Array of feed addresses used for price derivation + /// @return answer The calculated price after following the complete path + function query(address base, address quote) external view returns (address[] memory path, uint256 answer); + + /// @notice Returns the feed address for a specific asset pair (bidirectional lookup) + /// @dev Searches both base/quote and quote/base directions + /// @param base The base asset address + /// @param quote The quote asset address + /// @return feed The address of the Chainlink aggregator + function queryFeed(address base, address quote) external view returns (address feed); + + /// @notice Returns the feed address for a specific asset pair (unidirectional lookup) + /// @dev Only searches in the exact base/quote direction specified + /// @param base The base asset address + /// @param quote The quote asset address + /// @return feed The address of the Chainlink aggregator + function getFeed(address base, address quote) external view returns (address feed); + + /// @notice Returns the complete feed configuration for an asset pair + /// @param base The base asset address + /// @param quote The quote asset address + /// @return config The packed feed configuration containing all feed metadata + function getFeedConfiguration(address base, address quote) external view returns (FeedConfig config); + + /// @notice Returns the asset address from its unique identifier + /// @param id The asset identifier (0-255) + /// @return asset The address of the asset + function getAsset(uint256 id) external view returns (address asset); + + /// @notice Returns the BitMap configuration for an asset's connections + /// @dev Shows which other assets this asset has direct feeds with + /// @param asset The asset address to query + /// @return configuration The BitMap representing connected assets + function getAssetConfiguration(address asset) external view returns (BitMap configuration); + + /// @notice Returns the unique identifier for an asset + /// @param asset The asset address + /// @return id The unique identifier assigned to the asset + function getAssetId(address asset) external view returns (uint256 id); + + /// @notice Returns the total number of registered assets + /// @return The count of assets currently registered in the system + function numAssets() external view returns (uint256); + + /// @notice Registers new feeds in batch + /// @dev Processes feeds sequentially until all calldata is consumed + /// @param params Packed bytes containing feed configurations (20 bytes each for feed, base, quote) + function register(bytes calldata params) external payable; + + /// @notice Deregisters existing feeds in batch + /// @dev Removes feed configurations and cleans up unused assets + /// @param params Packed bytes containing asset pairs (20 bytes each for base, quote) + function deregister(bytes calldata params) external payable; + + /// @notice Registers a new asset in the system + /// @param asset The address of the asset to register + function registerAsset(address asset) external payable; + + /// @notice Deregisters an existing asset and removes all associated feeds from the system + /// @param asset The address of the asset to deregister + function deregisterAsset(address asset) external payable; } diff --git a/src/interfaces/external/AggregatorInterface.sol b/src/interfaces/external/AggregatorInterface.sol index 54d2041..3831091 100644 --- a/src/interfaces/external/AggregatorInterface.sol +++ b/src/interfaces/external/AggregatorInterface.sol @@ -2,36 +2,37 @@ pragma solidity ^0.8.30; interface AggregatorInterface { - event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt); + event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt); - event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt); + event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt); - // V2 AggregatorInterface + // V2 AggregatorInterface - function latestAnswer() external view returns (int256); + function latestAnswer() external view returns (int256); - function latestTimestamp() external view returns (uint256); + function latestTimestamp() external view returns (uint256); - function latestRound() external view returns (uint256); + function latestRound() external view returns (uint256); - function getAnswer(uint256 roundId) external view returns (int256); + function getAnswer(uint256 roundId) external view returns (int256); - function getTimestamp(uint256 roundId) external view returns (uint256); + function getTimestamp(uint256 roundId) external view returns (uint256); - // V3 AggregatorV3Interface + // V3 AggregatorV3Interface - function decimals() external view returns (uint8); + function decimals() external view returns (uint8); - function description() external view returns (string memory); + function description() external view returns (string memory); - function version() external view returns (uint256); + function version() external view returns (uint256); - function getRoundData( - uint80 roundId - ) external view returns (uint80 round, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); + function getRoundData(uint80 roundId) + external + view + returns (uint80 round, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); - function latestRoundData() - external - view - returns (uint80 round, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); + function latestRoundData() + external + view + returns (uint80 round, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); } diff --git a/src/libraries/BytesParser.sol b/src/libraries/BytesParser.sol index 7820cb8..39ad5d0 100644 --- a/src/libraries/BytesParser.sol +++ b/src/libraries/BytesParser.sol @@ -4,88 +4,92 @@ pragma solidity ^0.8.30; /// @title BytesParser /// @notice Library for parsing packed address parameters from calldata library BytesParser { - /// @notice Thrown when attempting to parse beyond available calldata bounds - error SliceOutOfBounds(); + /// @notice Thrown when attempting to parse beyond available calldata bounds + error SliceOutOfBounds(); - /// @notice Parses a single address from the beginning of calldata - /// @dev Extracts 20 bytes (160 bits) from calldata and returns remaining data - /// @param params Input calldata to parse from - /// @return result The parsed address from bytes 0-19 - /// @return data Remaining calldata after consuming 20 bytes - function parseAddress(bytes calldata params) internal pure returns (address result, bytes calldata data) { - assembly ("memory-safe") { - // Check if input calldata contains at least 20 bytes (0x14) for one address - if lt(params.length, 0x14) { - mstore(0x00, 0x3b99b53d) // SliceOutOfBounds() - revert(0x1c, 0x04) - } + /// @notice Parses a single address from the beginning of calldata + /// @dev Extracts 20 bytes (160 bits) from calldata and returns remaining data + /// @param params Input calldata to parse from + /// @return result The parsed address from bytes 0-19 + /// @return data Remaining calldata after consuming 20 bytes + function parseAddress(bytes calldata params) internal pure returns (address result, bytes calldata data) { + assembly ("memory-safe") { + // Check if input calldata contains at least 20 bytes (0x14) for one address + if lt(params.length, 0x14) { + mstore(0x00, 0x3b99b53d) // SliceOutOfBounds() + revert(0x1c, 0x04) + } - // Extract address by right-shifting 96 bits (0x60) - result := shr(0x60, calldataload(params.offset)) + // Extract address by right-shifting 96 bits (0x60) + result := shr(0x60, calldataload(params.offset)) - // Update remaining data slice to point after consumed 20 bytes - data.offset := add(params.offset, 0x14) - data.length := sub(params.length, 0x14) - } - } + // Update remaining data slice to point after consumed 20 bytes + data.offset := add(params.offset, 0x14) + data.length := sub(params.length, 0x14) + } + } - /// @notice Parses two consecutive addresses representing an asset pair - /// @dev Extracts base and quote addresses (40 bytes total) from calldata and returns remaining data - /// @param params Input calldata to parse from - /// @return base The first address (bytes 0-19) representing base asset - /// @return quote The second address (bytes 20-39) representing quote asset - /// @return data Remaining calldata after consuming 40 bytes - function parseAssetPair( - bytes calldata params - ) internal pure returns (address base, address quote, bytes calldata data) { - assembly ("memory-safe") { - // Check if input calldata contains at least 40 bytes (0x28) for two addresses - if lt(params.length, 0x28) { - mstore(0x00, 0x3b99b53d) // SliceOutOfBounds() - revert(0x1c, 0x04) - } + /// @notice Parses two consecutive addresses representing an asset pair + /// @dev Extracts base and quote addresses (40 bytes total) from calldata and returns remaining data + /// @param params Input calldata to parse from + /// @return base The first address (bytes 0-19) representing base asset + /// @return quote The second address (bytes 20-39) representing quote asset + /// @return data Remaining calldata after consuming 40 bytes + function parseAssetPair(bytes calldata params) + internal + pure + returns (address base, address quote, bytes calldata data) + { + assembly ("memory-safe") { + // Check if input calldata contains at least 40 bytes (0x28) for two addresses + if lt(params.length, 0x28) { + mstore(0x00, 0x3b99b53d) // SliceOutOfBounds() + revert(0x1c, 0x04) + } - // Parse first address (base asset) - base := shr(0x60, calldataload(params.offset)) + // Parse first address (base asset) + base := shr(0x60, calldataload(params.offset)) - // Parse second address (quote asset) from offset + 20 bytes - quote := shr(0x60, calldataload(add(params.offset, 0x14))) + // Parse second address (quote asset) from offset + 20 bytes + quote := shr(0x60, calldataload(add(params.offset, 0x14))) - // Update remaining data slice to point after consumed 40 bytes - data.offset := add(params.offset, 0x28) - data.length := sub(params.length, 0x28) - } - } + // Update remaining data slice to point after consumed 40 bytes + data.offset := add(params.offset, 0x28) + data.length := sub(params.length, 0x28) + } + } - /// @notice Parses three consecutive addresses for feed configuration - /// @dev Extracts feed contract address and asset pair (60 bytes total) and returns remaining data - /// @param params Input calldata to parse from - /// @return feed The price feed contract address (bytes 0-19) - /// @return base The base asset address (bytes 20-39) - /// @return quote The quote asset address (bytes 40-59) - /// @return data Remaining calldata after consuming 60 bytes - function parseFeedParams( - bytes calldata params - ) internal pure returns (address feed, address base, address quote, bytes calldata data) { - assembly ("memory-safe") { - // Check if input calldata contains at least 60 bytes (0x3c) for three addresses - if lt(params.length, 0x3c) { - mstore(0x00, 0x3b99b53d) // SliceOutOfBounds() - revert(0x1c, 0x04) - } + /// @notice Parses three consecutive addresses for feed configuration + /// @dev Extracts feed contract address and asset pair (60 bytes total) and returns remaining data + /// @param params Input calldata to parse from + /// @return feed The price feed contract address (bytes 0-19) + /// @return base The base asset address (bytes 20-39) + /// @return quote The quote asset address (bytes 40-59) + /// @return data Remaining calldata after consuming 60 bytes + function parseFeedParams(bytes calldata params) + internal + pure + returns (address feed, address base, address quote, bytes calldata data) + { + assembly ("memory-safe") { + // Check if input calldata contains at least 60 bytes (0x3c) for three addresses + if lt(params.length, 0x3c) { + mstore(0x00, 0x3b99b53d) // SliceOutOfBounds() + revert(0x1c, 0x04) + } - // Parse feed contract address - feed := shr(0x60, calldataload(params.offset)) + // Parse feed contract address + feed := shr(0x60, calldataload(params.offset)) - // Parse base asset address from offset + 20 bytes - base := shr(0x60, calldataload(add(params.offset, 0x14))) + // Parse base asset address from offset + 20 bytes + base := shr(0x60, calldataload(add(params.offset, 0x14))) - // Parse quote asset address from offset + 40 bytes - quote := shr(0x60, calldataload(add(params.offset, 0x28))) + // Parse quote asset address from offset + 40 bytes + quote := shr(0x60, calldataload(add(params.offset, 0x28))) - // Update remaining data slice to point after consumed 60 bytes - data.offset := add(params.offset, 0x3c) - data.length := sub(params.length, 0x3c) - } - } + // Update remaining data slice to point after consumed 60 bytes + data.offset := add(params.offset, 0x3c) + data.length := sub(params.length, 0x3c) + } + } } diff --git a/src/libraries/Denominations.sol b/src/libraries/Denominations.sol index 9bc0f74..04c47df 100644 --- a/src/libraries/Denominations.sol +++ b/src/libraries/Denominations.sol @@ -5,50 +5,46 @@ pragma solidity ^0.8.30; /// @notice Conventional representation of non-ERC20 assets /// @dev Fiat currencies follow https://en.wikipedia.org/wiki/ISO_4217 library Denominations { - address internal constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; - address internal constant BTC = 0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB; - address internal constant USD = 0x0000000000000000000000000000000000000348; - address internal constant GBP = 0x000000000000000000000000000000000000033a; - address internal constant EUR = 0x00000000000000000000000000000000000003d2; - address internal constant JPY = 0x0000000000000000000000000000000000000188; - address internal constant KRW = 0x000000000000000000000000000000000000019a; - address internal constant CNY = 0x000000000000000000000000000000000000009c; - address internal constant AUD = 0x0000000000000000000000000000000000000024; - address internal constant CAD = 0x000000000000000000000000000000000000007c; - address internal constant CHF = 0x00000000000000000000000000000000000002F4; - address internal constant ARS = 0x0000000000000000000000000000000000000020; - address internal constant PHP = 0x0000000000000000000000000000000000000260; - address internal constant NZD = 0x000000000000000000000000000000000000022A; - address internal constant SGD = 0x00000000000000000000000000000000000002be; - address internal constant NGN = 0x0000000000000000000000000000000000000236; - address internal constant ZAR = 0x00000000000000000000000000000000000002c6; - address internal constant RUB = 0x0000000000000000000000000000000000000283; - address internal constant INR = 0x0000000000000000000000000000000000000164; - address internal constant BRL = 0x00000000000000000000000000000000000003Da; + address internal constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; + address internal constant BTC = 0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB; + address internal constant USD = 0x0000000000000000000000000000000000000348; + address internal constant GBP = 0x000000000000000000000000000000000000033a; + address internal constant EUR = 0x00000000000000000000000000000000000003d2; + address internal constant JPY = 0x0000000000000000000000000000000000000188; + address internal constant KRW = 0x000000000000000000000000000000000000019a; + address internal constant CNY = 0x000000000000000000000000000000000000009c; + address internal constant AUD = 0x0000000000000000000000000000000000000024; + address internal constant CAD = 0x000000000000000000000000000000000000007c; + address internal constant CHF = 0x00000000000000000000000000000000000002F4; + address internal constant ARS = 0x0000000000000000000000000000000000000020; + address internal constant PHP = 0x0000000000000000000000000000000000000260; + address internal constant NZD = 0x000000000000000000000000000000000000022A; + address internal constant SGD = 0x00000000000000000000000000000000000002be; + address internal constant NGN = 0x0000000000000000000000000000000000000236; + address internal constant ZAR = 0x00000000000000000000000000000000000002c6; + address internal constant RUB = 0x0000000000000000000000000000000000000283; + address internal constant INR = 0x0000000000000000000000000000000000000164; + address internal constant BRL = 0x00000000000000000000000000000000000003Da; - function decimals(address target) internal view returns (uint8 unit) { - assembly ("memory-safe") { - switch eq(target, ETH) - case 0x00 { - switch or(eq(target, USD), eq(target, BTC)) - case 0x00 { - mstore(0x00, 0x313ce567) // decimals() + function decimals(address target) internal view returns (uint8 result) { + assembly ("memory-safe") { + switch eq(target, ETH) + case 0x00 { + switch or(eq(target, USD), eq(target, BTC)) + case 0x00 { + mstore(0x00, 0x313ce567) // decimals() - if iszero(staticcall(gas(), target, 0x1c, 0x04, 0x00, 0x20)) { - let ptr := mload(0x40) - returndatacopy(ptr, 0x00, returndatasize()) - revert(ptr, returndatasize()) - } + if iszero(and(gt(returndatasize(), 0x1f), staticcall(gas(), target, 0x1c, 0x04, 0x00, 0x20))) { + let ptr := mload(0x40) + returndatacopy(ptr, 0x00, returndatasize()) + revert(ptr, returndatasize()) + } - unit := mload(0x00) - } - default { - unit := 8 - } - } - default { - unit := 18 - } - } - } + result := mload(0x00) + } + default { result := 8 } + } + default { result := 18 } + } + } } diff --git a/src/libraries/FullMath.sol b/src/libraries/FullMath.sol index e61cf2c..1d194d0 100644 --- a/src/libraries/FullMath.sol +++ b/src/libraries/FullMath.sol @@ -6,87 +6,85 @@ pragma solidity ^0.8.30; /// @dev Modified from https://github.com/Uniswap/v4-core/blob/main/src/libraries/FullMath.sol /// @author fomoweth library FullMath { - /// @notice Thrown when operation failed due to a division by zero - error DivisionByZero(); + /// @notice Thrown when operation failed due to a division by zero + error DivisionByZero(); - /// @notice Thrown when operation failed due to an overflow - error Overflow(); + /// @notice Thrown when operation failed due to an overflow + error Overflow(); - /// @notice Calculates floor(x*y÷d) with full precision - /// @dev Throws if result overflows a uint256 or d == 0 - /// @param x The multiplicand - /// @param y The multiplier - /// @param d The denominator - /// @return z The 256-bit result - function mulDiv(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) { - assembly ("memory-safe") { - // Check for division by zero - if iszero(d) { - mstore(0x00, 0x23d359a3) // DivisionByZero() - revert(0x1c, 0x04) - } + /// @notice Calculates floor(x*y÷d) with full precision + /// @dev Throws if result overflows a uint256 or d == 0 + /// @param x The multiplicand + /// @param y The multiplier + /// @param d The denominator + /// @return z The 256-bit result + function mulDiv(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) { + assembly ("memory-safe") { + // Check for division by zero + if iszero(d) { + mstore(0x00, 0x23d359a3) // DivisionByZero() + revert(0x1c, 0x04) + } - // Compute the 512-bit result of x * y - let mm := mulmod(x, y, not(0)) - let p0 := mul(x, y) // Least significant 256 bits of the product - let p1 := sub(sub(mm, p0), lt(mm, p0)) // Most significant 256 bits of the product + // Compute the 512-bit result of x * y + let mm := mulmod(x, y, not(0)) + let p0 := mul(x, y) // Least significant 256 bits of the product + let p1 := sub(sub(mm, p0), lt(mm, p0)) // Most significant 256 bits of the product - // Check for overflow - if iszero(lt(p1, d)) { - mstore(0x00, 0x35278d12) // Overflow() - revert(0x1c, 0x04) - } + // Check for overflow + if iszero(lt(p1, d)) { + mstore(0x00, 0x35278d12) // Overflow() + revert(0x1c, 0x04) + } - // If upper part is zero, result fits in 256 bits - switch iszero(p1) - // Handle overflow cases, 512 by 256 division - case 0 { - // Compute remainder using mulmod - let r := mulmod(x, y, d) - // Subtract 256-bit value from 512-bit value - p1 := sub(p1, gt(r, p0)) - p0 := sub(p0, r) - // Factor powers of two out of denominator - // This optimization reduces the division complexity - let t := and(d, sub(0, d)) - d := div(d, t) // Remove powers of two from denominator - // Compute modular inverse of denominator using Newton-Raphson iteration - let inv := xor(2, mul(3, d)) - // Six iterations of Newton-Raphson (sufficient for 256-bit numbers) - inv := mul(inv, sub(2, mul(d, inv))) // 8 bits of precision - inv := mul(inv, sub(2, mul(d, inv))) // 16 bits - inv := mul(inv, sub(2, mul(d, inv))) // 32 bits - inv := mul(inv, sub(2, mul(d, inv))) // 64 bits - inv := mul(inv, sub(2, mul(d, inv))) // 128 bits - inv := mul(inv, sub(2, mul(d, inv))) // 256 bits - // Compute final result: z = (p1 * (2^256 - t) / t + p0 / t) * inv - z := mul(or(mul(p1, add(div(sub(0, t), t), 1)), div(p0, t)), inv) - } - // Handle non-overflow cases, 256 by 256 division - default { - z := div(p0, d) - } - } - } + // If upper part is zero, result fits in 256 bits + switch iszero(p1) + // Handle overflow cases, 512 by 256 division + case 0 { + // Compute remainder using mulmod + let r := mulmod(x, y, d) + // Subtract 256-bit value from 512-bit value + p1 := sub(p1, gt(r, p0)) + p0 := sub(p0, r) + // Factor powers of two out of denominator + // This optimization reduces the division complexity + let t := and(d, sub(0, d)) + d := div(d, t) // Remove powers of two from denominator + // Compute modular inverse of denominator using Newton-Raphson iteration + let inv := xor(2, mul(3, d)) + // Six iterations of Newton-Raphson (sufficient for 256-bit numbers) + inv := mul(inv, sub(2, mul(d, inv))) // 8 bits of precision + inv := mul(inv, sub(2, mul(d, inv))) // 16 bits + inv := mul(inv, sub(2, mul(d, inv))) // 32 bits + inv := mul(inv, sub(2, mul(d, inv))) // 64 bits + inv := mul(inv, sub(2, mul(d, inv))) // 128 bits + inv := mul(inv, sub(2, mul(d, inv))) // 256 bits + // Compute final result: z = (p1 * (2^256 - t) / t + p0 / t) * inv + z := mul(or(mul(p1, add(div(sub(0, t), t), 1)), div(p0, t)), inv) + } + // Handle non-overflow cases, 256 by 256 division + default { z := div(p0, d) } + } + } - /// @notice Calculates ceil(x*y÷d) with full precision - /// @dev Throws if result overflows a uint256 or d == 0 - /// @param x The multiplicand - /// @param y The multiplier - /// @param d The denominator - /// @return z The 256-bit result rounded up - function mulDivRoundingUp(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) { - z = mulDiv(x, y, d); - assembly ("memory-safe") { - // If there's a remainder, add 1 to round up - if mulmod(x, y, d) { - z := add(z, 1) - // Check for overflow after increment - if iszero(z) { - mstore(0x00, 0x35278d12) // Overflow() - revert(0x1c, 0x04) - } - } - } - } + /// @notice Calculates ceil(x*y÷d) with full precision + /// @dev Throws if result overflows a uint256 or d == 0 + /// @param x The multiplicand + /// @param y The multiplier + /// @param d The denominator + /// @return z The 256-bit result rounded up + function mulDivRoundingUp(uint256 x, uint256 y, uint256 d) internal pure returns (uint256 z) { + z = mulDiv(x, y, d); + assembly ("memory-safe") { + // If there's a remainder, add 1 to round up + if mulmod(x, y, d) { + z := add(z, 1) + // Check for overflow after increment + if iszero(z) { + mstore(0x00, 0x35278d12) // Overflow() + revert(0x1c, 0x04) + } + } + } + } } diff --git a/src/libraries/PriceMath.sol b/src/libraries/PriceMath.sol index df3081b..b6a36c7 100644 --- a/src/libraries/PriceMath.sol +++ b/src/libraries/PriceMath.sol @@ -7,94 +7,92 @@ import {FullMath} from "./FullMath.sol"; /// @notice Provides utility functions for chaining, inverting, and normalizing price data /// @author fomoweth library PriceMath { - /// @notice Thrown when provided decimal parameters are zero - error InvalidDecimals(); + /// @notice Thrown when provided decimal parameters are zero + error InvalidDecimals(); - /// @notice Thrown when provided price is zero - error InvalidPrice(); + /// @notice Thrown when provided price is zero + error InvalidPrice(); - /// @notice Calculates derived price from two prices (basePrice / quotePrice) - /// @param basePrice The numerator price (e.g., ETH/USD price) - /// @param quotePrice The denominator price (e.g., BTC/USD price) - /// @param baseDecimals Current decimal places of the base price - /// @param quoteDecimals Current decimal places of the quote price - /// @param decimals Target decimal places for both normalization and final result - /// @return result The derived price with specified decimal places - function derive( - uint256 basePrice, - uint256 quotePrice, - uint8 baseDecimals, - uint8 quoteDecimals, - uint8 decimals - ) internal pure returns (uint256 result) { - unchecked { - result = FullMath.mulDiv( - normalize(basePrice, baseDecimals, decimals), - 10 ** decimals, - normalize(quotePrice, quoteDecimals, decimals) - ); - } - } + /// @notice Calculates derived price from two prices (basePrice / quotePrice) + /// @param basePrice The numerator price (e.g., ETH/USD price) + /// @param quotePrice The denominator price (e.g., BTC/USD price) + /// @param baseDecimals Current decimal places of the base price + /// @param quoteDecimals Current decimal places of the quote price + /// @param decimals Target decimal places for both normalization and final result + /// @return result The derived price with specified decimal places + function derive(uint256 basePrice, uint256 quotePrice, uint8 baseDecimals, uint8 quoteDecimals, uint8 decimals) + internal + pure + returns (uint256 result) + { + unchecked { + result = FullMath.mulDiv( + normalize(basePrice, baseDecimals, decimals), + 10 ** decimals, + normalize(quotePrice, quoteDecimals, decimals) + ); + } + } - /// @notice Calculates inverse price: if input price is A/B, returns B/A - /// @param price The original price to invert - /// @param baseDecimals Decimal places of the base asset in original price - /// @param quoteDecimals Decimal places of the quote asset in original price - /// @return result The inverted price maintaining proper decimal scaling - function invert(uint256 price, uint8 baseDecimals, uint8 quoteDecimals) internal pure returns (uint256 result) { - assembly ("memory-safe") { - // Validate price is not zero to prevent division by zero - if iszero(price) { - mstore(0x00, 0x00bfc921) // InvalidPrice() - revert(0x1c, 0x04) - } + /// @notice Calculates inverse price: if input price is A/B, returns B/A + /// @param price The original price to invert + /// @param baseDecimals Decimal places of the base asset in original price + /// @param quoteDecimals Decimal places of the quote asset in original price + /// @return result The inverted price maintaining proper decimal scaling + function invert(uint256 price, uint8 baseDecimals, uint8 quoteDecimals) internal pure returns (uint256 result) { + assembly ("memory-safe") { + // Validate price is not zero to prevent division by zero + if iszero(price) { + mstore(0x00, 0x00bfc921) // InvalidPrice() + revert(0x1c, 0x04) + } - // Validate decimals are not zero to prevent invalid scaling - if or(iszero(baseDecimals), iszero(quoteDecimals)) { - mstore(0x00, 0xd25598a0) // InvalidDecimals() - revert(0x1c, 0x04) - } + // Validate decimals are not zero to prevent invalid scaling + if or(iszero(baseDecimals), iszero(quoteDecimals)) { + mstore(0x00, 0xd25598a0) // InvalidDecimals() + revert(0x1c, 0x04) + } - // Calculate inverted price: 10**(baseDecimals + quoteDecimals) / price - result := div(exp(10, add(baseDecimals, quoteDecimals)), price) - } - } + // Calculate inverted price: 10**(baseDecimals + quoteDecimals) / price + result := div(exp(10, add(baseDecimals, quoteDecimals)), price) + } + } - /// @notice Normalizes price by converting from one decimal precision to another - /// @param price The price to normalize - /// @param fromDecimals Current decimal places of the price - /// @param toDecimals Target decimal places for the result - /// @return result The normalized price adjusted for decimal conversion - function normalize(uint256 price, uint8 fromDecimals, uint8 toDecimals) internal pure returns (uint256 result) { - assembly ("memory-safe") { - // Validate price is not zero - if iszero(price) { - mstore(0x00, 0x00bfc921) // InvalidPrice() - revert(0x1c, 0x04) - } + /// @notice Normalizes price by converting from one decimal precision to another + /// @param price The price to normalize + /// @param fromDecimals Current decimal places of the price + /// @param toDecimals Target decimal places for the result + /// @return result The normalized price adjusted for decimal conversion + function normalize(uint256 price, uint8 fromDecimals, uint8 toDecimals) internal pure returns (uint256 result) { + assembly ("memory-safe") { + // Validate price is not zero + if iszero(price) { + mstore(0x00, 0x00bfc921) // InvalidPrice() + revert(0x1c, 0x04) + } - // Validate decimals are not zero - if or(iszero(fromDecimals), iszero(toDecimals)) { - mstore(0x00, 0xd25598a0) // InvalidDecimals() - revert(0x1c, 0x04) - } + // Validate decimals are not zero + if or(iszero(fromDecimals), iszero(toDecimals)) { + mstore(0x00, 0xd25598a0) // InvalidDecimals() + revert(0x1c, 0x04) + } - switch eq(fromDecimals, toDecimals) - case 0x00 { - switch lt(fromDecimals, toDecimals) - case 0x00 { - // Scale down - result := div(price, exp(10, sub(fromDecimals, toDecimals))) - } - default { - // Scale up - result := mul(price, exp(10, sub(toDecimals, fromDecimals))) - } - } - default { - // No scaling needed - result := price - } - } - } + switch eq(fromDecimals, toDecimals) + case 0x00 { + switch lt(fromDecimals, toDecimals) + case 0x00 { + // Scale down + result := div(price, exp(10, sub(fromDecimals, toDecimals))) + } + default { + // Scale up + result := mul(price, exp(10, sub(toDecimals, fromDecimals))) + } + } + default { + // No scaling needed + result := price + } + } + } } diff --git a/src/types/BitMap.sol b/src/types/BitMap.sol index 7f2c737..9f39967 100644 --- a/src/types/BitMap.sol +++ b/src/types/BitMap.sol @@ -3,176 +3,192 @@ pragma solidity ^0.8.30; type BitMap is uint256; -using {eq as ==, neq as !=, gt as >, gte as >=, lt as <, lte as <=, and as &, or as |, xor as ^, not as ~} for BitMap global; +using { + eq as ==, + neq as !=, + gt as >, + gte as >=, + lt as <, + lte as <=, + and as &, + or as |, + xor as ^, + not as ~ +} for BitMap global; using BitMapLibrary for BitMap global; function eq(BitMap x, BitMap y) pure returns (bool z) { - assembly ("memory-safe") { - z := eq(x, y) - } + assembly ("memory-safe") { + z := eq(x, y) + } } function neq(BitMap x, BitMap y) pure returns (bool z) { - assembly ("memory-safe") { - z := iszero(eq(x, y)) - } + assembly ("memory-safe") { + z := iszero(eq(x, y)) + } } function gt(BitMap x, BitMap y) pure returns (bool z) { - assembly ("memory-safe") { - z := gt(x, y) - } + assembly ("memory-safe") { + z := gt(x, y) + } } function gte(BitMap x, BitMap y) pure returns (bool z) { - assembly ("memory-safe") { - z := iszero(lt(x, y)) - } + assembly ("memory-safe") { + z := iszero(lt(x, y)) + } } function lt(BitMap x, BitMap y) pure returns (bool z) { - assembly ("memory-safe") { - z := lt(x, y) - } + assembly ("memory-safe") { + z := lt(x, y) + } } function lte(BitMap x, BitMap y) pure returns (bool z) { - assembly ("memory-safe") { - z := iszero(gt(x, y)) - } + assembly ("memory-safe") { + z := iszero(gt(x, y)) + } } function and(BitMap x, BitMap y) pure returns (BitMap z) { - assembly ("memory-safe") { - z := and(x, y) - } + assembly ("memory-safe") { + z := and(x, y) + } } function or(BitMap x, BitMap y) pure returns (BitMap z) { - assembly ("memory-safe") { - z := or(x, y) - } + assembly ("memory-safe") { + z := or(x, y) + } } function xor(BitMap x, BitMap y) pure returns (BitMap z) { - assembly ("memory-safe") { - z := xor(x, y) - } + assembly ("memory-safe") { + z := xor(x, y) + } } function not(BitMap x) pure returns (BitMap z) { - assembly ("memory-safe") { - z := not(x) - } + assembly ("memory-safe") { + z := not(x) + } } /// @title BitMapLibrary /// @notice Bit-level manipulation utilities for a 256-bit BitMap /// @author fomoweth library BitMapLibrary { - /// @notice Sets the bit at a given index to 1 - /// @param x The input bitmap - /// @param index Bit position to set - /// @return z The updated bitmap - function set(BitMap x, uint256 index) internal pure returns (BitMap z) { - assembly ("memory-safe") { - z := or(x, shl(and(index, 0xff), 1)) - } - } - - /// @notice Clears the bit at a given index (set to 0) - /// @param x The input bitmap - /// @param index Bit position to unset - /// @return z The updated bitmap - function unset(BitMap x, uint256 index) internal pure returns (BitMap z) { - assembly ("memory-safe") { - z := and(x, not(shl(and(index, 0xff), 1))) - } - } - - /// @notice Sets a bit at the specified index to a specific value - /// @param x The input bitmap - /// @param index Bit position to set or unset (0~255) - /// @param value Whether to set (true) or unset (false) - /// @return z The updated bitmap - function setTo(BitMap x, uint256 index, bool value) internal pure returns (BitMap z) { - assembly ("memory-safe") { - let mask := and(index, 0xff) - z := or(and(x, not(shl(mask, 1))), shl(mask, iszero(iszero(value)))) - } - } - - /// @notice Toggles the bit at a given index (flip 1 ↔ 0) - /// @param x The input bitmap - /// @param index Bit position to toggle - /// @return z The updated bitmap - function toggle(BitMap x, uint256 index) internal pure returns (BitMap z) { - assembly ("memory-safe") { - let mask := and(index, 0xff) - z := or(and(x, not(shl(mask, 1))), shl(mask, iszero(and(x, shl(mask, 1))))) - } - } - - /// @notice Reads the bit at a given index - /// @param x The input bitmap - /// @param index Bit position to check - /// @return z True if bit is set, false otherwise - function get(BitMap x, uint256 index) internal pure returns (bool z) { - assembly ("memory-safe") { - z := and(x, shl(and(index, 0xff), 1)) - } - } - - /// @notice Counts the number of bits set to 1 in the bitmap - /// @param x The input bitmap - /// @return z Number of bits set (0~256) - function count(BitMap x) internal pure returns (uint256 z) { - assembly ("memory-safe") { - z := sub(x, and(shr(1, x), 0x5555555555555555555555555555555555555555555555555555555555555555)) - z := add(and(z, 0x3333333333333333333333333333333333333333333333333333333333333333), - and(shr(2, z), 0x3333333333333333333333333333333333333333333333333333333333333333)) - z := and(add(z, shr(4, z)), 0xF0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F) - z := or(shl(8, eq(x, not(0))), shr(248, mul(z, 0x101010101010101010101010101010101010101010101010101010101010101))) - } - } - - /// @notice Finds the index of the least significant bit set to 1, reverting if `x` is empty - /// @param x The input bitmap - /// @return z The index (0~255) of the first set bit - function findFirstSet(BitMap x) internal pure returns (uint256 z) { - assembly ("memory-safe") { - if iszero(x) { revert(0, 0) } - x := and(x, sub(0, x)) + /// @notice Sets the bit at a given index to 1 + /// @param x The input bitmap + /// @param index Bit position to set + /// @return z The updated bitmap + function set(BitMap x, uint256 index) internal pure returns (BitMap z) { + assembly ("memory-safe") { + z := or(x, shl(and(index, 0xff), 1)) + } + } + + /// @notice Clears the bit at a given index (set to 0) + /// @param x The input bitmap + /// @param index Bit position to unset + /// @return z The updated bitmap + function unset(BitMap x, uint256 index) internal pure returns (BitMap z) { + assembly ("memory-safe") { + z := and(x, not(shl(and(index, 0xff), 1))) + } + } + + /// @notice Sets a bit at the specified index to a specific value + /// @param x The input bitmap + /// @param index Bit position to set or unset (0~255) + /// @param value Whether to set (true) or unset (false) + /// @return z The updated bitmap + function setTo(BitMap x, uint256 index, bool value) internal pure returns (BitMap z) { + assembly ("memory-safe") { + let mask := and(index, 0xff) + z := or(and(x, not(shl(mask, 1))), shl(mask, iszero(iszero(value)))) + } + } + + /// @notice Toggles the bit at a given index (flip 1 ↔ 0) + /// @param x The input bitmap + /// @param index Bit position to toggle + /// @return z The updated bitmap + function toggle(BitMap x, uint256 index) internal pure returns (BitMap z) { + assembly ("memory-safe") { + let mask := and(index, 0xff) + z := or(and(x, not(shl(mask, 1))), shl(mask, iszero(and(x, shl(mask, 1))))) + } + } + + /// @notice Reads the bit at a given index + /// @param x The input bitmap + /// @param index Bit position to check + /// @return z True if bit is set, false otherwise + function get(BitMap x, uint256 index) internal pure returns (bool z) { + assembly ("memory-safe") { + z := and(x, shl(and(index, 0xff), 1)) + } + } + + /// @notice Counts the number of bits set to 1 in the bitmap + /// @param x The input bitmap + /// @return z Number of bits set (0~256) + function count(BitMap x) internal pure returns (uint256 z) { + assembly ("memory-safe") { + z := sub(x, and(shr(1, x), 0x5555555555555555555555555555555555555555555555555555555555555555)) + // forgefmt: disable-next-item + z := add(and(z, 0x3333333333333333333333333333333333333333333333333333333333333333), + and(shr(2, z), 0x3333333333333333333333333333333333333333333333333333333333333333)) + z := and(add(z, shr(4, z)), 0xF0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F) + // forgefmt: disable-next-item + z := or(shl(8, eq(x, not(0))), shr(248, mul(z, 0x101010101010101010101010101010101010101010101010101010101010101))) + } + } + + /// @notice Finds the index of the least significant bit set to 1, reverting if `x` is empty + /// @param x The input bitmap + /// @return z The index (0~255) of the first set bit + function findFirstSet(BitMap x) internal pure returns (uint256 z) { + assembly ("memory-safe") { + if iszero(x) { revert(0, 0) } + x := and(x, sub(0, x)) + // forgefmt: disable-next-item z := shl(5, shr(252, shl(shl(2, shr(250, mul(x, 0xb6db6db6ddddddddd34d34d349249249210842108c6318c639ce739cffffffff))), 0x8040405543005266443200005020610674053026020000107506200176117077))) + // forgefmt: disable-next-item z := or(z, byte(and(div(0xd76453e0, shr(z, x)), 0x1f), 0x001f0d1e100c1d070f090b19131c1706010e11080a1a141802121b1503160405)) - } - } - - /// @notice Finds the index of the most significant bit set to 1, reverting if `x` is empty - /// @param x The input bitmap - /// @return z The index (0~255) of the last set bit - function findLastSet(BitMap x) internal pure returns (uint256 z) { - assembly ("memory-safe") { - if iszero(x) { revert(0, 0) } - z := shl(7, lt(0xffffffffffffffffffffffffffffffff, x)) - z := or(z, shl(6, lt(0xffffffffffffffff, shr(z, x)))) - z := or(z, shl(5, lt(0xffffffff, shr(z, x)))) - z := or(z, shl(4, lt(0xffff, shr(z, x)))) - z := or(z, shl(3, lt(0xff, shr(z, x)))) - z := or(z, byte(and(0x1f, shr(shr(z, x), 0x8421084210842108cc6318c6db6d54be)), + } + } + + /// @notice Finds the index of the most significant bit set to 1, reverting if `x` is empty + /// @param x The input bitmap + /// @return z The index (0~255) of the last set bit + function findLastSet(BitMap x) internal pure returns (uint256 z) { + assembly ("memory-safe") { + if iszero(x) { revert(0, 0) } + z := shl(7, lt(0xffffffffffffffffffffffffffffffff, x)) + z := or(z, shl(6, lt(0xffffffffffffffff, shr(z, x)))) + z := or(z, shl(5, lt(0xffffffff, shr(z, x)))) + z := or(z, shl(4, lt(0xffff, shr(z, x)))) + z := or(z, shl(3, lt(0xff, shr(z, x)))) + // forgefmt: disable-next-item + z := or(z, byte(and(0x1f, shr(shr(z, x), 0x8421084210842108cc6318c6db6d54be)), 0x0706060506020504060203020504030106050205030304010505030400000000)) - } - } - - /// @notice Checks if the bitmap is empty (all bits unset) - /// @param x The input bitmap - /// @return z True if x == 0, false otherwise - function isZero(BitMap x) internal pure returns (bool z) { - assembly ("memory-safe") { - z := iszero(x) - } - } + } + } + + /// @notice Checks if the bitmap is empty (all bits unset) + /// @param x The input bitmap + /// @return z True if x == 0, false otherwise + function isZero(BitMap x) internal pure returns (bool z) { + assembly ("memory-safe") { + z := iszero(x) + } + } } diff --git a/src/types/FeedConfig.sol b/src/types/FeedConfig.sol index 6909f78..cd4232c 100644 --- a/src/types/FeedConfig.sol +++ b/src/types/FeedConfig.sol @@ -3,7 +3,6 @@ pragma solidity ^0.8.30; type FeedConfig is uint256; -using {eq as ==, neq as !=, gt as >, gte as >=, lt as <, lte as <=, and as &, or as |, xor as ^, not as ~} for FeedConfig global; using FeedConfigLibrary for FeedConfig global; /// @notice Packs multiple feed-related parameters into a single FeedConfig @@ -19,140 +18,78 @@ using FeedConfigLibrary for FeedConfig global; /// @param baseDecimals Number of decimal places for the base asset /// @param quoteId Unique identifier for the quote asset /// @param quoteDecimals Number of decimal places for the quote asset -/// @return configuration FeedConfig with all information packed -function toFeedConfig( - address feed, - uint8 baseId, - uint8 baseDecimals, - uint8 quoteId, - uint8 quoteDecimals -) pure returns (FeedConfig configuration) { - assembly ("memory-safe") { - configuration := or( - or( - or(shl(184, and(0xff, quoteDecimals)), shl(176, and(0xff, quoteId))), - or(shl(168, and(0xff, baseDecimals)), shl(160, and(0xff, baseId))) - ), - and(0xffffffffffffffffffffffffffffffffffffffff, feed) - ) - } -} - -function eq(FeedConfig x, FeedConfig y) pure returns (bool z) { - assembly ("memory-safe") { - z := eq(x, y) - } -} - -function neq(FeedConfig x, FeedConfig y) pure returns (bool z) { - assembly ("memory-safe") { - z := iszero(eq(x, y)) - } -} - -function gt(FeedConfig x, FeedConfig y) pure returns (bool z) { - assembly ("memory-safe") { - z := gt(x, y) - } -} - -function gte(FeedConfig x, FeedConfig y) pure returns (bool z) { - assembly ("memory-safe") { - z := iszero(lt(x, y)) - } -} - -function lt(FeedConfig x, FeedConfig y) pure returns (bool z) { - assembly ("memory-safe") { - z := lt(x, y) - } -} - -function lte(FeedConfig x, FeedConfig y) pure returns (bool z) { - assembly ("memory-safe") { - z := iszero(gt(x, y)) - } -} - -function and(FeedConfig x, FeedConfig y) pure returns (FeedConfig z) { - assembly ("memory-safe") { - z := and(x, y) - } -} - -function or(FeedConfig x, FeedConfig y) pure returns (FeedConfig z) { - assembly ("memory-safe") { - z := or(x, y) - } -} - -function xor(FeedConfig x, FeedConfig y) pure returns (FeedConfig z) { - assembly ("memory-safe") { - z := xor(x, y) - } -} - -function not(FeedConfig x) pure returns (FeedConfig z) { - assembly ("memory-safe") { - z := not(x) - } +/// @return result FeedConfig with all information packed +function toFeedConfig(address feed, uint8 baseId, uint8 baseDecimals, uint8 quoteId, uint8 quoteDecimals) + pure + returns (FeedConfig result) +{ + assembly ("memory-safe") { + result := + or( + or( + or(shl(184, and(0xff, quoteDecimals)), shl(176, and(0xff, quoteId))), + or(shl(168, and(0xff, baseDecimals)), shl(160, and(0xff, baseId))) + ), + and(0xffffffffffffffffffffffffffffffffffffffff, feed) + ) + } } /// @title FeedConfigLibrary /// @notice Provides utility functions to extract individual data from packed FeedConfig /// @author fomoweth library FeedConfigLibrary { - /// @notice Extracts feed contract address from bits 0-159 - /// @param self Target FeedConfig - /// @return result Address of the feed contract - function feed(FeedConfig self) internal pure returns (address result) { - assembly ("memory-safe") { - result := and(0xffffffffffffffffffffffffffffffffffffffff, self) - } - } - - /// @notice Extracts base asset ID from bits 168-183 - /// @param self Target FeedConfig - /// @return result Unique identifier of the base asset - function baseId(FeedConfig self) internal pure returns (uint8 result) { - assembly ("memory-safe") { - result := and(0xff, shr(160, self)) - } - } - - /// @notice Extracts base asset decimal places from from bits 184-191 - /// @param self Target FeedConfig - /// @return result Number of decimal places for the base asset - function baseDecimals(FeedConfig self) internal pure returns (uint8 result) { - assembly ("memory-safe") { - result := and(0xff, shr(168, self)) - } - } - - /// @notice Extracts quote asset ID from bits 192-207 - /// @param self Target FeedConfig - /// @return result Unique identifier of the quote asset - function quoteId(FeedConfig self) internal pure returns (uint8 result) { - assembly ("memory-safe") { - result := and(0xff, shr(176, self)) - } - } - - /// @notice Extracts quote asset decimal places from bits 208-215 - /// @param self Target FeedConfig - /// @return result Number of decimal places for the quote asset - function quoteDecimals(FeedConfig self) internal pure returns (uint8 result) { - assembly ("memory-safe") { - result := and(0xff, shr(184, self)) - } - } - - /// @notice Checks if FeedConfig is empty (zero) - /// @param self FeedConfig to check - /// @return result True if FeedConfig is zero, false otherwise - function isZero(FeedConfig self) internal pure returns (bool result) { - assembly ("memory-safe") { - result := iszero(self) - } - } + /// @notice Extracts feed contract address from bits 0-159 + /// @param self Target FeedConfig + /// @return result Address of the feed contract + function feed(FeedConfig self) internal pure returns (address result) { + assembly ("memory-safe") { + result := and(0xffffffffffffffffffffffffffffffffffffffff, self) + } + } + + /// @notice Extracts base asset ID from bits 168-183 + /// @param self Target FeedConfig + /// @return result Unique identifier of the base asset + function baseId(FeedConfig self) internal pure returns (uint8 result) { + assembly ("memory-safe") { + result := and(0xff, shr(160, self)) + } + } + + /// @notice Extracts base asset decimal places from from bits 184-191 + /// @param self Target FeedConfig + /// @return result Number of decimal places for the base asset + function baseDecimals(FeedConfig self) internal pure returns (uint8 result) { + assembly ("memory-safe") { + result := and(0xff, shr(168, self)) + } + } + + /// @notice Extracts quote asset ID from bits 192-207 + /// @param self Target FeedConfig + /// @return result Unique identifier of the quote asset + function quoteId(FeedConfig self) internal pure returns (uint8 result) { + assembly ("memory-safe") { + result := and(0xff, shr(176, self)) + } + } + + /// @notice Extracts quote asset decimal places from bits 208-215 + /// @param self Target FeedConfig + /// @return result Number of decimal places for the quote asset + function quoteDecimals(FeedConfig self) internal pure returns (uint8 result) { + assembly ("memory-safe") { + result := and(0xff, shr(184, self)) + } + } + + /// @notice Checks if FeedConfig is empty (zero) + /// @param self FeedConfig to check + /// @return result True if FeedConfig is zero, false otherwise + function isZero(FeedConfig self) internal pure returns (bool result) { + assembly ("memory-safe") { + result := iszero(self) + } + } } diff --git a/test/ChainlinkRouter.t.sol b/test/ChainlinkRouter.t.sol index 1c52ac9..5d0f28c 100644 --- a/test/ChainlinkRouter.t.sol +++ b/test/ChainlinkRouter.t.sol @@ -16,506 +16,473 @@ import {Chains} from "test/shared/helpers/Chains.sol"; import {SolArray} from "test/shared/helpers/SolArray.sol"; contract ChainlinkRouterTest is Test, BaseTest { - using Chains for Vm; - using Denominations for address; - - function setUp() public virtual override { - super.setUp(); - - bytes memory params = abi.encodePacked( - ETH_USD, - WETH, - USD, - BTC_USD, - WBTC, - USD, - USDC_USD, - USDC, - USD, - USDT_USD, - USDT, - USD - ); - - router.register(params); - } - - function test_chainAgnosticAddressing() public { - revertToState(); - - vm.selectChain(Chains.ETHEREUM, ETHEREUM_FORK_BLOCK); - address eth = deployRouter(address(this), proxyOwner, bytes32(0)); - assertTrue(eth.code.length != 0); - - vm.selectChain(Chains.OPTIMISM, OPTIMISM_FORK_BLOCK); - address opt = deployRouter(address(this), proxyOwner, bytes32(0)); - assertTrue(opt.code.length != 0); - - vm.selectChain(Chains.POLYGON, POLYGON_FORK_BLOCK); - address pol = deployRouter(address(this), proxyOwner, bytes32(0)); - assertTrue(pol.code.length != 0); - - vm.selectChain(Chains.BASE, BASE_FORK_BLOCK); - address base = deployRouter(address(this), proxyOwner, bytes32(0)); - assertTrue(base.code.length != 0); - - vm.selectChain(Chains.ARBITRUM, ARBITRUM_FORK_BLOCK); - address arb = deployRouter(address(this), proxyOwner, bytes32(0)); - assertTrue(arb.code.length != 0); - - assertEq(eth, opt); - assertEq(eth, pol); - assertEq(eth, base); - assertEq(eth, arb); - } - - function test_constructor() public view { - assertEq(uint256(vm.load(address(logic), INITIALIZED_SLOT)), type(uint64).max); - assertEq(logic.owner(), address(0)); - assertEq(logic.numAssets(), 0); - } - - function test_initialize() public view { - assertEq(router.owner(), address(this)); - assertEq(router.numAssets(), 5); - assertEq(router.getAssetId(USD), 0); - assertEq(router.getAsset(0), USD); - - address[] memory feeds = SolArray.addresses(ETH_USD, BTC_USD, USDC_USD, USDT_USD); - address[] memory assets = SolArray.addresses(WETH, WBTC, USDC, USDT); - - for (uint256 i; i < feeds.length; ++i) { - assertEq(router.getAssetId(assets[i]), i + 1); - assertEq(router.getAsset(i + 1), assets[i]); - assertEq(router.getFeed(assets[i], USD), feeds[i]); - } - } - - function test_initialize_revertsOnReinitialization() public { - vm.expectRevert(Initializable.InvalidInitialization.selector); - router.initialize(address(this)); - } + using Chains for Vm; + using Denominations for address; + + function setUp() public virtual override { + super.setUp(); + + bytes memory params = abi.encodePacked( + ETH_USD, + WETH, + Denominations.USD, + BTC_USD, + WBTC, + Denominations.USD, + USDC_USD, + USDC, + Denominations.USD, + USDT_USD, + USDT, + Denominations.USD + ); + + router.register(params); + } + + function test_chainAgnosticAddressing() public { + revertToState(); + + vm.selectChain(Chains.ETHEREUM, ETHEREUM_FORK_BLOCK); + address eth = deployRouter(address(this), proxyOwner, bytes32(0)); + assertTrue(eth.code.length != 0); + + vm.selectChain(Chains.OPTIMISM, OPTIMISM_FORK_BLOCK); + address opt = deployRouter(address(this), proxyOwner, bytes32(0)); + assertTrue(opt.code.length != 0); + + vm.selectChain(Chains.POLYGON, POLYGON_FORK_BLOCK); + address pol = deployRouter(address(this), proxyOwner, bytes32(0)); + assertTrue(pol.code.length != 0); + + vm.selectChain(Chains.BASE, BASE_FORK_BLOCK); + address base = deployRouter(address(this), proxyOwner, bytes32(0)); + assertTrue(base.code.length != 0); + + vm.selectChain(Chains.ARBITRUM, ARBITRUM_FORK_BLOCK); + address arb = deployRouter(address(this), proxyOwner, bytes32(0)); + assertTrue(arb.code.length != 0); + + assertEq(eth, opt); + assertEq(eth, pol); + assertEq(eth, base); + assertEq(eth, arb); + } + + function test_constructor() public view { + assertEq(uint256(vm.load(address(logic), INITIALIZED_SLOT)), type(uint64).max); + assertEq(logic.owner(), address(0)); + assertEq(logic.numAssets(), 0); + } + + function test_initialize() public view { + assertEq(router.owner(), address(this)); + assertEq(router.numAssets(), 5); + assertEq(router.getAssetId(Denominations.USD), 0); + assertEq(router.getAsset(0), Denominations.USD); + + address[] memory feeds = SolArray.addresses(ETH_USD, BTC_USD, USDC_USD, USDT_USD); + address[] memory assets = SolArray.addresses(WETH, WBTC, USDC, USDT); + + for (uint256 i; i < feeds.length; ++i) { + assertEq(router.getAssetId(assets[i]), i + 1); + assertEq(router.getAsset(i + 1), assets[i]); + assertEq(router.getFeed(assets[i], Denominations.USD), feeds[i]); + } + } + + function test_initialize_revertsOnReinitialization() public { + vm.expectRevert(Initializable.InvalidInitialization.selector); + router.initialize(address(this)); + } - function test_registerAsset() public { - uint256 initialCount = router.numAssets(); + function test_registerAsset() public { + uint256 initialCount = router.numAssets(); - vm.expectEmit(true, true, true, true, address(router)); - emit IChainlinkRouter.AssetAdded(LINK, initialCount); + vm.expectEmit(true, true, true, true, address(router)); + emit IChainlinkRouter.AssetAdded(LINK, initialCount); - router.registerAsset(LINK); + router.registerAsset(LINK); - assertEq(router.getAssetId(LINK), initialCount); - assertEq(router.getAsset(initialCount), LINK); - assertEq(router.numAssets(), initialCount + 1); + assertEq(router.getAssetId(LINK), initialCount); + assertEq(router.getAsset(initialCount), LINK); + assertEq(router.numAssets(), initialCount + 1); - vm.expectRevert(abi.encodeWithSelector(IChainlinkRouter.AssetAlreadyExists.selector, LINK)); - router.registerAsset(LINK); - } + vm.expectRevert(abi.encodeWithSelector(IChainlinkRouter.AssetAlreadyExists.selector, LINK)); + router.registerAsset(LINK); + } - function test_registerAsset_revertsOnExceededMaxAssets() public { - vm.expectEmit(true, true, true, true, address(router)); + function test_registerAsset_revertsOnExceededMaxAssets() public { + vm.expectEmit(true, true, true, true, address(router)); - for (uint256 i = router.numAssets(); i < 256; ++i) { - address asset = address(uint160(i)); - emit IChainlinkRouter.AssetAdded(asset, i); - router.registerAsset(asset); - } - - vm.expectRevert(IChainlinkRouter.ExceededMaxAssets.selector); - router.registerAsset(LINK); - } - - function test_registerAsset_revertsOnInvalidAsset() public { - vm.expectRevert(IChainlinkRouter.InvalidAsset.selector); - router.registerAsset(address(0)); - } + for (uint256 i = router.numAssets(); i < 256; ++i) { + address asset = address(uint160(i)); + emit IChainlinkRouter.AssetAdded(asset, i); + router.registerAsset(asset); + } - function test_registerAsset_revertsIfUnauthorized() public impersonate(unknown) { - vm.expectRevert(abi.encodeWithSelector(Ownable.UnauthorizedAccount.selector, unknown)); - router.registerAsset(LINK); - } + vm.expectRevert(IChainlinkRouter.ExceededMaxAssets.selector); + router.registerAsset(LINK); + } - function test_deregisterAsset() public { - vm.expectRevert(abi.encodeWithSelector(IChainlinkRouter.AssetNotExists.selector, LINK)); - router.deregisterAsset(LINK); + function test_registerAsset_revertsOnInvalidAsset() public { + vm.expectRevert(IChainlinkRouter.InvalidAsset.selector); + router.registerAsset(address(0)); + } - router.registerAsset(LINK); + function test_registerAsset_revertsIfUnauthorized() public impersonate(unknown) { + vm.expectRevert(abi.encodeWithSelector(Ownable.UnauthorizedAccount.selector, unknown)); + router.registerAsset(LINK); + } - uint256 initialCount = router.numAssets(); - uint256 assetId = router.getAssetId(LINK); + function test_deregisterAsset() public { + vm.expectRevert(abi.encodeWithSelector(IChainlinkRouter.AssetNotExists.selector, LINK)); + router.deregisterAsset(LINK); - vm.expectEmit(true, true, true, true, address(router)); - emit IChainlinkRouter.AssetRemoved(LINK, assetId); + router.registerAsset(LINK); - router.deregisterAsset(LINK); + uint256 initialCount = router.numAssets(); + uint256 assetId = router.getAssetId(LINK); - assertEq(router.getAssetId(LINK), 0); - assertEq(router.getAsset(assetId), address(0)); - assertEq(router.numAssets(), initialCount - 1); - } + vm.expectEmit(true, true, true, true, address(router)); + emit IChainlinkRouter.AssetRemoved(LINK, assetId); - function test_deregisterAsset_revertsOnInvalidAsset() public { - vm.expectRevert(IChainlinkRouter.InvalidAsset.selector); - router.deregisterAsset(address(0)); + router.deregisterAsset(LINK); - vm.expectRevert(IChainlinkRouter.InvalidAsset.selector); - router.deregisterAsset(USD); - } + assertEq(router.getAssetId(LINK), 0); + assertEq(router.getAsset(assetId), address(0)); + assertEq(router.numAssets(), initialCount - 1); + } - function test_deregisterAsset_revertsIfUnauthorized() public impersonate(unknown) { - vm.expectRevert(abi.encodeWithSelector(Ownable.UnauthorizedAccount.selector, unknown)); - router.deregisterAsset(LINK); - } + function test_deregisterAsset_revertsOnInvalidAsset() public { + vm.expectRevert(IChainlinkRouter.InvalidAsset.selector); + router.deregisterAsset(address(0)); - function test_register() public { - uint256 initialCount = router.numAssets(); + vm.expectRevert(IChainlinkRouter.InvalidAsset.selector); + router.deregisterAsset(Denominations.USD); + } - vm.expectEmit(true, true, true, true, address(router)); - emit IChainlinkRouter.AssetAdded(LINK, initialCount); - emit IChainlinkRouter.FeedRegistered(LINK_ETH, LINK, WETH); + function test_deregisterAsset_revertsIfUnauthorized() public impersonate(unknown) { + vm.expectRevert(abi.encodeWithSelector(Ownable.UnauthorizedAccount.selector, unknown)); + router.deregisterAsset(LINK); + } - router.register(abi.encodePacked(LINK_ETH, LINK, WETH)); + function test_register() public { + uint256 initialCount = router.numAssets(); - assertEq(router.getAssetId(LINK), initialCount); - assertEq(router.getAsset(initialCount), LINK); - assertEq(router.getFeed(LINK, WETH), LINK_ETH); + vm.expectEmit(true, true, true, true, address(router)); + emit IChainlinkRouter.AssetAdded(LINK, initialCount); + emit IChainlinkRouter.FeedRegistered(LINK_ETH, LINK, WETH); - emit IChainlinkRouter.FeedRegistered(LINK_USD, LINK, USD); + router.register(abi.encodePacked(LINK_ETH, LINK, WETH)); - router.register(abi.encodePacked(LINK_USD, LINK, USD)); + assertEq(router.getAssetId(LINK), initialCount); + assertEq(router.getAsset(initialCount), LINK); + assertEq(router.getFeed(LINK, WETH), LINK_ETH); - assertEq(router.getFeed(LINK, USD), LINK_USD); - assertEq(router.numAssets(), initialCount + 1); - } + emit IChainlinkRouter.FeedRegistered(LINK_USD, LINK, Denominations.USD); - function test_register_multipleFeeds() public { - address[] memory feeds = SolArray.addresses(AAVE_ETH, COMP_ETH, LINK_ETH, UNI_ETH); - address[] memory assets = SolArray.addresses(AAVE, COMP, LINK, UNI); + router.register(abi.encodePacked(LINK_USD, LINK, Denominations.USD)); - uint256 initialCount = router.numAssets(); + assertEq(router.getFeed(LINK, Denominations.USD), LINK_USD); + assertEq(router.numAssets(), initialCount + 1); + } - vm.expectEmit(true, true, true, true, address(router)); + function test_register_multipleFeeds() public { + address[] memory feeds = SolArray.addresses(AAVE_ETH, COMP_ETH, LINK_ETH, UNI_ETH); + address[] memory assets = SolArray.addresses(AAVE, COMP, LINK, UNI); - bytes memory params; - for (uint256 i; i < feeds.length; ++i) { - emit IChainlinkRouter.FeedRegistered(feeds[i], assets[i], WETH); - params = abi.encodePacked(params, feeds[i], assets[i], WETH); - } + uint256 initialCount = router.numAssets(); - router.register(params); + vm.expectEmit(true, true, true, true, address(router)); - for (uint256 i; i < feeds.length; ++i) { - assertEq(router.getFeed(assets[i], WETH), feeds[i]); - } + bytes memory params; + for (uint256 i; i < feeds.length; ++i) { + emit IChainlinkRouter.FeedRegistered(feeds[i], assets[i], WETH); + params = abi.encodePacked(params, feeds[i], assets[i], WETH); + } - assertEq(router.numAssets(), initialCount + assets.length); - } + router.register(params); - function test_register_all() public { - revertToState(); + for (uint256 i; i < feeds.length; ++i) { + assertEq(router.getFeed(assets[i], WETH), feeds[i]); + } - uint256[] memory chainIds = SolArray.uint256s( - Chains.ETHEREUM, - Chains.OPTIMISM, - Chains.POLYGON, - Chains.BASE, - Chains.ARBITRUM - ); + assertEq(router.numAssets(), initialCount + assets.length); + } - uint256[] memory blockNumbers = SolArray.uint256s( - ETHEREUM_FORK_BLOCK, - OPTIMISM_FORK_BLOCK, - POLYGON_FORK_BLOCK, - BASE_FORK_BLOCK, - ARBITRUM_FORK_BLOCK - ); + function test_register_all() public { + revertToState(); - for (uint256 i; i < chainIds.length; ++i) { - vm.selectChain(chainIds[i], blockNumbers[i]); + uint256[] memory chainIds = + SolArray.uint256s(Chains.ETHEREUM, Chains.OPTIMISM, Chains.POLYGON, Chains.BASE, Chains.ARBITRUM); - deployRouter(address(this), proxyOwner, bytes32(0)); + uint256[] memory blockNumbers = SolArray.uint256s( + ETHEREUM_FORK_BLOCK, OPTIMISM_FORK_BLOCK, POLYGON_FORK_BLOCK, BASE_FORK_BLOCK, ARBITRUM_FORK_BLOCK + ); - uint256 initialCount = router.numAssets(); - assertEq(initialCount, 1); + for (uint256 i; i < chainIds.length; ++i) { + vm.selectChain(chainIds[i], blockNumbers[i]); - bytes memory params = runScript("encode", vm.toString(chainIds[i])); - router.register(params); + deployRouter(address(this), proxyOwner, bytes32(0)); - assertGt(router.numAssets(), initialCount); - } - } + uint256 initialCount = router.numAssets(); + assertEq(initialCount, 1); - function test_register_revertsOnInvalidFeed() public { - vm.expectRevert(IChainlinkRouter.InvalidFeed.selector); - router.register(abi.encodePacked(address(0), LINK, WETH)); - } + bytes memory params = runScript("encode", vm.toString(chainIds[i])); + router.register(params); - function test_register_revertsOnIdenticalAssets() public { - vm.expectRevert(IChainlinkRouter.IdenticalAssets.selector); - router.register(abi.encodePacked(LINK_ETH, LINK, LINK)); - } + assertGt(router.numAssets(), initialCount); + } + } - function test_register_revertsIfUnauthorized() public impersonate(unknown) { - vm.expectRevert(abi.encodeWithSelector(Ownable.UnauthorizedAccount.selector, unknown)); - router.register(abi.encodePacked(LINK_ETH, LINK, WETH, LINK_USD, LINK, USD)); - } + function test_register_revertsOnInvalidFeed() public { + vm.expectRevert(IChainlinkRouter.InvalidFeed.selector); + router.register(abi.encodePacked(address(0), LINK, WETH)); + } - function test_deregister() public { - router.register(abi.encodePacked(LINK_ETH, LINK, WETH, LINK_USD, LINK, USD)); + function test_register_revertsOnIdenticalAssets() public { + vm.expectRevert(IChainlinkRouter.IdenticalAssets.selector); + router.register(abi.encodePacked(LINK_ETH, LINK, LINK)); + } - uint256 initialCount = router.numAssets(); - uint256 assetId = router.getAssetId(LINK); + function test_register_revertsIfUnauthorized() public impersonate(unknown) { + vm.expectRevert(abi.encodeWithSelector(Ownable.UnauthorizedAccount.selector, unknown)); + router.register(abi.encodePacked(LINK_ETH, LINK, WETH, LINK_USD, LINK, Denominations.USD)); + } - vm.expectEmit(true, true, true, true, address(router)); - emit IChainlinkRouter.FeedDeregistered(LINK, WETH); + function test_deregister() public { + router.register(abi.encodePacked(LINK_ETH, LINK, WETH, LINK_USD, LINK, Denominations.USD)); - router.deregister(abi.encodePacked(LINK, WETH)); + uint256 initialCount = router.numAssets(); + uint256 assetId = router.getAssetId(LINK); - assertEq(router.getAssetId(LINK), assetId); - assertEq(router.getAsset(assetId), LINK); - assertEq(router.getFeed(LINK, WETH), address(0)); + vm.expectEmit(true, true, true, true, address(router)); + emit IChainlinkRouter.FeedDeregistered(LINK, WETH); - emit IChainlinkRouter.AssetRemoved(LINK, router.getAssetId(LINK)); - emit IChainlinkRouter.FeedDeregistered(LINK, USD); - - router.deregister(abi.encodePacked(LINK, USD)); + router.deregister(abi.encodePacked(LINK, WETH)); - assertEq(router.getAssetId(LINK), 0); - assertEq(router.getAsset(assetId), address(0)); - assertEq(router.getFeed(LINK, USD), address(0)); - assertEq(router.numAssets(), initialCount - 1); - } - - function test_deregister_multipleFeeds() public { - address[] memory feeds = SolArray.addresses(AAVE_ETH, COMP_ETH, LINK_ETH, UNI_ETH); - address[] memory assets = SolArray.addresses(AAVE, COMP, LINK, UNI); - - bytes memory params; - for (uint256 i; i < feeds.length; ++i) { - params = abi.encodePacked(params, feeds[i], assets[i], WETH); - } - - router.register(params); - - uint256 initialCount = router.numAssets(); - - vm.expectEmit(true, true, true, true, address(router)); - - params = ""; - for (uint256 i; i < assets.length; ++i) { - emit IChainlinkRouter.FeedDeregistered(assets[i], WETH); - params = abi.encodePacked(params, assets[i], WETH); - } - - router.deregister(params); - - for (uint256 i; i < assets.length; ++i) { - assertEq(router.getFeed(assets[i], WETH), address(0)); - } - - assertEq(router.numAssets(), initialCount - assets.length); - } - - function test_deregister_revertsOnIdenticalAssets() public { - vm.expectRevert(IChainlinkRouter.IdenticalAssets.selector); - router.deregister(abi.encodePacked(LINK, LINK)); - } - - function test_deregister_revertsIfUnauthorized() public impersonate(unknown) { - vm.expectRevert(abi.encodeWithSelector(Ownable.UnauthorizedAccount.selector, unknown)); - router.deregister(abi.encodePacked(LINK, WETH)); - } - - function test_getAssetConfiguration() public view { - BitMap configuration = router.getAssetConfiguration(USD); - assertFalse(configuration.isZero()); - assertTrue(configuration.get(router.getAssetId(WETH))); - assertTrue(configuration.get(router.getAssetId(WBTC))); - assertTrue(configuration.get(router.getAssetId(USDC))); - assertTrue(configuration.get(router.getAssetId(USDT))); - } - - function test_getFeedConfiguration() public view { - address[] memory feeds = SolArray.addresses(ETH_USD, BTC_USD, USDC_USD, USDT_USD); - address[] memory assets = SolArray.addresses(WETH, WBTC, USDC, USDT); - - for (uint256 i; i < feeds.length; ++i) { - FeedConfig configuration = router.getFeedConfiguration(assets[i], USD); - assertFalse(configuration.isZero()); - assertEq(configuration.feed(), feeds[i]); - assertEq(configuration.baseId(), router.getAssetId(assets[i])); - assertEq(configuration.baseDecimals(), assets[i].decimals()); - assertEq(configuration.quoteId(), router.getAssetId(USD)); - assertEq(configuration.quoteDecimals(), 8); - assertTrue(router.getAssetConfiguration(assets[i]).get(router.getAssetId(USD))); - } - } - - function test_getFeedConfiguration_revertsOnIdenticalAssets() public { - vm.expectRevert(IChainlinkRouter.IdenticalAssets.selector); - router.getFeedConfiguration(WETH, WETH); - } - - function test_queryFeed_findsDirectFeed() public view { - assertEq(router.queryFeed(WETH, USD), ETH_USD); - } - - function test_queryFeed_findsBidirectionalFeed() public view { - assertEq(router.queryFeed(USD, WETH), ETH_USD); - } - - function test_queryFeed_revertsOnIdenticalAssets() public { - vm.expectRevert(IChainlinkRouter.IdenticalAssets.selector); - router.queryFeed(WETH, WETH); - } - - function test_getFeed_exactDirectionOnly() public view { - assertEq(router.getFeed(WETH, USD), ETH_USD); - assertEq(router.getFeed(USD, WETH), address(0)); - } - - function test_getFeed_revertsOnIdenticalAssets() public { - vm.expectRevert(IChainlinkRouter.IdenticalAssets.selector); - router.getFeed(WETH, WETH); - } - - function test_query_singleHop() public view { - address[] memory feeds = SolArray.addresses(ETH_USD, BTC_USD, USDC_USD, USDT_USD); - address[] memory assets = SolArray.addresses(WETH, WBTC, USDC, USDT); - - for (uint256 i; i < feeds.length; ++i) { - (address[] memory path, uint256 price) = router.query(assets[i], USD); - uint256 expected = getLatestAnswer(feeds[i]); - - assertEq(path.length, 1); - assertEq(path[0], feeds[i]); - assertEq(price, expected); - } - } - - function test_query_singleHop_inverted() public view { - address[] memory feeds = SolArray.addresses(ETH_USD, BTC_USD, USDC_USD, USDT_USD); - address[] memory assets = SolArray.addresses(WETH, WBTC, USDC, USDT); - - for (uint256 i; i < feeds.length; ++i) { - (address[] memory path, uint256 price) = router.query(USD, assets[i]); - uint256 expected = getInverseAnswer(feeds[i], assets[i], USD); - - assertEq(path.length, 1); - assertEq(path[0], feeds[i]); - assertEq(price, expected); - } - } - - function test_query_2Hops() public view { - (address[] memory path, uint256 price) = router.query(USDC, WETH); - uint256 expected = getLatestAnswer(USDC_ETH); - - assertEq(path.length, 2); - assertEq(path[0], USDC_USD); - assertEq(path[1], ETH_USD); - assertApproxEqRelDecimal(price, expected, 0.01e18, 18); - } - - function test_query_2Hops_inverted() public view { - (address[] memory path, uint256 price) = router.query(WETH, USDC); - uint256 expected = getInverseAnswer(USDC_ETH, USDC, WETH); - - assertEq(path.length, 2); - assertEq(path[0], ETH_USD); - assertEq(path[1], USDC_USD); - assertApproxEqRelDecimal(price, expected, 0.01e18, 6); - } - - function test_query_3Hops() public { - address[] memory usdFeeds = SolArray.addresses(LINK_USD, AAVE_USD, COMP_USD, UNI_USD); - address[] memory ethFeeds = SolArray.addresses(LINK_ETH, AAVE_ETH, COMP_ETH, UNI_ETH); - address[] memory assets = SolArray.addresses(LINK, AAVE, COMP, UNI); - - bytes memory params = abi.encodePacked( - LINK_ETH, - LINK, - WETH, - AAVE_ETH, - AAVE, - WETH, - COMP_ETH, - COMP, - WETH, - UNI_ETH, - UNI, - WETH - ); - - router.register(params); - - for (uint256 i; i < ethFeeds.length; ++i) { - (address[] memory path, uint256 price) = router.query(assets[i], USDC); - uint256 expected = getLatestAnswer(usdFeeds[i]) / 1e2; - - assertEq(path.length, 3); - assertEq(path[0], ethFeeds[i]); - assertEq(path[1], ETH_USD); - assertEq(path[2], USDC_USD); - assertApproxEqRelDecimal(price, expected, 0.01e18, 6); - } - } - - function test_query_3Hops_inverted() public { - address[] memory usdFeeds = SolArray.addresses(LINK_USD, AAVE_USD, COMP_USD, UNI_USD); - address[] memory ethFeeds = SolArray.addresses(LINK_ETH, AAVE_ETH, COMP_ETH, UNI_ETH); - address[] memory assets = SolArray.addresses(LINK, AAVE, COMP, UNI); - - bytes memory params = abi.encodePacked( - LINK_ETH, - LINK, - WETH, - AAVE_ETH, - AAVE, - WETH, - COMP_ETH, - COMP, - WETH, - UNI_ETH, - UNI, - WETH - ); - - router.register(params); - - for (uint256 i; i < ethFeeds.length; ++i) { - (address[] memory path, uint256 price) = router.query(USDC, assets[i]); - uint256 expected = getInverseAnswer(usdFeeds[i], assets[i], USD); - - assertEq(path.length, 3); - assertEq(path[0], USDC_USD); - assertEq(path[1], ETH_USD); - assertEq(path[2], ethFeeds[i]); - assertApproxEqRelDecimal(price, expected, 0.01e18, assets[i].decimals()); - } - } - - function test_query_revertsOnNoPath() public { - vm.expectRevert(); - router.query(LINK, WBTC); - } - - function test_query_revertsOnIdenticalAssets() public { - vm.expectRevert(IChainlinkRouter.IdenticalAssets.selector); - router.query(WETH, WETH); - } - - function test_query_revertsOnNegativePrice() public { - vm.mockCall(ETH_USD, abi.encodeCall(AggregatorInterface.latestAnswer, ()), abi.encode(int256(-1))); - - vm.expectRevert(PriceMath.InvalidPrice.selector); - router.query(WETH, USD); - } - - function test_query_revertsOnZeroPrice() public { - vm.mockCall(ETH_USD, abi.encodeCall(AggregatorInterface.latestAnswer, ()), abi.encode(0)); - - vm.expectRevert(PriceMath.InvalidPrice.selector); - router.query(WETH, USD); - } + assertEq(router.getAssetId(LINK), assetId); + assertEq(router.getAsset(assetId), LINK); + assertEq(router.getFeed(LINK, WETH), address(0)); + + emit IChainlinkRouter.AssetRemoved(LINK, router.getAssetId(LINK)); + emit IChainlinkRouter.FeedDeregistered(LINK, Denominations.USD); + + router.deregister(abi.encodePacked(LINK, Denominations.USD)); + + assertEq(router.getAssetId(LINK), 0); + assertEq(router.getAsset(assetId), address(0)); + assertEq(router.getFeed(LINK, Denominations.USD), address(0)); + assertEq(router.numAssets(), initialCount - 1); + } + + function test_deregister_multipleFeeds() public { + address[] memory feeds = SolArray.addresses(AAVE_ETH, COMP_ETH, LINK_ETH, UNI_ETH); + address[] memory assets = SolArray.addresses(AAVE, COMP, LINK, UNI); + + bytes memory params; + for (uint256 i; i < feeds.length; ++i) { + params = abi.encodePacked(params, feeds[i], assets[i], WETH); + } + + router.register(params); + + uint256 initialCount = router.numAssets(); + + vm.expectEmit(true, true, true, true, address(router)); + + params = ""; + for (uint256 i; i < assets.length; ++i) { + emit IChainlinkRouter.FeedDeregistered(assets[i], WETH); + params = abi.encodePacked(params, assets[i], WETH); + } + + router.deregister(params); + + for (uint256 i; i < assets.length; ++i) { + assertEq(router.getFeed(assets[i], WETH), address(0)); + } + + assertEq(router.numAssets(), initialCount - assets.length); + } + + function test_deregister_revertsOnIdenticalAssets() public { + vm.expectRevert(IChainlinkRouter.IdenticalAssets.selector); + router.deregister(abi.encodePacked(LINK, LINK)); + } + + function test_deregister_revertsIfUnauthorized() public impersonate(unknown) { + vm.expectRevert(abi.encodeWithSelector(Ownable.UnauthorizedAccount.selector, unknown)); + router.deregister(abi.encodePacked(LINK, WETH)); + } + + function test_getAssetConfiguration() public view { + BitMap configuration = router.getAssetConfiguration(Denominations.USD); + assertFalse(configuration.isZero()); + assertTrue(configuration.get(router.getAssetId(WETH))); + assertTrue(configuration.get(router.getAssetId(WBTC))); + assertTrue(configuration.get(router.getAssetId(USDC))); + assertTrue(configuration.get(router.getAssetId(USDT))); + } + + function test_getFeedConfiguration() public view { + address[] memory feeds = SolArray.addresses(ETH_USD, BTC_USD, USDC_USD, USDT_USD); + address[] memory assets = SolArray.addresses(WETH, WBTC, USDC, USDT); + + for (uint256 i; i < feeds.length; ++i) { + FeedConfig configuration = router.getFeedConfiguration(assets[i], Denominations.USD); + assertFalse(configuration.isZero()); + assertEq(configuration.feed(), feeds[i]); + assertEq(configuration.baseId(), router.getAssetId(assets[i])); + assertEq(configuration.baseDecimals(), assets[i].decimals()); + assertEq(configuration.quoteId(), router.getAssetId(Denominations.USD)); + assertEq(configuration.quoteDecimals(), 8); + assertTrue(router.getAssetConfiguration(assets[i]).get(router.getAssetId(Denominations.USD))); + } + } + + function test_getFeedConfiguration_revertsOnIdenticalAssets() public { + vm.expectRevert(IChainlinkRouter.IdenticalAssets.selector); + router.getFeedConfiguration(WETH, WETH); + } + + function test_queryFeed_findsDirectFeed() public view { + assertEq(router.queryFeed(WETH, Denominations.USD), ETH_USD); + } + + function test_queryFeed_findsBidirectionalFeed() public view { + assertEq(router.queryFeed(Denominations.USD, WETH), ETH_USD); + } + + function test_queryFeed_revertsOnIdenticalAssets() public { + vm.expectRevert(IChainlinkRouter.IdenticalAssets.selector); + router.queryFeed(WETH, WETH); + } + + function test_getFeed_exactDirectionOnly() public view { + assertEq(router.getFeed(WETH, Denominations.USD), ETH_USD); + assertEq(router.getFeed(Denominations.USD, WETH), address(0)); + } + + function test_getFeed_revertsOnIdenticalAssets() public { + vm.expectRevert(IChainlinkRouter.IdenticalAssets.selector); + router.getFeed(WETH, WETH); + } + + function test_query_singleHop() public view { + address[] memory feeds = SolArray.addresses(ETH_USD, BTC_USD, USDC_USD, USDT_USD); + address[] memory assets = SolArray.addresses(WETH, WBTC, USDC, USDT); + + for (uint256 i; i < feeds.length; ++i) { + (address[] memory path, uint256 price) = router.query(assets[i], Denominations.USD); + uint256 expected = getLatestAnswer(feeds[i]); + + assertEq(path.length, 1); + assertEq(path[0], feeds[i]); + assertEq(price, expected); + } + } + + function test_query_singleHop_inverted() public view { + address[] memory feeds = SolArray.addresses(ETH_USD, BTC_USD, USDC_USD, USDT_USD); + address[] memory assets = SolArray.addresses(WETH, WBTC, USDC, USDT); + + for (uint256 i; i < feeds.length; ++i) { + (address[] memory path, uint256 price) = router.query(Denominations.USD, assets[i]); + uint256 expected = getInverseAnswer(feeds[i], assets[i], Denominations.USD); + + assertEq(path.length, 1); + assertEq(path[0], feeds[i]); + assertEq(price, expected); + } + } + + function test_query_2Hops() public view { + (address[] memory path, uint256 price) = router.query(USDC, WETH); + uint256 expected = getLatestAnswer(USDC_ETH); + + assertEq(path.length, 2); + assertEq(path[0], USDC_USD); + assertEq(path[1], ETH_USD); + assertApproxEqRelDecimal(price, expected, 0.01e18, 18); + } + + function test_query_2Hops_inverted() public view { + (address[] memory path, uint256 price) = router.query(WETH, USDC); + uint256 expected = getInverseAnswer(USDC_ETH, USDC, WETH); + + assertEq(path.length, 2); + assertEq(path[0], ETH_USD); + assertEq(path[1], USDC_USD); + assertApproxEqRelDecimal(price, expected, 0.01e18, 6); + } + + function test_query_3Hops() public { + address[] memory usdFeeds = SolArray.addresses(LINK_USD, AAVE_USD, COMP_USD, UNI_USD); + address[] memory ethFeeds = SolArray.addresses(LINK_ETH, AAVE_ETH, COMP_ETH, UNI_ETH); + address[] memory assets = SolArray.addresses(LINK, AAVE, COMP, UNI); + + bytes memory params = + abi.encodePacked(LINK_ETH, LINK, WETH, AAVE_ETH, AAVE, WETH, COMP_ETH, COMP, WETH, UNI_ETH, UNI, WETH); + + router.register(params); + + for (uint256 i; i < ethFeeds.length; ++i) { + (address[] memory path, uint256 price) = router.query(assets[i], USDC); + uint256 expected = getLatestAnswer(usdFeeds[i]) / 1e2; + + assertEq(path.length, 3); + assertEq(path[0], ethFeeds[i]); + assertEq(path[1], ETH_USD); + assertEq(path[2], USDC_USD); + assertApproxEqRelDecimal(price, expected, 0.01e18, 6); + } + } + + function test_query_3Hops_inverted() public { + address[] memory usdFeeds = SolArray.addresses(LINK_USD, AAVE_USD, COMP_USD, UNI_USD); + address[] memory ethFeeds = SolArray.addresses(LINK_ETH, AAVE_ETH, COMP_ETH, UNI_ETH); + address[] memory assets = SolArray.addresses(LINK, AAVE, COMP, UNI); + + bytes memory params = + abi.encodePacked(LINK_ETH, LINK, WETH, AAVE_ETH, AAVE, WETH, COMP_ETH, COMP, WETH, UNI_ETH, UNI, WETH); + + router.register(params); + + for (uint256 i; i < ethFeeds.length; ++i) { + (address[] memory path, uint256 price) = router.query(USDC, assets[i]); + uint256 expected = getInverseAnswer(usdFeeds[i], assets[i], Denominations.USD); + + assertEq(path.length, 3); + assertEq(path[0], USDC_USD); + assertEq(path[1], ETH_USD); + assertEq(path[2], ethFeeds[i]); + assertApproxEqRelDecimal(price, expected, 0.01e18, assets[i].decimals()); + } + } + + function test_query_revertsOnNoPath() public { + vm.expectRevert(); + router.query(LINK, WBTC); + } + + function test_query_revertsOnIdenticalAssets() public { + vm.expectRevert(IChainlinkRouter.IdenticalAssets.selector); + router.query(WETH, WETH); + } + + function test_query_revertsOnNegativePrice() public { + vm.mockCall(ETH_USD, abi.encodeCall(AggregatorInterface.latestAnswer, ()), abi.encode(int256(-1))); + + vm.expectRevert(PriceMath.InvalidPrice.selector); + router.query(WETH, Denominations.USD); + } + + function test_query_revertsOnZeroPrice() public { + vm.mockCall(ETH_USD, abi.encodeCall(AggregatorInterface.latestAnswer, ()), abi.encode(0)); + + vm.expectRevert(PriceMath.InvalidPrice.selector); + router.query(WETH, Denominations.USD); + } } diff --git a/test/libraries/FullMath.t.sol b/test/libraries/FullMath.t.sol index 7bab270..7f8be6a 100644 --- a/test/libraries/FullMath.t.sol +++ b/test/libraries/FullMath.t.sol @@ -6,17 +6,17 @@ import {Math} from "@openzeppelin/utils/math/Math.sol"; import {FullMath} from "src/libraries/FullMath.sol"; contract FullMathTest is Test { - function test_fuzz_mulDiv(uint256 x, uint256 y, uint256 d) public pure { - vm.assume(d > 0); - (uint256 xyHi, ) = Math.mul512(x, y); - vm.assume(xyHi < d); - assertEq(FullMath.mulDiv(x, y, d), Math.mulDiv(x, y, d)); - } + function test_fuzz_mulDiv(uint256 x, uint256 y, uint256 d) public pure { + vm.assume(d > 0); + (uint256 xyHi,) = Math.mul512(x, y); + vm.assume(xyHi < d); + assertEq(FullMath.mulDiv(x, y, d), Math.mulDiv(x, y, d)); + } - function test_fuzz_mulDivRoundingUp(uint256 x, uint256 y, uint256 d) public pure { - vm.assume(d > 0); - (uint256 xyHi, ) = Math.mul512(x, y); - vm.assume(xyHi < d); - assertEq(FullMath.mulDivRoundingUp(x, y, d), Math.mulDiv(x, y, d, Math.Rounding.Ceil)); - } + function test_fuzz_mulDivRoundingUp(uint256 x, uint256 y, uint256 d) public pure { + vm.assume(d > 0); + (uint256 xyHi,) = Math.mul512(x, y); + vm.assume(xyHi < d); + assertEq(FullMath.mulDivRoundingUp(x, y, d), Math.mulDiv(x, y, d, Math.Rounding.Ceil)); + } } diff --git a/test/libraries/PriceMath.t.sol b/test/libraries/PriceMath.t.sol index e877de2..fc1c79c 100644 --- a/test/libraries/PriceMath.t.sol +++ b/test/libraries/PriceMath.t.sol @@ -5,141 +5,141 @@ import {Test} from "forge-std/Test.sol"; import {PriceMath} from "src/libraries/PriceMath.sol"; contract PriceMathTest is Test { - function test_normalize_sameDecimals() public pure { - uint256 price = 1000e18; // 1000 with 18 decimals - uint256 result = PriceMath.normalize(price, 18, 18); - assertEq(result, price); - } - - function test_normalize_scaleDown() public pure { - uint256 price = 1000e18; // 1000 with 18 decimals - uint256 expected = 1000e6; // 1000 with 6 decimals - uint256 result = PriceMath.normalize(price, 18, 6); - assertEq(result, expected); - } - - function test_normalize_scaleUp() public pure { - uint256 price = 1000e6; // 1000 with 6 decimals - uint256 expected = 1000e18; // 1000 with 18 decimals - uint256 result = PriceMath.normalize(price, 6, 18); - assertEq(result, expected); - } - - function test_normalize_revertsIfZeroPrice() public { - vm.expectRevert(PriceMath.InvalidPrice.selector); - PriceMath.normalize(0, 18, 6); - } - - function test_normalize_revertsIfZeroDecimals() public { - vm.expectRevert(PriceMath.InvalidDecimals.selector); - PriceMath.normalize(1000e18, 0, 6); - - vm.expectRevert(PriceMath.InvalidDecimals.selector); - PriceMath.normalize(1000e18, 18, 0); - } - - function test_fuzz_normalize(uint256 price, uint8 fromDecimals, uint8 toDecimals) public pure { - price = bound(price, 1, type(uint128).max); - fromDecimals = uint8(bound(fromDecimals, 1, 18)); - toDecimals = uint8(bound(toDecimals, 1, 18)); - - uint256 result = PriceMath.normalize(price, fromDecimals, toDecimals); - if (fromDecimals == toDecimals) { - assertEq(result, price); - } else if (fromDecimals > toDecimals) { - assertLe(result, price); - } else { - assertGe(result, price); - } - } - - function test_invert() public pure { - uint256 price = 4000e8; // ETH/USD = $4000 - uint8 baseDecimals = 18; // ETH decimals - uint8 quoteDecimals = 8; // USD decimals - - uint256 result = PriceMath.invert(price, baseDecimals, quoteDecimals); - uint256 expected = 10 ** (baseDecimals + quoteDecimals) / price; - assertEq(result, expected); - } - - function test_invert_sameDecimals() public pure { - uint256 price = 4000e8; - uint256 result = PriceMath.invert(price, 8, 8); - uint256 expected = 10 ** (8 + 8) / price; - assertEq(result, expected); - } - - function test_invert_differentDecimals() public pure { - uint256 price = 4000e8; - uint256 result = PriceMath.invert(price, 8, 6); - uint256 expected = 10 ** (8 + 6) / price; - assertEq(result, expected); - } - - function test_invert_revertsIfZeroPrice() public { - vm.expectRevert(PriceMath.InvalidPrice.selector); - PriceMath.invert(0, 18, 8); - } - - function test_invert_revertsIfZeroDecimals() public { - vm.expectRevert(PriceMath.InvalidDecimals.selector); - PriceMath.invert(1000e8, 0, 8); - - vm.expectRevert(PriceMath.InvalidDecimals.selector); - PriceMath.invert(1000e8, 18, 0); - } - - function test_derive_sameDecimals() public pure { - uint256 ethUsdPrice = 4000e8; // $4000 - uint256 btcUsdPrice = 120000e8; // $120000 - - // Expected: ETH/BTC = 4000/120000 = 0.03333333... BTC per ETH - uint256 result = PriceMath.derive( - ethUsdPrice, // basePrice - btcUsdPrice, // quotePrice - 8, // baseDecimals - 8, // quoteDecimals - 8 // targetDecimals - ); - - uint256 expected = 3333333; // 0.03333333... with 8 decimals - assertEq(result, expected); - } - - function test_derive_differentDecimals() public pure { - uint256 priceA = 100e6; // $100 with 6 decimals - uint256 priceB = 50e18; // $50 with 18 decimals - - uint256 result = PriceMath.derive( - priceA, // basePrice - priceB, // quotePrice - 6, // baseDecimals - 18, // quoteDecimals - 8 // targetDecimals - ); - - // Expected: 100/50 = 2, with 8 decimals = 2e8 - uint256 expected = 2e8; - assertEq(result, expected); - } - - function test_derive_revertsIfZeroPrice() public { - vm.expectRevert(PriceMath.InvalidPrice.selector); - PriceMath.derive(0, 1000e8, 8, 8, 8); - - vm.expectRevert(PriceMath.InvalidPrice.selector); - PriceMath.derive(1000e8, 0, 8, 8, 8); - } - - function test_derive_revertsIfZeroDecimals() public { - vm.expectRevert(PriceMath.InvalidDecimals.selector); - PriceMath.derive(1000e8, 1000e8, 0, 8, 8); - - vm.expectRevert(PriceMath.InvalidDecimals.selector); - PriceMath.derive(1000e8, 1000e8, 8, 0, 8); - - vm.expectRevert(PriceMath.InvalidDecimals.selector); - PriceMath.derive(1000e8, 1000e8, 8, 8, 0); - } + function test_normalize_sameDecimals() public pure { + uint256 price = 1000e18; // 1000 with 18 decimals + uint256 result = PriceMath.normalize(price, 18, 18); + assertEq(result, price); + } + + function test_normalize_scaleDown() public pure { + uint256 price = 1000e18; // 1000 with 18 decimals + uint256 expected = 1000e6; // 1000 with 6 decimals + uint256 result = PriceMath.normalize(price, 18, 6); + assertEq(result, expected); + } + + function test_normalize_scaleUp() public pure { + uint256 price = 1000e6; // 1000 with 6 decimals + uint256 expected = 1000e18; // 1000 with 18 decimals + uint256 result = PriceMath.normalize(price, 6, 18); + assertEq(result, expected); + } + + function test_normalize_revertsIfZeroPrice() public { + vm.expectRevert(PriceMath.InvalidPrice.selector); + PriceMath.normalize(0, 18, 6); + } + + function test_normalize_revertsIfZeroDecimals() public { + vm.expectRevert(PriceMath.InvalidDecimals.selector); + PriceMath.normalize(1000e18, 0, 6); + + vm.expectRevert(PriceMath.InvalidDecimals.selector); + PriceMath.normalize(1000e18, 18, 0); + } + + function test_fuzz_normalize(uint256 price, uint8 fromDecimals, uint8 toDecimals) public pure { + price = bound(price, 1, type(uint128).max); + fromDecimals = uint8(bound(fromDecimals, 1, 18)); + toDecimals = uint8(bound(toDecimals, 1, 18)); + + uint256 result = PriceMath.normalize(price, fromDecimals, toDecimals); + if (fromDecimals == toDecimals) { + assertEq(result, price); + } else if (fromDecimals > toDecimals) { + assertLe(result, price); + } else { + assertGe(result, price); + } + } + + function test_invert() public pure { + uint256 price = 4000e8; // ETH/USD = $4000 + uint8 baseDecimals = 18; // ETH decimals + uint8 quoteDecimals = 8; // USD decimals + + uint256 result = PriceMath.invert(price, baseDecimals, quoteDecimals); + uint256 expected = 10 ** (baseDecimals + quoteDecimals) / price; + assertEq(result, expected); + } + + function test_invert_sameDecimals() public pure { + uint256 price = 4000e8; + uint256 result = PriceMath.invert(price, 8, 8); + uint256 expected = 10 ** (8 + 8) / price; + assertEq(result, expected); + } + + function test_invert_differentDecimals() public pure { + uint256 price = 4000e8; + uint256 result = PriceMath.invert(price, 8, 6); + uint256 expected = 10 ** (8 + 6) / price; + assertEq(result, expected); + } + + function test_invert_revertsIfZeroPrice() public { + vm.expectRevert(PriceMath.InvalidPrice.selector); + PriceMath.invert(0, 18, 8); + } + + function test_invert_revertsIfZeroDecimals() public { + vm.expectRevert(PriceMath.InvalidDecimals.selector); + PriceMath.invert(1000e8, 0, 8); + + vm.expectRevert(PriceMath.InvalidDecimals.selector); + PriceMath.invert(1000e8, 18, 0); + } + + function test_derive_sameDecimals() public pure { + uint256 ethUsdPrice = 4000e8; // $4000 + uint256 btcUsdPrice = 120000e8; // $120000 + + // Expected: ETH/BTC = 4000/120000 = 0.03333333... BTC per ETH + uint256 result = PriceMath.derive( + ethUsdPrice, // basePrice + btcUsdPrice, // quotePrice + 8, // baseDecimals + 8, // quoteDecimals + 8 // targetDecimals + ); + + uint256 expected = 3333333; // 0.03333333... with 8 decimals + assertEq(result, expected); + } + + function test_derive_differentDecimals() public pure { + uint256 priceA = 100e6; // $100 with 6 decimals + uint256 priceB = 50e18; // $50 with 18 decimals + + uint256 result = PriceMath.derive( + priceA, // basePrice + priceB, // quotePrice + 6, // baseDecimals + 18, // quoteDecimals + 8 // targetDecimals + ); + + // Expected: 100/50 = 2, with 8 decimals = 2e8 + uint256 expected = 2e8; + assertEq(result, expected); + } + + function test_derive_revertsIfZeroPrice() public { + vm.expectRevert(PriceMath.InvalidPrice.selector); + PriceMath.derive(0, 1000e8, 8, 8, 8); + + vm.expectRevert(PriceMath.InvalidPrice.selector); + PriceMath.derive(1000e8, 0, 8, 8, 8); + } + + function test_derive_revertsIfZeroDecimals() public { + vm.expectRevert(PriceMath.InvalidDecimals.selector); + PriceMath.derive(1000e8, 1000e8, 0, 8, 8); + + vm.expectRevert(PriceMath.InvalidDecimals.selector); + PriceMath.derive(1000e8, 1000e8, 8, 0, 8); + + vm.expectRevert(PriceMath.InvalidDecimals.selector); + PriceMath.derive(1000e8, 1000e8, 8, 8, 0); + } } diff --git a/test/shared/env/BaseTest.sol b/test/shared/env/BaseTest.sol index 27a362c..e645445 100644 --- a/test/shared/env/BaseTest.sol +++ b/test/shared/env/BaseTest.sol @@ -12,42 +12,42 @@ import {Fixtures} from "./Fixtures.sol"; import {JavascriptFfi} from "./JavascriptFfi.sol"; abstract contract BaseTest is Test, Constants, Fixtures, JavascriptFfi { - using Chains for Vm; - using Denominations for address; + using Chains for Vm; + using Denominations for address; - address internal immutable proxyOwner = makeAddr("ChainlinkRouter ProxyOwner"); - address internal immutable unknown = makeAddr("Unknown"); + address internal immutable proxyOwner = makeAddr("ChainlinkRouter ProxyOwner"); + address internal immutable unknown = makeAddr("Unknown"); - uint256 internal snapshotId = type(uint256).max; + uint256 internal snapshotId = type(uint256).max; - modifier impersonate(address account) { - vm.startPrank(account); - _; - vm.stopPrank(); - } + modifier impersonate(address account) { + vm.startPrank(account); + _; + vm.stopPrank(); + } - function setUp() public virtual { - revertToState(); + function setUp() public virtual { + revertToState(); - vm.selectChain(Chains.ETHEREUM, ETHEREUM_FORK_BLOCK); + vm.selectChain(Chains.ETHEREUM, ETHEREUM_FORK_BLOCK); - deployRouter(address(this), proxyOwner, bytes32(0)); + deployRouter(address(this), proxyOwner, bytes32(0)); - vm.label(address(logic), "ChainlinkRouter Logic"); - vm.label(address(router), "ChainlinkRouter Proxy"); - vm.label(proxyAdmin, "ChainlinkRouter ProxyAdmin"); - } + vm.label(address(logic), "ChainlinkRouter Logic"); + vm.label(address(router), "ChainlinkRouter Proxy"); + vm.label(proxyAdmin, "ChainlinkRouter ProxyAdmin"); + } - function revertToState() internal virtual { - if (snapshotId != type(uint256).max) vm.revertToState(snapshotId); - snapshotId = vm.snapshotState(); - } + function revertToState() internal virtual { + if (snapshotId != type(uint256).max) vm.revertToState(snapshotId); + snapshotId = vm.snapshotState(); + } - function getInverseAnswer(address feed, address base, address quote) internal view virtual returns (uint256) { - return 10 ** (base.decimals() + quote.decimals()) / getLatestAnswer(feed); - } + function getInverseAnswer(address feed, address base, address quote) internal view virtual returns (uint256) { + return 10 ** (base.decimals() + quote.decimals()) / getLatestAnswer(feed); + } - function getLatestAnswer(address feed) internal view virtual returns (uint256 answer) { - return uint256(AggregatorInterface(feed).latestAnswer()); - } + function getLatestAnswer(address feed) internal view virtual returns (uint256 answer) { + return uint256(AggregatorInterface(feed).latestAnswer()); + } } diff --git a/test/shared/env/Constants.sol b/test/shared/env/Constants.sol index 0595a85..5350a25 100644 --- a/test/shared/env/Constants.sol +++ b/test/shared/env/Constants.sol @@ -2,57 +2,53 @@ pragma solidity ^0.8.30; abstract contract Constants { - bytes32 internal constant INITIALIZED_SLOT = 0xeb0c2ce5f191d27e756051385ba4f8f2e0c18127de8ff7207a5891e3b49bb400; - - uint256 internal constant ETHEREUM_FORK_BLOCK = 23003343; - uint256 internal constant OPTIMISM_FORK_BLOCK = 138967199; - uint256 internal constant POLYGON_FORK_BLOCK = 74432493; - uint256 internal constant BASE_FORK_BLOCK = 33371911; - uint256 internal constant ARBITRUM_FORK_BLOCK = 361762958; - - address internal constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; - address internal constant BTC = 0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB; - address internal constant USD = 0x0000000000000000000000000000000000000348; - - address internal constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; - address internal constant ETH_BTC = 0xAc559F25B1619171CbC396a50854A3240b6A4e99; - address internal constant ETH_USD = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419; - - address internal constant STETH = 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84; - address internal constant WSTETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; - address internal constant STETH_ETH = 0x86392dC19c0b719886221c78AB11eb8Cf5c52812; - address internal constant STETH_USD = 0xCfE54B5cD566aB89272946F602D76Ea879CAb4a8; - - address internal constant EETH = 0x5c9C449BbC9a6075A2c061dF312a35fd1E05fF22; - address internal constant WEETH = 0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee; - address internal constant WEETH_ETH = 0x5c9C449BbC9a6075A2c061dF312a35fd1E05fF22; - address internal constant WEETH_USD = 0xf112aF6F0A332B815fbEf3Ff932c057E570b62d3; - - address internal constant WBTC = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599; - address internal constant BTC_ETH = 0xdeb288F737066589598e9214E782fa5A8eD689e8; - address internal constant BTC_USD = 0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c; - - address internal constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; - address internal constant USDC_ETH = 0x986b5E1e1755e3C2440e960477f25201B0a8bbD4; - address internal constant USDC_USD = 0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6; - - address internal constant USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7; - address internal constant USDT_ETH = 0xEe9F2375b4bdF6387aa8265dD4FB8F16512A1d46; - address internal constant USDT_USD = 0x3E7d1eAB13ad0104d2750B8863b489D65364e32D; - - address internal constant AAVE = 0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9; - address internal constant AAVE_ETH = 0x6Df09E975c830ECae5bd4eD9d90f3A95a4f88012; - address internal constant AAVE_USD = 0x547a514d5e3769680Ce22B2361c10Ea13619e8a9; - - address internal constant COMP = 0xc00e94Cb662C3520282E6f5717214004A7f26888; - address internal constant COMP_ETH = 0x1B39Ee86Ec5979ba5C322b826B3ECb8C79991699; - address internal constant COMP_USD = 0xdbd020CAeF83eFd542f4De03e3cF0C28A4428bd5; - - address internal constant LINK = 0x514910771AF9Ca656af840dff83E8264EcF986CA; - address internal constant LINK_ETH = 0xDC530D9457755926550b59e8ECcdaE7624181557; - address internal constant LINK_USD = 0xC7e9b623ed51F033b32AE7f1282b1AD62C28C183; - - address internal constant UNI = 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984; - address internal constant UNI_ETH = 0xD6aA3D25116d8dA79Ea0246c4826EB951872e02e; - address internal constant UNI_USD = 0x553303d460EE0afB37EdFf9bE42922D8FF63220e; + bytes32 internal constant INITIALIZED_SLOT = 0xeb0c2ce5f191d27e756051385ba4f8f2e0c18127de8ff7207a5891e3b49bb400; + + uint256 internal constant ETHEREUM_FORK_BLOCK = 23003343; + uint256 internal constant OPTIMISM_FORK_BLOCK = 138967199; + uint256 internal constant POLYGON_FORK_BLOCK = 74432493; + uint256 internal constant BASE_FORK_BLOCK = 33371911; + uint256 internal constant ARBITRUM_FORK_BLOCK = 361762958; + + address internal constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; + address internal constant ETH_BTC = 0xAc559F25B1619171CbC396a50854A3240b6A4e99; + address internal constant ETH_USD = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419; + + address internal constant STETH = 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84; + address internal constant WSTETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; + address internal constant STETH_ETH = 0x86392dC19c0b719886221c78AB11eb8Cf5c52812; + address internal constant STETH_USD = 0xCfE54B5cD566aB89272946F602D76Ea879CAb4a8; + + address internal constant EETH = 0x5c9C449BbC9a6075A2c061dF312a35fd1E05fF22; + address internal constant WEETH = 0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee; + address internal constant WEETH_ETH = 0x5c9C449BbC9a6075A2c061dF312a35fd1E05fF22; + address internal constant WEETH_USD = 0xf112aF6F0A332B815fbEf3Ff932c057E570b62d3; + + address internal constant WBTC = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599; + address internal constant BTC_ETH = 0xdeb288F737066589598e9214E782fa5A8eD689e8; + address internal constant BTC_USD = 0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c; + + address internal constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; + address internal constant USDC_ETH = 0x986b5E1e1755e3C2440e960477f25201B0a8bbD4; + address internal constant USDC_USD = 0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6; + + address internal constant USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7; + address internal constant USDT_ETH = 0xEe9F2375b4bdF6387aa8265dD4FB8F16512A1d46; + address internal constant USDT_USD = 0x3E7d1eAB13ad0104d2750B8863b489D65364e32D; + + address internal constant AAVE = 0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9; + address internal constant AAVE_ETH = 0x6Df09E975c830ECae5bd4eD9d90f3A95a4f88012; + address internal constant AAVE_USD = 0x547a514d5e3769680Ce22B2361c10Ea13619e8a9; + + address internal constant COMP = 0xc00e94Cb662C3520282E6f5717214004A7f26888; + address internal constant COMP_ETH = 0x1B39Ee86Ec5979ba5C322b826B3ECb8C79991699; + address internal constant COMP_USD = 0xdbd020CAeF83eFd542f4De03e3cF0C28A4428bd5; + + address internal constant LINK = 0x514910771AF9Ca656af840dff83E8264EcF986CA; + address internal constant LINK_ETH = 0xDC530D9457755926550b59e8ECcdaE7624181557; + address internal constant LINK_USD = 0xC7e9b623ed51F033b32AE7f1282b1AD62C28C183; + + address internal constant UNI = 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984; + address internal constant UNI_ETH = 0xD6aA3D25116d8dA79Ea0246c4826EB951872e02e; + address internal constant UNI_USD = 0x553303d460EE0afB37EdFf9bE42922D8FF63220e; } diff --git a/test/shared/env/Fixtures.sol b/test/shared/env/Fixtures.sol index cdeb950..e37a826 100644 --- a/test/shared/env/Fixtures.sol +++ b/test/shared/env/Fixtures.sol @@ -5,28 +5,23 @@ import {CommonBase} from "forge-std/Base.sol"; import {Vm} from "forge-std/Vm.sol"; import {ChainlinkRouter} from "src/ChainlinkRouter.sol"; import {ProxyHelpers} from "test/shared/helpers/ProxyHelpers.sol"; -import {Constants} from "./Constants.sol"; abstract contract Fixtures is CommonBase { - using ProxyHelpers for Vm; + using ProxyHelpers for address; - ChainlinkRouter internal logic; - ChainlinkRouter internal router; - address internal proxyAdmin; + ChainlinkRouter internal logic; + ChainlinkRouter internal router; + address internal proxyAdmin; - function deployRouter(address owner, address proxyOwner, bytes32 salt) internal virtual returns (address proxy) { - bytes memory data = abi.encodeCall(ChainlinkRouter.initialize, (owner)); + function deployRouter(address owner, address proxyOwner, bytes32 salt) internal virtual returns (address proxy) { + bytes memory data = abi.encodeCall(ChainlinkRouter.initialize, (owner)); - logic = new ChainlinkRouter{salt: salt}(); + logic = new ChainlinkRouter{salt: salt}(); + router = ChainlinkRouter(proxy = address(logic).deployProxy(proxyOwner, data, salt)); + proxyAdmin = address(router).computeProxyAdminAddress(); - router = ChainlinkRouter(proxy = vm.deployProxy(address(logic), proxyOwner, data, salt)); - - proxyAdmin = vm.computeProxyAdminAddress(address(router)); - - vm.assertEq(vm.getProxyImplementation(address(router)), address(logic)); - vm.assertEq(vm.getProxyAdmin(address(router)), proxyAdmin); - vm.assertEq(vm.getProxyOwner(proxyAdmin), proxyOwner); - vm.assertEq(router.numAssets(), 1); - vm.assertEq(router.owner(), owner); - } + vm.assertEq(address(router).getProxyImplementation(), address(logic)); + vm.assertEq(address(router).getProxyAdmin(), proxyAdmin); + vm.assertEq(proxyAdmin.getProxyOwner(), proxyOwner); + } } diff --git a/test/shared/env/JavascriptFfi.sol b/test/shared/env/JavascriptFfi.sol index 96412c7..73663f4 100644 --- a/test/shared/env/JavascriptFfi.sol +++ b/test/shared/env/JavascriptFfi.sol @@ -4,17 +4,17 @@ pragma solidity ^0.8.30; import {CommonBase} from "forge-std/Base.sol"; abstract contract JavascriptFfi is CommonBase { - function runScript(string memory scriptName, string memory args) internal returns (bytes memory result) { - string[] memory cmd = new string[](8); - cmd[0] = "npm"; - cmd[1] = "--silent"; - cmd[2] = "--prefix"; - cmd[3] = "./script/ts"; - cmd[4] = "run"; - cmd[5] = scriptName; - cmd[6] = "--"; - cmd[7] = args; + function runScript(string memory scriptName, string memory args) internal returns (bytes memory result) { + string[] memory cmd = new string[](8); + cmd[0] = "npm"; + cmd[1] = "--silent"; + cmd[2] = "--prefix"; + cmd[3] = "./script/ts"; + cmd[4] = "run"; + cmd[5] = scriptName; + cmd[6] = "--"; + cmd[7] = args; - return vm.ffi(cmd); - } + return vm.ffi(cmd); + } } diff --git a/test/shared/helpers/Chains.sol b/test/shared/helpers/Chains.sol index 1eb73e4..4cfd577 100644 --- a/test/shared/helpers/Chains.sol +++ b/test/shared/helpers/Chains.sol @@ -4,138 +4,89 @@ pragma solidity ^0.8.30; import {Vm} from "forge-std/Vm.sol"; library Chains { - error UnsupportedChainId(uint256 chainId); - - uint256 internal constant ANVIL = 31337; - - uint256 internal constant ETHEREUM = 1; - uint256 internal constant SEPOLIA = 11155111; - - uint256 internal constant OPTIMISM = 10; - uint256 internal constant OPTIMISM_SEPOLIA = 11155420; - - uint256 internal constant BNB = 56; - uint256 internal constant BNB_TESTNET = 97; - - uint256 internal constant UNICHAIN = 130; - uint256 internal constant UNICHAIN_SEPOLIA = 1301; - - uint256 internal constant POLYGON = 137; - uint256 internal constant POLYGON_AMOY = 80002; - - uint256 internal constant FANTOM = 250; - uint256 internal constant FANTOM_TESTNET = 4002; - - uint256 internal constant FRAXTAL = 252; - uint256 internal constant FRAXTAL_SEPOLIA = 2523; - - uint256 internal constant BASE = 8453; - uint256 internal constant BASE_SEPOLIA = 84532; - - uint256 internal constant ARBITRUM = 42161; - uint256 internal constant ARBITRUM_SEPOLIA = 421614; - - uint256 internal constant AVALANCHE = 43114; - uint256 internal constant AVALANCHE_FUJI = 43113; - - uint256 internal constant SCROLL = 534352; - uint256 internal constant SCROLL_SEPOLIA = 534351; - - uint256 internal constant LINEA = 59144; - uint256 internal constant LINEA_SEPOLIA = 59141; - - function selectChain(Vm vm, uint256 chainId) internal returns (uint256 forkId) { - return selectChain(vm, chainId, 0); - } - - function selectChain(Vm vm, uint256 chainId, uint256 blockNumber) internal returns (uint256 forkId) { - if (chainId == block.chainid) { - if (blockNumber != 0) vm.rollFork(blockNumber); - return vm.activeFork(); - } - - forkId = blockNumber != 0 - ? vm.createSelectFork(getRpcUrl(vm, chainId), blockNumber) - : vm.createSelectFork(getRpcUrl(vm, chainId)); - } - - function getRpcUrl(Vm vm, uint256 chainId) internal view returns (string memory rpcUrl) { - return vm.rpcUrl(getChainAlias(chainId)); - } - - function getBlockNumber() internal view returns (uint48 bn) { - assembly ("memory-safe") { - bn := and(sub(shl(48, 1), 1), number()) - } - } - - function getBlockTimestamp() internal view returns (uint48 bts) { - assembly ("memory-safe") { - bts := and(sub(shl(48, 1), 1), timestamp()) - } - } - - function getChainId() internal view returns (uint256 id) { - assembly ("memory-safe") { - id := chainid() - } - } - - function getChainAlias() internal view returns (string memory) { - return getChainAlias(getChainId()); - } - - function getChainAlias(uint256 chainId) internal pure returns (string memory) { - if (chainId == ETHEREUM) { - return "ethereum"; - } else if (chainId == SEPOLIA) { - return "sepolia"; - } else if (chainId == OPTIMISM) { - return "optimism"; - } else if (chainId == OPTIMISM_SEPOLIA) { - return "optimism_sepolia"; - } else if (chainId == BNB) { - return "bnb"; - } else if (chainId == BNB_TESTNET) { - return "bnb-testnet"; - } else if (chainId == POLYGON) { - return "polygon"; - } else if (chainId == POLYGON_AMOY) { - return "polygon-amoy"; - } else if (chainId == UNICHAIN) { - return "unichain"; - } else if (chainId == UNICHAIN_SEPOLIA) { - return "unichain-sepolia"; - } else if (chainId == FANTOM) { - return "fantom"; - } else if (chainId == FANTOM_TESTNET) { - return "fantom-testnet"; - } else if (chainId == FRAXTAL) { - return "fraxtal"; - } else if (chainId == FRAXTAL_SEPOLIA) { - return "fraxtal-sepolia"; - } else if (chainId == BASE) { - return "base"; - } else if (chainId == BASE_SEPOLIA) { - return "base-sepolia"; - } else if (chainId == ARBITRUM) { - return "arbitrum"; - } else if (chainId == ARBITRUM_SEPOLIA) { - return "arbitrum-sepolia"; - } else if (chainId == AVALANCHE) { - return "avalanche"; - } else if (chainId == AVALANCHE_FUJI) { - return "avalanche-fuji"; - } else if (chainId == SCROLL) { - return "scroll"; - } else if (chainId == SCROLL_SEPOLIA) { - return "scroll-sepolia"; - } else if (chainId == LINEA) { - return "linea"; - } else if (chainId == LINEA_SEPOLIA) { - return "linea-sepolia"; - } else { - revert UnsupportedChainId(chainId); - } - } + error UnsupportedChainId(uint256 chainId); + + uint256 internal constant ANVIL = 31337; + + uint256 internal constant ETHEREUM = 1; + uint256 internal constant SEPOLIA = 11155111; + + uint256 internal constant OPTIMISM = 10; + uint256 internal constant OPTIMISM_SEPOLIA = 11155420; + + uint256 internal constant POLYGON = 137; + uint256 internal constant POLYGON_AMOY = 80002; + + uint256 internal constant BASE = 8453; + uint256 internal constant BASE_SEPOLIA = 84532; + + uint256 internal constant ARBITRUM = 42161; + uint256 internal constant ARBITRUM_SEPOLIA = 421614; + + function selectChain(Vm vm, uint256 chainId) internal returns (uint256 forkId) { + return selectChain(vm, chainId, 0); + } + + function selectChain(Vm vm, uint256 chainId, uint256 blockNumber) internal returns (uint256 forkId) { + if (chainId == block.chainid) { + if (blockNumber != 0) vm.rollFork(blockNumber); + return vm.activeFork(); + } + + forkId = blockNumber != 0 + ? vm.createSelectFork(getRpcUrl(vm, chainId), blockNumber) + : vm.createSelectFork(getRpcUrl(vm, chainId)); + } + + function getRpcUrl(Vm vm, uint256 chainId) internal view returns (string memory rpcUrl) { + return vm.rpcUrl(getChainAlias(chainId)); + } + + function getBlockNumber() internal view returns (uint48 bn) { + assembly ("memory-safe") { + bn := and(sub(shl(48, 1), 1), number()) + } + } + + function getBlockTimestamp() internal view returns (uint48 bts) { + assembly ("memory-safe") { + bts := and(sub(shl(48, 1), 1), timestamp()) + } + } + + function getChainId() internal view returns (uint256 id) { + assembly ("memory-safe") { + id := chainid() + } + } + + function getChainAlias() internal view returns (string memory) { + return getChainAlias(getChainId()); + } + + function getChainAlias(uint256 chainId) internal pure returns (string memory) { + if (chainId == ETHEREUM) { + return "ethereum"; + } else if (chainId == SEPOLIA) { + return "sepolia"; + } else if (chainId == OPTIMISM) { + return "optimism"; + } else if (chainId == OPTIMISM_SEPOLIA) { + return "optimism_sepolia"; + } else if (chainId == POLYGON) { + return "polygon"; + } else if (chainId == POLYGON_AMOY) { + return "polygon-amoy"; + } else if (chainId == BASE) { + return "base"; + } else if (chainId == BASE_SEPOLIA) { + return "base-sepolia"; + } else if (chainId == ARBITRUM) { + return "arbitrum"; + } else if (chainId == ARBITRUM_SEPOLIA) { + return "arbitrum-sepolia"; + } else { + revert UnsupportedChainId(chainId); + } + } } diff --git a/test/shared/helpers/ProxyHelpers.sol b/test/shared/helpers/ProxyHelpers.sol index cc190b5..1f6f996 100644 --- a/test/shared/helpers/ProxyHelpers.sol +++ b/test/shared/helpers/ProxyHelpers.sol @@ -2,82 +2,72 @@ pragma solidity ^0.8.30; import {Vm} from "forge-std/Vm.sol"; -import {ForgeProxy} from "@proxy-forge/ForgeProxy.sol"; +import {ForgeProxy} from "proxy-forge/ForgeProxy.sol"; library ProxyHelpers { - bytes32 internal constant ERC1967_ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; - - bytes32 internal constant ERC1967_IMPLEMENTATION_SLOT = - 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; - - bytes32 internal constant PROXY_ADMIN_OWNER_SLOT = - 0x9bc353c4ee8d049c7cb68b79467fc95d9015a8a82334bd0e61ce699e20cb5bd5; - - function deployProxy( - Vm vm, - address logic, - address owner, - bytes memory data, - bytes32 salt - ) internal returns (address proxy) { - return deployProxy(vm, logic, owner, data, salt, 0); - } - - function deployProxy( - Vm vm, - address logic, - address owner, - bytes memory data, - bytes32 salt, - uint256 value - ) internal returns (address proxy) { - vm.assertTrue((proxy = address(new ForgeProxy{salt: salt, value: value}(logic, owner, data))) != address(0)); - } - - function upgradeProxy(Vm vm, address proxy, address logic, bytes memory data) internal { - upgradeProxy(vm, proxy, logic, data, 0); - } - - function upgradeProxy(Vm vm, address proxy, address logic, bytes memory data, uint256 value) internal { - bytes memory payload = abi.encodeWithSignature("upgradeAndCall(address,address,bytes)", proxy, logic, data); - - address proxyAdmin = getProxyAdmin(vm, proxy); - vm.prank(getProxyOwner(vm, proxyAdmin)); - - (bool success, ) = proxyAdmin.call{value: value}(payload); - vm.assertTrue(success); - } - - function getProxyImplementation(Vm vm, address proxy) internal view returns (address) { - return fromLast20Bytes(vm.load(proxy, ERC1967_IMPLEMENTATION_SLOT)); - } - - function getProxyAdmin(Vm vm, address proxy) internal view returns (address) { - return fromLast20Bytes(vm.load(proxy, ERC1967_ADMIN_SLOT)); - } - - function getProxyOwner(Vm vm, address admin) internal view returns (address) { - return fromLast20Bytes(vm.load(admin, PROXY_ADMIN_OWNER_SLOT)); - } - - function computeProxyAddress( - Vm vm, - address deployer, - bytes32 hash, - bytes32 salt - ) internal pure returns (address proxy) { - return vm.computeCreate2Address(salt, hash, deployer); - } - - function computeProxyAddress(Vm vm, address deployer) internal view returns (address proxy) { - return vm.computeCreateAddress(deployer, vm.getNonce(deployer)); - } - - function computeProxyAdminAddress(Vm vm, address proxy) internal pure returns (address) { - return vm.computeCreateAddress(proxy, 1); - } - - function fromLast20Bytes(bytes32 value) internal pure returns (address) { - return address(uint160(uint256(value))); - } + Vm private constant vm = Vm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D); + + bytes32 internal constant ERC1967_ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; + + bytes32 internal constant ERC1967_IMPLEMENTATION_SLOT = + 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; + + bytes32 internal constant PROXY_ADMIN_OWNER_SLOT = + 0x9bc353c4ee8d049c7cb68b79467fc95d9015a8a82334bd0e61ce699e20cb5bd5; + + function deployProxy(address logic, address owner, bytes memory data, bytes32 salt) + internal + returns (address proxy) + { + return deployProxy(logic, owner, data, salt, 0); + } + + function deployProxy(address logic, address owner, bytes memory data, bytes32 salt, uint256 value) + internal + returns (address proxy) + { + return address(new ForgeProxy{salt: salt, value: value}(logic, owner, data)); + } + + function upgradeProxy(address proxy, address logic, bytes memory data) internal { + upgradeProxy(proxy, logic, data, 0); + } + + function upgradeProxy(address proxy, address logic, bytes memory data, uint256 value) internal { + bytes memory payload = abi.encodeWithSignature("upgradeAndCall(address,address,bytes)", proxy, logic, data); + + address proxyAdmin = getProxyAdmin(proxy); + vm.prank(getProxyOwner(proxyAdmin)); + + (bool success,) = proxyAdmin.call{value: value}(payload); + vm.assertTrue(success); + } + + function getProxyImplementation(address proxy) internal view returns (address) { + return fromLast20Bytes(vm.load(proxy, ERC1967_IMPLEMENTATION_SLOT)); + } + + function getProxyAdmin(address proxy) internal view returns (address) { + return fromLast20Bytes(vm.load(proxy, ERC1967_ADMIN_SLOT)); + } + + function getProxyOwner(address admin) internal view returns (address) { + return fromLast20Bytes(vm.load(admin, PROXY_ADMIN_OWNER_SLOT)); + } + + function computeProxyAddress(address deployer, bytes32 hash, bytes32 salt) internal pure returns (address proxy) { + return vm.computeCreate2Address(salt, hash, deployer); + } + + function computeProxyAddress(address deployer) internal view returns (address proxy) { + return vm.computeCreateAddress(deployer, vm.getNonce(deployer)); + } + + function computeProxyAdminAddress(address proxy) internal pure returns (address) { + return vm.computeCreateAddress(proxy, 1); + } + + function fromLast20Bytes(bytes32 value) internal pure returns (address) { + return address(uint160(uint256(value))); + } } diff --git a/test/shared/helpers/SolArray.sol b/test/shared/helpers/SolArray.sol index a94d2fe..9a1fd72 100644 --- a/test/shared/helpers/SolArray.sol +++ b/test/shared/helpers/SolArray.sol @@ -2,6403 +2,5783 @@ pragma solidity ^0.8.30; library SolArray { - function addresses(address v0) internal pure returns (address[] memory arr) { - arr = new address[](1); - arr[0] = v0; - } - - function addresses(address v0, address v1) internal pure returns (address[] memory arr) { - arr = new address[](2); - arr[0] = v0; - arr[1] = v1; - } - - function addresses(address v0, address v1, address v2) internal pure returns (address[] memory arr) { - arr = new address[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function addresses(address v0, address v1, address v2, address v3) internal pure returns (address[] memory arr) { - arr = new address[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function addresses( - address v0, - address v1, - address v2, - address v3, - address v4 - ) internal pure returns (address[] memory arr) { - arr = new address[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function addresses( - address v0, - address v1, - address v2, - address v3, - address v4, - address v5 - ) internal pure returns (address[] memory arr) { - arr = new address[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function addresses( - address v0, - address v1, - address v2, - address v3, - address v4, - address v5, - address v6 - ) internal pure returns (address[] memory arr) { - arr = new address[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function addresses( - address v0, - address v1, - address v2, - address v3, - address v4, - address v5, - address v6, - address v7 - ) internal pure returns (address[] memory arr) { - arr = new address[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function addresses( - address v0, - address v1, - address v2, - address v3, - address v4, - address v5, - address v6, - address v7, - address v8 - ) internal pure returns (address[] memory arr) { - arr = new address[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function addresses( - address v0, - address v1, - address v2, - address v3, - address v4, - address v5, - address v6, - address v7, - address v8, - address v9 - ) internal pure returns (address[] memory arr) { - arr = new address[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function addresses( - address v0, - address v1, - address v2, - address v3, - address v4, - address v5, - address v6, - address v7, - address v8, - address v9, - address v10 - ) internal pure returns (address[] memory arr) { - arr = new address[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function addresses( - address v0, - address v1, - address v2, - address v3, - address v4, - address v5, - address v6, - address v7, - address v8, - address v9, - address v10, - address v11 - ) internal pure returns (address[] memory arr) { - arr = new address[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function bools(bool v0) internal pure returns (bool[] memory arr) { - arr = new bool[](1); - arr[0] = v0; - } - - function bools(bool v0, bool v1) internal pure returns (bool[] memory arr) { - arr = new bool[](2); - arr[0] = v0; - arr[1] = v1; - } - - function bools(bool v0, bool v1, bool v2) internal pure returns (bool[] memory arr) { - arr = new bool[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function bools(bool v0, bool v1, bool v2, bool v3) internal pure returns (bool[] memory arr) { - arr = new bool[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function bools(bool v0, bool v1, bool v2, bool v3, bool v4) internal pure returns (bool[] memory arr) { - arr = new bool[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function bools(bool v0, bool v1, bool v2, bool v3, bool v4, bool v5) internal pure returns (bool[] memory arr) { - arr = new bool[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function bools( - bool v0, - bool v1, - bool v2, - bool v3, - bool v4, - bool v5, - bool v6 - ) internal pure returns (bool[] memory arr) { - arr = new bool[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function bools( - bool v0, - bool v1, - bool v2, - bool v3, - bool v4, - bool v5, - bool v6, - bool v7 - ) internal pure returns (bool[] memory arr) { - arr = new bool[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function bools( - bool v0, - bool v1, - bool v2, - bool v3, - bool v4, - bool v5, - bool v6, - bool v7, - bool v8 - ) internal pure returns (bool[] memory arr) { - arr = new bool[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function bools( - bool v0, - bool v1, - bool v2, - bool v3, - bool v4, - bool v5, - bool v6, - bool v7, - bool v8, - bool v9 - ) internal pure returns (bool[] memory arr) { - arr = new bool[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function bools( - bool v0, - bool v1, - bool v2, - bool v3, - bool v4, - bool v5, - bool v6, - bool v7, - bool v8, - bool v9, - bool v10 - ) internal pure returns (bool[] memory arr) { - arr = new bool[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function bools( - bool v0, - bool v1, - bool v2, - bool v3, - bool v4, - bool v5, - bool v6, - bool v7, - bool v8, - bool v9, - bool v10, - bool v11 - ) internal pure returns (bool[] memory arr) { - arr = new bool[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function uint8s(uint8 v0) internal pure returns (uint8[] memory arr) { - arr = new uint8[](1); - arr[0] = v0; - } - - function uint8s(uint8 v0, uint8 v1) internal pure returns (uint8[] memory arr) { - arr = new uint8[](2); - arr[0] = v0; - arr[1] = v1; - } - - function uint8s(uint8 v0, uint8 v1, uint8 v2) internal pure returns (uint8[] memory arr) { - arr = new uint8[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function uint8s(uint8 v0, uint8 v1, uint8 v2, uint8 v3) internal pure returns (uint8[] memory arr) { - arr = new uint8[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function uint8s(uint8 v0, uint8 v1, uint8 v2, uint8 v3, uint8 v4) internal pure returns (uint8[] memory arr) { - arr = new uint8[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function uint8s( - uint8 v0, - uint8 v1, - uint8 v2, - uint8 v3, - uint8 v4, - uint8 v5 - ) internal pure returns (uint8[] memory arr) { - arr = new uint8[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function uint8s( - uint8 v0, - uint8 v1, - uint8 v2, - uint8 v3, - uint8 v4, - uint8 v5, - uint8 v6 - ) internal pure returns (uint8[] memory arr) { - arr = new uint8[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function uint8s( - uint8 v0, - uint8 v1, - uint8 v2, - uint8 v3, - uint8 v4, - uint8 v5, - uint8 v6, - uint8 v7 - ) internal pure returns (uint8[] memory arr) { - arr = new uint8[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function uint8s( - uint8 v0, - uint8 v1, - uint8 v2, - uint8 v3, - uint8 v4, - uint8 v5, - uint8 v6, - uint8 v7, - uint8 v8 - ) internal pure returns (uint8[] memory arr) { - arr = new uint8[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function uint8s( - uint8 v0, - uint8 v1, - uint8 v2, - uint8 v3, - uint8 v4, - uint8 v5, - uint8 v6, - uint8 v7, - uint8 v8, - uint8 v9 - ) internal pure returns (uint8[] memory arr) { - arr = new uint8[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function uint8s( - uint8 v0, - uint8 v1, - uint8 v2, - uint8 v3, - uint8 v4, - uint8 v5, - uint8 v6, - uint8 v7, - uint8 v8, - uint8 v9, - uint8 v10 - ) internal pure returns (uint8[] memory arr) { - arr = new uint8[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function uint8s( - uint8 v0, - uint8 v1, - uint8 v2, - uint8 v3, - uint8 v4, - uint8 v5, - uint8 v6, - uint8 v7, - uint8 v8, - uint8 v9, - uint8 v10, - uint8 v11 - ) internal pure returns (uint8[] memory arr) { - arr = new uint8[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function uint16s(uint16 v0) internal pure returns (uint16[] memory arr) { - arr = new uint16[](1); - arr[0] = v0; - } - - function uint16s(uint16 v0, uint16 v1) internal pure returns (uint16[] memory arr) { - arr = new uint16[](2); - arr[0] = v0; - arr[1] = v1; - } - - function uint16s(uint16 v0, uint16 v1, uint16 v2) internal pure returns (uint16[] memory arr) { - arr = new uint16[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function uint16s(uint16 v0, uint16 v1, uint16 v2, uint16 v3) internal pure returns (uint16[] memory arr) { - arr = new uint16[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function uint16s( - uint16 v0, - uint16 v1, - uint16 v2, - uint16 v3, - uint16 v4 - ) internal pure returns (uint16[] memory arr) { - arr = new uint16[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function uint16s( - uint16 v0, - uint16 v1, - uint16 v2, - uint16 v3, - uint16 v4, - uint16 v5 - ) internal pure returns (uint16[] memory arr) { - arr = new uint16[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function uint16s( - uint16 v0, - uint16 v1, - uint16 v2, - uint16 v3, - uint16 v4, - uint16 v5, - uint16 v6 - ) internal pure returns (uint16[] memory arr) { - arr = new uint16[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function uint16s( - uint16 v0, - uint16 v1, - uint16 v2, - uint16 v3, - uint16 v4, - uint16 v5, - uint16 v6, - uint16 v7 - ) internal pure returns (uint16[] memory arr) { - arr = new uint16[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function uint16s( - uint16 v0, - uint16 v1, - uint16 v2, - uint16 v3, - uint16 v4, - uint16 v5, - uint16 v6, - uint16 v7, - uint16 v8 - ) internal pure returns (uint16[] memory arr) { - arr = new uint16[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function uint16s( - uint16 v0, - uint16 v1, - uint16 v2, - uint16 v3, - uint16 v4, - uint16 v5, - uint16 v6, - uint16 v7, - uint16 v8, - uint16 v9 - ) internal pure returns (uint16[] memory arr) { - arr = new uint16[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function uint16s( - uint16 v0, - uint16 v1, - uint16 v2, - uint16 v3, - uint16 v4, - uint16 v5, - uint16 v6, - uint16 v7, - uint16 v8, - uint16 v9, - uint16 v10 - ) internal pure returns (uint16[] memory arr) { - arr = new uint16[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function uint16s( - uint16 v0, - uint16 v1, - uint16 v2, - uint16 v3, - uint16 v4, - uint16 v5, - uint16 v6, - uint16 v7, - uint16 v8, - uint16 v9, - uint16 v10, - uint16 v11 - ) internal pure returns (uint16[] memory arr) { - arr = new uint16[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function uint24s(uint24 v0) internal pure returns (uint24[] memory arr) { - arr = new uint24[](1); - arr[0] = v0; - } - - function uint24s(uint24 v0, uint24 v1) internal pure returns (uint24[] memory arr) { - arr = new uint24[](2); - arr[0] = v0; - arr[1] = v1; - } - - function uint24s(uint24 v0, uint24 v1, uint24 v2) internal pure returns (uint24[] memory arr) { - arr = new uint24[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function uint24s(uint24 v0, uint24 v1, uint24 v2, uint24 v3) internal pure returns (uint24[] memory arr) { - arr = new uint24[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function uint24s( - uint24 v0, - uint24 v1, - uint24 v2, - uint24 v3, - uint24 v4 - ) internal pure returns (uint24[] memory arr) { - arr = new uint24[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function uint24s( - uint24 v0, - uint24 v1, - uint24 v2, - uint24 v3, - uint24 v4, - uint24 v5 - ) internal pure returns (uint24[] memory arr) { - arr = new uint24[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function uint24s( - uint24 v0, - uint24 v1, - uint24 v2, - uint24 v3, - uint24 v4, - uint24 v5, - uint24 v6 - ) internal pure returns (uint24[] memory arr) { - arr = new uint24[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function uint24s( - uint24 v0, - uint24 v1, - uint24 v2, - uint24 v3, - uint24 v4, - uint24 v5, - uint24 v6, - uint24 v7 - ) internal pure returns (uint24[] memory arr) { - arr = new uint24[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function uint24s( - uint24 v0, - uint24 v1, - uint24 v2, - uint24 v3, - uint24 v4, - uint24 v5, - uint24 v6, - uint24 v7, - uint24 v8 - ) internal pure returns (uint24[] memory arr) { - arr = new uint24[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function uint24s( - uint24 v0, - uint24 v1, - uint24 v2, - uint24 v3, - uint24 v4, - uint24 v5, - uint24 v6, - uint24 v7, - uint24 v8, - uint24 v9 - ) internal pure returns (uint24[] memory arr) { - arr = new uint24[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function uint24s( - uint24 v0, - uint24 v1, - uint24 v2, - uint24 v3, - uint24 v4, - uint24 v5, - uint24 v6, - uint24 v7, - uint24 v8, - uint24 v9, - uint24 v10 - ) internal pure returns (uint24[] memory arr) { - arr = new uint24[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function uint24s( - uint24 v0, - uint24 v1, - uint24 v2, - uint24 v3, - uint24 v4, - uint24 v5, - uint24 v6, - uint24 v7, - uint24 v8, - uint24 v9, - uint24 v10, - uint24 v11 - ) internal pure returns (uint24[] memory arr) { - arr = new uint24[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function uint32s(uint32 v0) internal pure returns (uint32[] memory arr) { - arr = new uint32[](1); - arr[0] = v0; - } - - function uint32s(uint32 v0, uint32 v1) internal pure returns (uint32[] memory arr) { - arr = new uint32[](2); - arr[0] = v0; - arr[1] = v1; - } - - function uint32s(uint32 v0, uint32 v1, uint32 v2) internal pure returns (uint32[] memory arr) { - arr = new uint32[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function uint32s(uint32 v0, uint32 v1, uint32 v2, uint32 v3) internal pure returns (uint32[] memory arr) { - arr = new uint32[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function uint32s( - uint32 v0, - uint32 v1, - uint32 v2, - uint32 v3, - uint32 v4 - ) internal pure returns (uint32[] memory arr) { - arr = new uint32[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function uint32s( - uint32 v0, - uint32 v1, - uint32 v2, - uint32 v3, - uint32 v4, - uint32 v5 - ) internal pure returns (uint32[] memory arr) { - arr = new uint32[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function uint32s( - uint32 v0, - uint32 v1, - uint32 v2, - uint32 v3, - uint32 v4, - uint32 v5, - uint32 v6 - ) internal pure returns (uint32[] memory arr) { - arr = new uint32[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function uint32s( - uint32 v0, - uint32 v1, - uint32 v2, - uint32 v3, - uint32 v4, - uint32 v5, - uint32 v6, - uint32 v7 - ) internal pure returns (uint32[] memory arr) { - arr = new uint32[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function uint32s( - uint32 v0, - uint32 v1, - uint32 v2, - uint32 v3, - uint32 v4, - uint32 v5, - uint32 v6, - uint32 v7, - uint32 v8 - ) internal pure returns (uint32[] memory arr) { - arr = new uint32[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function uint32s( - uint32 v0, - uint32 v1, - uint32 v2, - uint32 v3, - uint32 v4, - uint32 v5, - uint32 v6, - uint32 v7, - uint32 v8, - uint32 v9 - ) internal pure returns (uint32[] memory arr) { - arr = new uint32[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function uint32s( - uint32 v0, - uint32 v1, - uint32 v2, - uint32 v3, - uint32 v4, - uint32 v5, - uint32 v6, - uint32 v7, - uint32 v8, - uint32 v9, - uint32 v10 - ) internal pure returns (uint32[] memory arr) { - arr = new uint32[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function uint32s( - uint32 v0, - uint32 v1, - uint32 v2, - uint32 v3, - uint32 v4, - uint32 v5, - uint32 v6, - uint32 v7, - uint32 v8, - uint32 v9, - uint32 v10, - uint32 v11 - ) internal pure returns (uint32[] memory arr) { - arr = new uint32[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function uint40s(uint40 v0) internal pure returns (uint40[] memory arr) { - arr = new uint40[](1); - arr[0] = v0; - } - - function uint40s(uint40 v0, uint40 v1) internal pure returns (uint40[] memory arr) { - arr = new uint40[](2); - arr[0] = v0; - arr[1] = v1; - } - - function uint40s(uint40 v0, uint40 v1, uint40 v2) internal pure returns (uint40[] memory arr) { - arr = new uint40[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function uint40s(uint40 v0, uint40 v1, uint40 v2, uint40 v3) internal pure returns (uint40[] memory arr) { - arr = new uint40[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function uint40s( - uint40 v0, - uint40 v1, - uint40 v2, - uint40 v3, - uint40 v4 - ) internal pure returns (uint40[] memory arr) { - arr = new uint40[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function uint40s( - uint40 v0, - uint40 v1, - uint40 v2, - uint40 v3, - uint40 v4, - uint40 v5 - ) internal pure returns (uint40[] memory arr) { - arr = new uint40[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function uint40s( - uint40 v0, - uint40 v1, - uint40 v2, - uint40 v3, - uint40 v4, - uint40 v5, - uint40 v6 - ) internal pure returns (uint40[] memory arr) { - arr = new uint40[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function uint40s( - uint40 v0, - uint40 v1, - uint40 v2, - uint40 v3, - uint40 v4, - uint40 v5, - uint40 v6, - uint40 v7 - ) internal pure returns (uint40[] memory arr) { - arr = new uint40[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function uint40s( - uint40 v0, - uint40 v1, - uint40 v2, - uint40 v3, - uint40 v4, - uint40 v5, - uint40 v6, - uint40 v7, - uint40 v8 - ) internal pure returns (uint40[] memory arr) { - arr = new uint40[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function uint40s( - uint40 v0, - uint40 v1, - uint40 v2, - uint40 v3, - uint40 v4, - uint40 v5, - uint40 v6, - uint40 v7, - uint40 v8, - uint40 v9 - ) internal pure returns (uint40[] memory arr) { - arr = new uint40[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function uint40s( - uint40 v0, - uint40 v1, - uint40 v2, - uint40 v3, - uint40 v4, - uint40 v5, - uint40 v6, - uint40 v7, - uint40 v8, - uint40 v9, - uint40 v10 - ) internal pure returns (uint40[] memory arr) { - arr = new uint40[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function uint40s( - uint40 v0, - uint40 v1, - uint40 v2, - uint40 v3, - uint40 v4, - uint40 v5, - uint40 v6, - uint40 v7, - uint40 v8, - uint40 v9, - uint40 v10, - uint40 v11 - ) internal pure returns (uint40[] memory arr) { - arr = new uint40[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function uint48s(uint48 v0) internal pure returns (uint48[] memory arr) { - arr = new uint48[](1); - arr[0] = v0; - } - - function uint48s(uint48 v0, uint48 v1) internal pure returns (uint48[] memory arr) { - arr = new uint48[](2); - arr[0] = v0; - arr[1] = v1; - } - - function uint48s(uint48 v0, uint48 v1, uint48 v2) internal pure returns (uint48[] memory arr) { - arr = new uint48[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function uint48s(uint48 v0, uint48 v1, uint48 v2, uint48 v3) internal pure returns (uint48[] memory arr) { - arr = new uint48[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function uint48s( - uint48 v0, - uint48 v1, - uint48 v2, - uint48 v3, - uint48 v4 - ) internal pure returns (uint48[] memory arr) { - arr = new uint48[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function uint48s( - uint48 v0, - uint48 v1, - uint48 v2, - uint48 v3, - uint48 v4, - uint48 v5 - ) internal pure returns (uint48[] memory arr) { - arr = new uint48[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function uint48s( - uint48 v0, - uint48 v1, - uint48 v2, - uint48 v3, - uint48 v4, - uint48 v5, - uint48 v6 - ) internal pure returns (uint48[] memory arr) { - arr = new uint48[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function uint48s( - uint48 v0, - uint48 v1, - uint48 v2, - uint48 v3, - uint48 v4, - uint48 v5, - uint48 v6, - uint48 v7 - ) internal pure returns (uint48[] memory arr) { - arr = new uint48[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function uint48s( - uint48 v0, - uint48 v1, - uint48 v2, - uint48 v3, - uint48 v4, - uint48 v5, - uint48 v6, - uint48 v7, - uint48 v8 - ) internal pure returns (uint48[] memory arr) { - arr = new uint48[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function uint48s( - uint48 v0, - uint48 v1, - uint48 v2, - uint48 v3, - uint48 v4, - uint48 v5, - uint48 v6, - uint48 v7, - uint48 v8, - uint48 v9 - ) internal pure returns (uint48[] memory arr) { - arr = new uint48[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function uint48s( - uint48 v0, - uint48 v1, - uint48 v2, - uint48 v3, - uint48 v4, - uint48 v5, - uint48 v6, - uint48 v7, - uint48 v8, - uint48 v9, - uint48 v10 - ) internal pure returns (uint48[] memory arr) { - arr = new uint48[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function uint48s( - uint48 v0, - uint48 v1, - uint48 v2, - uint48 v3, - uint48 v4, - uint48 v5, - uint48 v6, - uint48 v7, - uint48 v8, - uint48 v9, - uint48 v10, - uint48 v11 - ) internal pure returns (uint48[] memory arr) { - arr = new uint48[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function uint64s(uint64 v0) internal pure returns (uint64[] memory arr) { - arr = new uint64[](1); - arr[0] = v0; - } - - function uint64s(uint64 v0, uint64 v1) internal pure returns (uint64[] memory arr) { - arr = new uint64[](2); - arr[0] = v0; - arr[1] = v1; - } - - function uint64s(uint64 v0, uint64 v1, uint64 v2) internal pure returns (uint64[] memory arr) { - arr = new uint64[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function uint64s(uint64 v0, uint64 v1, uint64 v2, uint64 v3) internal pure returns (uint64[] memory arr) { - arr = new uint64[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function uint64s( - uint64 v0, - uint64 v1, - uint64 v2, - uint64 v3, - uint64 v4 - ) internal pure returns (uint64[] memory arr) { - arr = new uint64[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function uint64s( - uint64 v0, - uint64 v1, - uint64 v2, - uint64 v3, - uint64 v4, - uint64 v5 - ) internal pure returns (uint64[] memory arr) { - arr = new uint64[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function uint64s( - uint64 v0, - uint64 v1, - uint64 v2, - uint64 v3, - uint64 v4, - uint64 v5, - uint64 v6 - ) internal pure returns (uint64[] memory arr) { - arr = new uint64[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function uint64s( - uint64 v0, - uint64 v1, - uint64 v2, - uint64 v3, - uint64 v4, - uint64 v5, - uint64 v6, - uint64 v7 - ) internal pure returns (uint64[] memory arr) { - arr = new uint64[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function uint64s( - uint64 v0, - uint64 v1, - uint64 v2, - uint64 v3, - uint64 v4, - uint64 v5, - uint64 v6, - uint64 v7, - uint64 v8 - ) internal pure returns (uint64[] memory arr) { - arr = new uint64[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function uint64s( - uint64 v0, - uint64 v1, - uint64 v2, - uint64 v3, - uint64 v4, - uint64 v5, - uint64 v6, - uint64 v7, - uint64 v8, - uint64 v9 - ) internal pure returns (uint64[] memory arr) { - arr = new uint64[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function uint64s( - uint64 v0, - uint64 v1, - uint64 v2, - uint64 v3, - uint64 v4, - uint64 v5, - uint64 v6, - uint64 v7, - uint64 v8, - uint64 v9, - uint64 v10 - ) internal pure returns (uint64[] memory arr) { - arr = new uint64[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function uint64s( - uint64 v0, - uint64 v1, - uint64 v2, - uint64 v3, - uint64 v4, - uint64 v5, - uint64 v6, - uint64 v7, - uint64 v8, - uint64 v9, - uint64 v10, - uint64 v11 - ) internal pure returns (uint64[] memory arr) { - arr = new uint64[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function uint96s(uint96 v0) internal pure returns (uint96[] memory arr) { - arr = new uint96[](1); - arr[0] = v0; - } - - function uint96s(uint96 v0, uint96 v1) internal pure returns (uint96[] memory arr) { - arr = new uint96[](2); - arr[0] = v0; - arr[1] = v1; - } - - function uint96s(uint96 v0, uint96 v1, uint96 v2) internal pure returns (uint96[] memory arr) { - arr = new uint96[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function uint96s(uint96 v0, uint96 v1, uint96 v2, uint96 v3) internal pure returns (uint96[] memory arr) { - arr = new uint96[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function uint96s( - uint96 v0, - uint96 v1, - uint96 v2, - uint96 v3, - uint96 v4 - ) internal pure returns (uint96[] memory arr) { - arr = new uint96[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function uint96s( - uint96 v0, - uint96 v1, - uint96 v2, - uint96 v3, - uint96 v4, - uint96 v5 - ) internal pure returns (uint96[] memory arr) { - arr = new uint96[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function uint96s( - uint96 v0, - uint96 v1, - uint96 v2, - uint96 v3, - uint96 v4, - uint96 v5, - uint96 v6 - ) internal pure returns (uint96[] memory arr) { - arr = new uint96[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function uint96s( - uint96 v0, - uint96 v1, - uint96 v2, - uint96 v3, - uint96 v4, - uint96 v5, - uint96 v6, - uint96 v7 - ) internal pure returns (uint96[] memory arr) { - arr = new uint96[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function uint96s( - uint96 v0, - uint96 v1, - uint96 v2, - uint96 v3, - uint96 v4, - uint96 v5, - uint96 v6, - uint96 v7, - uint96 v8 - ) internal pure returns (uint96[] memory arr) { - arr = new uint96[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function uint96s( - uint96 v0, - uint96 v1, - uint96 v2, - uint96 v3, - uint96 v4, - uint96 v5, - uint96 v6, - uint96 v7, - uint96 v8, - uint96 v9 - ) internal pure returns (uint96[] memory arr) { - arr = new uint96[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function uint96s( - uint96 v0, - uint96 v1, - uint96 v2, - uint96 v3, - uint96 v4, - uint96 v5, - uint96 v6, - uint96 v7, - uint96 v8, - uint96 v9, - uint96 v10 - ) internal pure returns (uint96[] memory arr) { - arr = new uint96[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function uint96s( - uint96 v0, - uint96 v1, - uint96 v2, - uint96 v3, - uint96 v4, - uint96 v5, - uint96 v6, - uint96 v7, - uint96 v8, - uint96 v9, - uint96 v10, - uint96 v11 - ) internal pure returns (uint96[] memory arr) { - arr = new uint96[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function uint128s(uint128 v0) internal pure returns (uint128[] memory arr) { - arr = new uint128[](1); - arr[0] = v0; - } - - function uint128s(uint128 v0, uint128 v1) internal pure returns (uint128[] memory arr) { - arr = new uint128[](2); - arr[0] = v0; - arr[1] = v1; - } - - function uint128s(uint128 v0, uint128 v1, uint128 v2) internal pure returns (uint128[] memory arr) { - arr = new uint128[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function uint128s(uint128 v0, uint128 v1, uint128 v2, uint128 v3) internal pure returns (uint128[] memory arr) { - arr = new uint128[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function uint128s( - uint128 v0, - uint128 v1, - uint128 v2, - uint128 v3, - uint128 v4 - ) internal pure returns (uint128[] memory arr) { - arr = new uint128[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function uint128s( - uint128 v0, - uint128 v1, - uint128 v2, - uint128 v3, - uint128 v4, - uint128 v5 - ) internal pure returns (uint128[] memory arr) { - arr = new uint128[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function uint128s( - uint128 v0, - uint128 v1, - uint128 v2, - uint128 v3, - uint128 v4, - uint128 v5, - uint128 v6 - ) internal pure returns (uint128[] memory arr) { - arr = new uint128[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function uint128s( - uint128 v0, - uint128 v1, - uint128 v2, - uint128 v3, - uint128 v4, - uint128 v5, - uint128 v6, - uint128 v7 - ) internal pure returns (uint128[] memory arr) { - arr = new uint128[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function uint128s( - uint128 v0, - uint128 v1, - uint128 v2, - uint128 v3, - uint128 v4, - uint128 v5, - uint128 v6, - uint128 v7, - uint128 v8 - ) internal pure returns (uint128[] memory arr) { - arr = new uint128[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function uint128s( - uint128 v0, - uint128 v1, - uint128 v2, - uint128 v3, - uint128 v4, - uint128 v5, - uint128 v6, - uint128 v7, - uint128 v8, - uint128 v9 - ) internal pure returns (uint128[] memory arr) { - arr = new uint128[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function uint128s( - uint128 v0, - uint128 v1, - uint128 v2, - uint128 v3, - uint128 v4, - uint128 v5, - uint128 v6, - uint128 v7, - uint128 v8, - uint128 v9, - uint128 v10 - ) internal pure returns (uint128[] memory arr) { - arr = new uint128[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function uint128s( - uint128 v0, - uint128 v1, - uint128 v2, - uint128 v3, - uint128 v4, - uint128 v5, - uint128 v6, - uint128 v7, - uint128 v8, - uint128 v9, - uint128 v10, - uint128 v11 - ) internal pure returns (uint128[] memory arr) { - arr = new uint128[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function uint160s(uint160 v0) internal pure returns (uint160[] memory arr) { - arr = new uint160[](1); - arr[0] = v0; - } - - function uint160s(uint160 v0, uint160 v1) internal pure returns (uint160[] memory arr) { - arr = new uint160[](2); - arr[0] = v0; - arr[1] = v1; - } - - function uint160s(uint160 v0, uint160 v1, uint160 v2) internal pure returns (uint160[] memory arr) { - arr = new uint160[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function uint160s(uint160 v0, uint160 v1, uint160 v2, uint160 v3) internal pure returns (uint160[] memory arr) { - arr = new uint160[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function uint160s( - uint160 v0, - uint160 v1, - uint160 v2, - uint160 v3, - uint160 v4 - ) internal pure returns (uint160[] memory arr) { - arr = new uint160[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function uint160s( - uint160 v0, - uint160 v1, - uint160 v2, - uint160 v3, - uint160 v4, - uint160 v5 - ) internal pure returns (uint160[] memory arr) { - arr = new uint160[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function uint160s( - uint160 v0, - uint160 v1, - uint160 v2, - uint160 v3, - uint160 v4, - uint160 v5, - uint160 v6 - ) internal pure returns (uint160[] memory arr) { - arr = new uint160[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function uint160s( - uint160 v0, - uint160 v1, - uint160 v2, - uint160 v3, - uint160 v4, - uint160 v5, - uint160 v6, - uint160 v7 - ) internal pure returns (uint160[] memory arr) { - arr = new uint160[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function uint160s( - uint160 v0, - uint160 v1, - uint160 v2, - uint160 v3, - uint160 v4, - uint160 v5, - uint160 v6, - uint160 v7, - uint160 v8 - ) internal pure returns (uint160[] memory arr) { - arr = new uint160[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function uint160s( - uint160 v0, - uint160 v1, - uint160 v2, - uint160 v3, - uint160 v4, - uint160 v5, - uint160 v6, - uint160 v7, - uint160 v8, - uint160 v9 - ) internal pure returns (uint160[] memory arr) { - arr = new uint160[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function uint160s( - uint160 v0, - uint160 v1, - uint160 v2, - uint160 v3, - uint160 v4, - uint160 v5, - uint160 v6, - uint160 v7, - uint160 v8, - uint160 v9, - uint160 v10 - ) internal pure returns (uint160[] memory arr) { - arr = new uint160[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function uint160s( - uint160 v0, - uint160 v1, - uint160 v2, - uint160 v3, - uint160 v4, - uint160 v5, - uint160 v6, - uint160 v7, - uint160 v8, - uint160 v9, - uint160 v10, - uint160 v11 - ) internal pure returns (uint160[] memory arr) { - arr = new uint160[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function uint256s(uint256 v0) internal pure returns (uint256[] memory arr) { - arr = new uint256[](1); - arr[0] = v0; - } - - function uint256s(uint256 v0, uint256 v1) internal pure returns (uint256[] memory arr) { - arr = new uint256[](2); - arr[0] = v0; - arr[1] = v1; - } - - function uint256s(uint256 v0, uint256 v1, uint256 v2) internal pure returns (uint256[] memory arr) { - arr = new uint256[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function uint256s(uint256 v0, uint256 v1, uint256 v2, uint256 v3) internal pure returns (uint256[] memory arr) { - arr = new uint256[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function uint256s( - uint256 v0, - uint256 v1, - uint256 v2, - uint256 v3, - uint256 v4 - ) internal pure returns (uint256[] memory arr) { - arr = new uint256[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function uint256s( - uint256 v0, - uint256 v1, - uint256 v2, - uint256 v3, - uint256 v4, - uint256 v5 - ) internal pure returns (uint256[] memory arr) { - arr = new uint256[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function uint256s( - uint256 v0, - uint256 v1, - uint256 v2, - uint256 v3, - uint256 v4, - uint256 v5, - uint256 v6 - ) internal pure returns (uint256[] memory arr) { - arr = new uint256[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function uint256s( - uint256 v0, - uint256 v1, - uint256 v2, - uint256 v3, - uint256 v4, - uint256 v5, - uint256 v6, - uint256 v7 - ) internal pure returns (uint256[] memory arr) { - arr = new uint256[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function uint256s( - uint256 v0, - uint256 v1, - uint256 v2, - uint256 v3, - uint256 v4, - uint256 v5, - uint256 v6, - uint256 v7, - uint256 v8 - ) internal pure returns (uint256[] memory arr) { - arr = new uint256[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function uint256s( - uint256 v0, - uint256 v1, - uint256 v2, - uint256 v3, - uint256 v4, - uint256 v5, - uint256 v6, - uint256 v7, - uint256 v8, - uint256 v9 - ) internal pure returns (uint256[] memory arr) { - arr = new uint256[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function uint256s( - uint256 v0, - uint256 v1, - uint256 v2, - uint256 v3, - uint256 v4, - uint256 v5, - uint256 v6, - uint256 v7, - uint256 v8, - uint256 v9, - uint256 v10 - ) internal pure returns (uint256[] memory arr) { - arr = new uint256[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function uint256s( - uint256 v0, - uint256 v1, - uint256 v2, - uint256 v3, - uint256 v4, - uint256 v5, - uint256 v6, - uint256 v7, - uint256 v8, - uint256 v9, - uint256 v10, - uint256 v11 - ) internal pure returns (uint256[] memory arr) { - arr = new uint256[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function int8s(int8 v0) internal pure returns (int8[] memory arr) { - arr = new int8[](1); - arr[0] = v0; - } - - function int8s(int8 v0, int8 v1) internal pure returns (int8[] memory arr) { - arr = new int8[](2); - arr[0] = v0; - arr[1] = v1; - } - - function int8s(int8 v0, int8 v1, int8 v2) internal pure returns (int8[] memory arr) { - arr = new int8[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function int8s(int8 v0, int8 v1, int8 v2, int8 v3) internal pure returns (int8[] memory arr) { - arr = new int8[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function int8s(int8 v0, int8 v1, int8 v2, int8 v3, int8 v4) internal pure returns (int8[] memory arr) { - arr = new int8[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function int8s(int8 v0, int8 v1, int8 v2, int8 v3, int8 v4, int8 v5) internal pure returns (int8[] memory arr) { - arr = new int8[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function int8s( - int8 v0, - int8 v1, - int8 v2, - int8 v3, - int8 v4, - int8 v5, - int8 v6 - ) internal pure returns (int8[] memory arr) { - arr = new int8[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function int8s( - int8 v0, - int8 v1, - int8 v2, - int8 v3, - int8 v4, - int8 v5, - int8 v6, - int8 v7 - ) internal pure returns (int8[] memory arr) { - arr = new int8[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function int8s( - int8 v0, - int8 v1, - int8 v2, - int8 v3, - int8 v4, - int8 v5, - int8 v6, - int8 v7, - int8 v8 - ) internal pure returns (int8[] memory arr) { - arr = new int8[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function int8s( - int8 v0, - int8 v1, - int8 v2, - int8 v3, - int8 v4, - int8 v5, - int8 v6, - int8 v7, - int8 v8, - int8 v9 - ) internal pure returns (int8[] memory arr) { - arr = new int8[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function int8s( - int8 v0, - int8 v1, - int8 v2, - int8 v3, - int8 v4, - int8 v5, - int8 v6, - int8 v7, - int8 v8, - int8 v9, - int8 v10 - ) internal pure returns (int8[] memory arr) { - arr = new int8[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function int8s( - int8 v0, - int8 v1, - int8 v2, - int8 v3, - int8 v4, - int8 v5, - int8 v6, - int8 v7, - int8 v8, - int8 v9, - int8 v10, - int8 v11 - ) internal pure returns (int8[] memory arr) { - arr = new int8[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function int16s(int16 v0) internal pure returns (int16[] memory arr) { - arr = new int16[](1); - arr[0] = v0; - } - - function int16s(int16 v0, int16 v1) internal pure returns (int16[] memory arr) { - arr = new int16[](2); - arr[0] = v0; - arr[1] = v1; - } - - function int16s(int16 v0, int16 v1, int16 v2) internal pure returns (int16[] memory arr) { - arr = new int16[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function int16s(int16 v0, int16 v1, int16 v2, int16 v3) internal pure returns (int16[] memory arr) { - arr = new int16[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function int16s(int16 v0, int16 v1, int16 v2, int16 v3, int16 v4) internal pure returns (int16[] memory arr) { - arr = new int16[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function int16s( - int16 v0, - int16 v1, - int16 v2, - int16 v3, - int16 v4, - int16 v5 - ) internal pure returns (int16[] memory arr) { - arr = new int16[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function int16s( - int16 v0, - int16 v1, - int16 v2, - int16 v3, - int16 v4, - int16 v5, - int16 v6 - ) internal pure returns (int16[] memory arr) { - arr = new int16[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function int16s( - int16 v0, - int16 v1, - int16 v2, - int16 v3, - int16 v4, - int16 v5, - int16 v6, - int16 v7 - ) internal pure returns (int16[] memory arr) { - arr = new int16[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function int16s( - int16 v0, - int16 v1, - int16 v2, - int16 v3, - int16 v4, - int16 v5, - int16 v6, - int16 v7, - int16 v8 - ) internal pure returns (int16[] memory arr) { - arr = new int16[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function int16s( - int16 v0, - int16 v1, - int16 v2, - int16 v3, - int16 v4, - int16 v5, - int16 v6, - int16 v7, - int16 v8, - int16 v9 - ) internal pure returns (int16[] memory arr) { - arr = new int16[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function int16s( - int16 v0, - int16 v1, - int16 v2, - int16 v3, - int16 v4, - int16 v5, - int16 v6, - int16 v7, - int16 v8, - int16 v9, - int16 v10 - ) internal pure returns (int16[] memory arr) { - arr = new int16[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function int16s( - int16 v0, - int16 v1, - int16 v2, - int16 v3, - int16 v4, - int16 v5, - int16 v6, - int16 v7, - int16 v8, - int16 v9, - int16 v10, - int16 v11 - ) internal pure returns (int16[] memory arr) { - arr = new int16[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function int24s(int24 v0) internal pure returns (int24[] memory arr) { - arr = new int24[](1); - arr[0] = v0; - } - - function int24s(int24 v0, int24 v1) internal pure returns (int24[] memory arr) { - arr = new int24[](2); - arr[0] = v0; - arr[1] = v1; - } - - function int24s(int24 v0, int24 v1, int24 v2) internal pure returns (int24[] memory arr) { - arr = new int24[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function int24s(int24 v0, int24 v1, int24 v2, int24 v3) internal pure returns (int24[] memory arr) { - arr = new int24[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function int24s(int24 v0, int24 v1, int24 v2, int24 v3, int24 v4) internal pure returns (int24[] memory arr) { - arr = new int24[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function int24s( - int24 v0, - int24 v1, - int24 v2, - int24 v3, - int24 v4, - int24 v5 - ) internal pure returns (int24[] memory arr) { - arr = new int24[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function int24s( - int24 v0, - int24 v1, - int24 v2, - int24 v3, - int24 v4, - int24 v5, - int24 v6 - ) internal pure returns (int24[] memory arr) { - arr = new int24[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function int24s( - int24 v0, - int24 v1, - int24 v2, - int24 v3, - int24 v4, - int24 v5, - int24 v6, - int24 v7 - ) internal pure returns (int24[] memory arr) { - arr = new int24[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function int24s( - int24 v0, - int24 v1, - int24 v2, - int24 v3, - int24 v4, - int24 v5, - int24 v6, - int24 v7, - int24 v8 - ) internal pure returns (int24[] memory arr) { - arr = new int24[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function int24s( - int24 v0, - int24 v1, - int24 v2, - int24 v3, - int24 v4, - int24 v5, - int24 v6, - int24 v7, - int24 v8, - int24 v9 - ) internal pure returns (int24[] memory arr) { - arr = new int24[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function int24s( - int24 v0, - int24 v1, - int24 v2, - int24 v3, - int24 v4, - int24 v5, - int24 v6, - int24 v7, - int24 v8, - int24 v9, - int24 v10 - ) internal pure returns (int24[] memory arr) { - arr = new int24[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function int24s( - int24 v0, - int24 v1, - int24 v2, - int24 v3, - int24 v4, - int24 v5, - int24 v6, - int24 v7, - int24 v8, - int24 v9, - int24 v10, - int24 v11 - ) internal pure returns (int24[] memory arr) { - arr = new int24[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function int32s(int32 v0) internal pure returns (int32[] memory arr) { - arr = new int32[](1); - arr[0] = v0; - } - - function int32s(int32 v0, int32 v1) internal pure returns (int32[] memory arr) { - arr = new int32[](2); - arr[0] = v0; - arr[1] = v1; - } - - function int32s(int32 v0, int32 v1, int32 v2) internal pure returns (int32[] memory arr) { - arr = new int32[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function int32s(int32 v0, int32 v1, int32 v2, int32 v3) internal pure returns (int32[] memory arr) { - arr = new int32[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function int32s(int32 v0, int32 v1, int32 v2, int32 v3, int32 v4) internal pure returns (int32[] memory arr) { - arr = new int32[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function int32s( - int32 v0, - int32 v1, - int32 v2, - int32 v3, - int32 v4, - int32 v5 - ) internal pure returns (int32[] memory arr) { - arr = new int32[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function int32s( - int32 v0, - int32 v1, - int32 v2, - int32 v3, - int32 v4, - int32 v5, - int32 v6 - ) internal pure returns (int32[] memory arr) { - arr = new int32[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function int32s( - int32 v0, - int32 v1, - int32 v2, - int32 v3, - int32 v4, - int32 v5, - int32 v6, - int32 v7 - ) internal pure returns (int32[] memory arr) { - arr = new int32[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function int32s( - int32 v0, - int32 v1, - int32 v2, - int32 v3, - int32 v4, - int32 v5, - int32 v6, - int32 v7, - int32 v8 - ) internal pure returns (int32[] memory arr) { - arr = new int32[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function int32s( - int32 v0, - int32 v1, - int32 v2, - int32 v3, - int32 v4, - int32 v5, - int32 v6, - int32 v7, - int32 v8, - int32 v9 - ) internal pure returns (int32[] memory arr) { - arr = new int32[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function int32s( - int32 v0, - int32 v1, - int32 v2, - int32 v3, - int32 v4, - int32 v5, - int32 v6, - int32 v7, - int32 v8, - int32 v9, - int32 v10 - ) internal pure returns (int32[] memory arr) { - arr = new int32[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function int32s( - int32 v0, - int32 v1, - int32 v2, - int32 v3, - int32 v4, - int32 v5, - int32 v6, - int32 v7, - int32 v8, - int32 v9, - int32 v10, - int32 v11 - ) internal pure returns (int32[] memory arr) { - arr = new int32[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function int40s(int40 v0) internal pure returns (int40[] memory arr) { - arr = new int40[](1); - arr[0] = v0; - } - - function int40s(int40 v0, int40 v1) internal pure returns (int40[] memory arr) { - arr = new int40[](2); - arr[0] = v0; - arr[1] = v1; - } - - function int40s(int40 v0, int40 v1, int40 v2) internal pure returns (int40[] memory arr) { - arr = new int40[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function int40s(int40 v0, int40 v1, int40 v2, int40 v3) internal pure returns (int40[] memory arr) { - arr = new int40[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function int40s(int40 v0, int40 v1, int40 v2, int40 v3, int40 v4) internal pure returns (int40[] memory arr) { - arr = new int40[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function int40s( - int40 v0, - int40 v1, - int40 v2, - int40 v3, - int40 v4, - int40 v5 - ) internal pure returns (int40[] memory arr) { - arr = new int40[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function int40s( - int40 v0, - int40 v1, - int40 v2, - int40 v3, - int40 v4, - int40 v5, - int40 v6 - ) internal pure returns (int40[] memory arr) { - arr = new int40[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function int40s( - int40 v0, - int40 v1, - int40 v2, - int40 v3, - int40 v4, - int40 v5, - int40 v6, - int40 v7 - ) internal pure returns (int40[] memory arr) { - arr = new int40[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function int40s( - int40 v0, - int40 v1, - int40 v2, - int40 v3, - int40 v4, - int40 v5, - int40 v6, - int40 v7, - int40 v8 - ) internal pure returns (int40[] memory arr) { - arr = new int40[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function int40s( - int40 v0, - int40 v1, - int40 v2, - int40 v3, - int40 v4, - int40 v5, - int40 v6, - int40 v7, - int40 v8, - int40 v9 - ) internal pure returns (int40[] memory arr) { - arr = new int40[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function int40s( - int40 v0, - int40 v1, - int40 v2, - int40 v3, - int40 v4, - int40 v5, - int40 v6, - int40 v7, - int40 v8, - int40 v9, - int40 v10 - ) internal pure returns (int40[] memory arr) { - arr = new int40[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function int40s( - int40 v0, - int40 v1, - int40 v2, - int40 v3, - int40 v4, - int40 v5, - int40 v6, - int40 v7, - int40 v8, - int40 v9, - int40 v10, - int40 v11 - ) internal pure returns (int40[] memory arr) { - arr = new int40[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function int48s(int48 v0) internal pure returns (int48[] memory arr) { - arr = new int48[](1); - arr[0] = v0; - } - - function int48s(int48 v0, int48 v1) internal pure returns (int48[] memory arr) { - arr = new int48[](2); - arr[0] = v0; - arr[1] = v1; - } - - function int48s(int48 v0, int48 v1, int48 v2) internal pure returns (int48[] memory arr) { - arr = new int48[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function int48s(int48 v0, int48 v1, int48 v2, int48 v3) internal pure returns (int48[] memory arr) { - arr = new int48[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function int48s(int48 v0, int48 v1, int48 v2, int48 v3, int48 v4) internal pure returns (int48[] memory arr) { - arr = new int48[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function int48s( - int48 v0, - int48 v1, - int48 v2, - int48 v3, - int48 v4, - int48 v5 - ) internal pure returns (int48[] memory arr) { - arr = new int48[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function int48s( - int48 v0, - int48 v1, - int48 v2, - int48 v3, - int48 v4, - int48 v5, - int48 v6 - ) internal pure returns (int48[] memory arr) { - arr = new int48[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function int48s( - int48 v0, - int48 v1, - int48 v2, - int48 v3, - int48 v4, - int48 v5, - int48 v6, - int48 v7 - ) internal pure returns (int48[] memory arr) { - arr = new int48[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function int48s( - int48 v0, - int48 v1, - int48 v2, - int48 v3, - int48 v4, - int48 v5, - int48 v6, - int48 v7, - int48 v8 - ) internal pure returns (int48[] memory arr) { - arr = new int48[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function int48s( - int48 v0, - int48 v1, - int48 v2, - int48 v3, - int48 v4, - int48 v5, - int48 v6, - int48 v7, - int48 v8, - int48 v9 - ) internal pure returns (int48[] memory arr) { - arr = new int48[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function int48s( - int48 v0, - int48 v1, - int48 v2, - int48 v3, - int48 v4, - int48 v5, - int48 v6, - int48 v7, - int48 v8, - int48 v9, - int48 v10 - ) internal pure returns (int48[] memory arr) { - arr = new int48[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function int48s( - int48 v0, - int48 v1, - int48 v2, - int48 v3, - int48 v4, - int48 v5, - int48 v6, - int48 v7, - int48 v8, - int48 v9, - int48 v10, - int48 v11 - ) internal pure returns (int48[] memory arr) { - arr = new int48[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function int64s(int64 v0) internal pure returns (int64[] memory arr) { - arr = new int64[](1); - arr[0] = v0; - } - - function int64s(int64 v0, int64 v1) internal pure returns (int64[] memory arr) { - arr = new int64[](2); - arr[0] = v0; - arr[1] = v1; - } - - function int64s(int64 v0, int64 v1, int64 v2) internal pure returns (int64[] memory arr) { - arr = new int64[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function int64s(int64 v0, int64 v1, int64 v2, int64 v3) internal pure returns (int64[] memory arr) { - arr = new int64[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function int64s(int64 v0, int64 v1, int64 v2, int64 v3, int64 v4) internal pure returns (int64[] memory arr) { - arr = new int64[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function int64s( - int64 v0, - int64 v1, - int64 v2, - int64 v3, - int64 v4, - int64 v5 - ) internal pure returns (int64[] memory arr) { - arr = new int64[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function int64s( - int64 v0, - int64 v1, - int64 v2, - int64 v3, - int64 v4, - int64 v5, - int64 v6 - ) internal pure returns (int64[] memory arr) { - arr = new int64[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function int64s( - int64 v0, - int64 v1, - int64 v2, - int64 v3, - int64 v4, - int64 v5, - int64 v6, - int64 v7 - ) internal pure returns (int64[] memory arr) { - arr = new int64[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function int64s( - int64 v0, - int64 v1, - int64 v2, - int64 v3, - int64 v4, - int64 v5, - int64 v6, - int64 v7, - int64 v8 - ) internal pure returns (int64[] memory arr) { - arr = new int64[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function int64s( - int64 v0, - int64 v1, - int64 v2, - int64 v3, - int64 v4, - int64 v5, - int64 v6, - int64 v7, - int64 v8, - int64 v9 - ) internal pure returns (int64[] memory arr) { - arr = new int64[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function int64s( - int64 v0, - int64 v1, - int64 v2, - int64 v3, - int64 v4, - int64 v5, - int64 v6, - int64 v7, - int64 v8, - int64 v9, - int64 v10 - ) internal pure returns (int64[] memory arr) { - arr = new int64[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function int64s( - int64 v0, - int64 v1, - int64 v2, - int64 v3, - int64 v4, - int64 v5, - int64 v6, - int64 v7, - int64 v8, - int64 v9, - int64 v10, - int64 v11 - ) internal pure returns (int64[] memory arr) { - arr = new int64[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function int96s(int96 v0) internal pure returns (int96[] memory arr) { - arr = new int96[](1); - arr[0] = v0; - } - - function int96s(int96 v0, int96 v1) internal pure returns (int96[] memory arr) { - arr = new int96[](2); - arr[0] = v0; - arr[1] = v1; - } - - function int96s(int96 v0, int96 v1, int96 v2) internal pure returns (int96[] memory arr) { - arr = new int96[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function int96s(int96 v0, int96 v1, int96 v2, int96 v3) internal pure returns (int96[] memory arr) { - arr = new int96[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function int96s(int96 v0, int96 v1, int96 v2, int96 v3, int96 v4) internal pure returns (int96[] memory arr) { - arr = new int96[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function int96s( - int96 v0, - int96 v1, - int96 v2, - int96 v3, - int96 v4, - int96 v5 - ) internal pure returns (int96[] memory arr) { - arr = new int96[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function int96s( - int96 v0, - int96 v1, - int96 v2, - int96 v3, - int96 v4, - int96 v5, - int96 v6 - ) internal pure returns (int96[] memory arr) { - arr = new int96[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function int96s( - int96 v0, - int96 v1, - int96 v2, - int96 v3, - int96 v4, - int96 v5, - int96 v6, - int96 v7 - ) internal pure returns (int96[] memory arr) { - arr = new int96[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function int96s( - int96 v0, - int96 v1, - int96 v2, - int96 v3, - int96 v4, - int96 v5, - int96 v6, - int96 v7, - int96 v8 - ) internal pure returns (int96[] memory arr) { - arr = new int96[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function int96s( - int96 v0, - int96 v1, - int96 v2, - int96 v3, - int96 v4, - int96 v5, - int96 v6, - int96 v7, - int96 v8, - int96 v9 - ) internal pure returns (int96[] memory arr) { - arr = new int96[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function int96s( - int96 v0, - int96 v1, - int96 v2, - int96 v3, - int96 v4, - int96 v5, - int96 v6, - int96 v7, - int96 v8, - int96 v9, - int96 v10 - ) internal pure returns (int96[] memory arr) { - arr = new int96[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function int96s( - int96 v0, - int96 v1, - int96 v2, - int96 v3, - int96 v4, - int96 v5, - int96 v6, - int96 v7, - int96 v8, - int96 v9, - int96 v10, - int96 v11 - ) internal pure returns (int96[] memory arr) { - arr = new int96[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function int128s(int128 v0) internal pure returns (int128[] memory arr) { - arr = new int128[](1); - arr[0] = v0; - } - - function int128s(int128 v0, int128 v1) internal pure returns (int128[] memory arr) { - arr = new int128[](2); - arr[0] = v0; - arr[1] = v1; - } - - function int128s(int128 v0, int128 v1, int128 v2) internal pure returns (int128[] memory arr) { - arr = new int128[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function int128s(int128 v0, int128 v1, int128 v2, int128 v3) internal pure returns (int128[] memory arr) { - arr = new int128[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function int128s( - int128 v0, - int128 v1, - int128 v2, - int128 v3, - int128 v4 - ) internal pure returns (int128[] memory arr) { - arr = new int128[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function int128s( - int128 v0, - int128 v1, - int128 v2, - int128 v3, - int128 v4, - int128 v5 - ) internal pure returns (int128[] memory arr) { - arr = new int128[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function int128s( - int128 v0, - int128 v1, - int128 v2, - int128 v3, - int128 v4, - int128 v5, - int128 v6 - ) internal pure returns (int128[] memory arr) { - arr = new int128[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function int128s( - int128 v0, - int128 v1, - int128 v2, - int128 v3, - int128 v4, - int128 v5, - int128 v6, - int128 v7 - ) internal pure returns (int128[] memory arr) { - arr = new int128[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function int128s( - int128 v0, - int128 v1, - int128 v2, - int128 v3, - int128 v4, - int128 v5, - int128 v6, - int128 v7, - int128 v8 - ) internal pure returns (int128[] memory arr) { - arr = new int128[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function int128s( - int128 v0, - int128 v1, - int128 v2, - int128 v3, - int128 v4, - int128 v5, - int128 v6, - int128 v7, - int128 v8, - int128 v9 - ) internal pure returns (int128[] memory arr) { - arr = new int128[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function int128s( - int128 v0, - int128 v1, - int128 v2, - int128 v3, - int128 v4, - int128 v5, - int128 v6, - int128 v7, - int128 v8, - int128 v9, - int128 v10 - ) internal pure returns (int128[] memory arr) { - arr = new int128[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function int128s( - int128 v0, - int128 v1, - int128 v2, - int128 v3, - int128 v4, - int128 v5, - int128 v6, - int128 v7, - int128 v8, - int128 v9, - int128 v10, - int128 v11 - ) internal pure returns (int128[] memory arr) { - arr = new int128[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function int160s(int160 v0) internal pure returns (int160[] memory arr) { - arr = new int160[](1); - arr[0] = v0; - } - - function int160s(int160 v0, int160 v1) internal pure returns (int160[] memory arr) { - arr = new int160[](2); - arr[0] = v0; - arr[1] = v1; - } - - function int160s(int160 v0, int160 v1, int160 v2) internal pure returns (int160[] memory arr) { - arr = new int160[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function int160s(int160 v0, int160 v1, int160 v2, int160 v3) internal pure returns (int160[] memory arr) { - arr = new int160[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function int160s( - int160 v0, - int160 v1, - int160 v2, - int160 v3, - int160 v4 - ) internal pure returns (int160[] memory arr) { - arr = new int160[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function int160s( - int160 v0, - int160 v1, - int160 v2, - int160 v3, - int160 v4, - int160 v5 - ) internal pure returns (int160[] memory arr) { - arr = new int160[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function int160s( - int160 v0, - int160 v1, - int160 v2, - int160 v3, - int160 v4, - int160 v5, - int160 v6 - ) internal pure returns (int160[] memory arr) { - arr = new int160[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function int160s( - int160 v0, - int160 v1, - int160 v2, - int160 v3, - int160 v4, - int160 v5, - int160 v6, - int160 v7 - ) internal pure returns (int160[] memory arr) { - arr = new int160[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function int160s( - int160 v0, - int160 v1, - int160 v2, - int160 v3, - int160 v4, - int160 v5, - int160 v6, - int160 v7, - int160 v8 - ) internal pure returns (int160[] memory arr) { - arr = new int160[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function int160s( - int160 v0, - int160 v1, - int160 v2, - int160 v3, - int160 v4, - int160 v5, - int160 v6, - int160 v7, - int160 v8, - int160 v9 - ) internal pure returns (int160[] memory arr) { - arr = new int160[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function int160s( - int160 v0, - int160 v1, - int160 v2, - int160 v3, - int160 v4, - int160 v5, - int160 v6, - int160 v7, - int160 v8, - int160 v9, - int160 v10 - ) internal pure returns (int160[] memory arr) { - arr = new int160[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function int160s( - int160 v0, - int160 v1, - int160 v2, - int160 v3, - int160 v4, - int160 v5, - int160 v6, - int160 v7, - int160 v8, - int160 v9, - int160 v10, - int160 v11 - ) internal pure returns (int160[] memory arr) { - arr = new int160[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function int256s(int256 v0) internal pure returns (int256[] memory arr) { - arr = new int256[](1); - arr[0] = v0; - } - - function int256s(int256 v0, int256 v1) internal pure returns (int256[] memory arr) { - arr = new int256[](2); - arr[0] = v0; - arr[1] = v1; - } - - function int256s(int256 v0, int256 v1, int256 v2) internal pure returns (int256[] memory arr) { - arr = new int256[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function int256s(int256 v0, int256 v1, int256 v2, int256 v3) internal pure returns (int256[] memory arr) { - arr = new int256[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function int256s( - int256 v0, - int256 v1, - int256 v2, - int256 v3, - int256 v4 - ) internal pure returns (int256[] memory arr) { - arr = new int256[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function int256s( - int256 v0, - int256 v1, - int256 v2, - int256 v3, - int256 v4, - int256 v5 - ) internal pure returns (int256[] memory arr) { - arr = new int256[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function int256s( - int256 v0, - int256 v1, - int256 v2, - int256 v3, - int256 v4, - int256 v5, - int256 v6 - ) internal pure returns (int256[] memory arr) { - arr = new int256[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function int256s( - int256 v0, - int256 v1, - int256 v2, - int256 v3, - int256 v4, - int256 v5, - int256 v6, - int256 v7 - ) internal pure returns (int256[] memory arr) { - arr = new int256[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function int256s( - int256 v0, - int256 v1, - int256 v2, - int256 v3, - int256 v4, - int256 v5, - int256 v6, - int256 v7, - int256 v8 - ) internal pure returns (int256[] memory arr) { - arr = new int256[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function int256s( - int256 v0, - int256 v1, - int256 v2, - int256 v3, - int256 v4, - int256 v5, - int256 v6, - int256 v7, - int256 v8, - int256 v9 - ) internal pure returns (int256[] memory arr) { - arr = new int256[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function int256s( - int256 v0, - int256 v1, - int256 v2, - int256 v3, - int256 v4, - int256 v5, - int256 v6, - int256 v7, - int256 v8, - int256 v9, - int256 v10 - ) internal pure returns (int256[] memory arr) { - arr = new int256[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function int256s( - int256 v0, - int256 v1, - int256 v2, - int256 v3, - int256 v4, - int256 v5, - int256 v6, - int256 v7, - int256 v8, - int256 v9, - int256 v10, - int256 v11 - ) internal pure returns (int256[] memory arr) { - arr = new int256[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function bytes1s(bytes1 v0) internal pure returns (bytes1[] memory arr) { - arr = new bytes1[](1); - arr[0] = v0; - } - - function bytes1s(bytes1 v0, bytes1 v1) internal pure returns (bytes1[] memory arr) { - arr = new bytes1[](2); - arr[0] = v0; - arr[1] = v1; - } - - function bytes1s(bytes1 v0, bytes1 v1, bytes1 v2) internal pure returns (bytes1[] memory arr) { - arr = new bytes1[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function bytes1s(bytes1 v0, bytes1 v1, bytes1 v2, bytes1 v3) internal pure returns (bytes1[] memory arr) { - arr = new bytes1[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function bytes1s( - bytes1 v0, - bytes1 v1, - bytes1 v2, - bytes1 v3, - bytes1 v4 - ) internal pure returns (bytes1[] memory arr) { - arr = new bytes1[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function bytes1s( - bytes1 v0, - bytes1 v1, - bytes1 v2, - bytes1 v3, - bytes1 v4, - bytes1 v5 - ) internal pure returns (bytes1[] memory arr) { - arr = new bytes1[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function bytes1s( - bytes1 v0, - bytes1 v1, - bytes1 v2, - bytes1 v3, - bytes1 v4, - bytes1 v5, - bytes1 v6 - ) internal pure returns (bytes1[] memory arr) { - arr = new bytes1[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function bytes1s( - bytes1 v0, - bytes1 v1, - bytes1 v2, - bytes1 v3, - bytes1 v4, - bytes1 v5, - bytes1 v6, - bytes1 v7 - ) internal pure returns (bytes1[] memory arr) { - arr = new bytes1[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function bytes1s( - bytes1 v0, - bytes1 v1, - bytes1 v2, - bytes1 v3, - bytes1 v4, - bytes1 v5, - bytes1 v6, - bytes1 v7, - bytes1 v8 - ) internal pure returns (bytes1[] memory arr) { - arr = new bytes1[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function bytes1s( - bytes1 v0, - bytes1 v1, - bytes1 v2, - bytes1 v3, - bytes1 v4, - bytes1 v5, - bytes1 v6, - bytes1 v7, - bytes1 v8, - bytes1 v9 - ) internal pure returns (bytes1[] memory arr) { - arr = new bytes1[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function bytes1s( - bytes1 v0, - bytes1 v1, - bytes1 v2, - bytes1 v3, - bytes1 v4, - bytes1 v5, - bytes1 v6, - bytes1 v7, - bytes1 v8, - bytes1 v9, - bytes1 v10 - ) internal pure returns (bytes1[] memory arr) { - arr = new bytes1[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function bytes1s( - bytes1 v0, - bytes1 v1, - bytes1 v2, - bytes1 v3, - bytes1 v4, - bytes1 v5, - bytes1 v6, - bytes1 v7, - bytes1 v8, - bytes1 v9, - bytes1 v10, - bytes1 v11 - ) internal pure returns (bytes1[] memory arr) { - arr = new bytes1[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function bytes4s(bytes4 v0) internal pure returns (bytes4[] memory arr) { - arr = new bytes4[](1); - arr[0] = v0; - } - - function bytes4s(bytes4 v0, bytes4 v1) internal pure returns (bytes4[] memory arr) { - arr = new bytes4[](2); - arr[0] = v0; - arr[1] = v1; - } - - function bytes4s(bytes4 v0, bytes4 v1, bytes4 v2) internal pure returns (bytes4[] memory arr) { - arr = new bytes4[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function bytes4s(bytes4 v0, bytes4 v1, bytes4 v2, bytes4 v3) internal pure returns (bytes4[] memory arr) { - arr = new bytes4[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function bytes4s( - bytes4 v0, - bytes4 v1, - bytes4 v2, - bytes4 v3, - bytes4 v4 - ) internal pure returns (bytes4[] memory arr) { - arr = new bytes4[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function bytes4s( - bytes4 v0, - bytes4 v1, - bytes4 v2, - bytes4 v3, - bytes4 v4, - bytes4 v5 - ) internal pure returns (bytes4[] memory arr) { - arr = new bytes4[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function bytes4s( - bytes4 v0, - bytes4 v1, - bytes4 v2, - bytes4 v3, - bytes4 v4, - bytes4 v5, - bytes4 v6 - ) internal pure returns (bytes4[] memory arr) { - arr = new bytes4[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function bytes4s( - bytes4 v0, - bytes4 v1, - bytes4 v2, - bytes4 v3, - bytes4 v4, - bytes4 v5, - bytes4 v6, - bytes4 v7 - ) internal pure returns (bytes4[] memory arr) { - arr = new bytes4[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function bytes4s( - bytes4 v0, - bytes4 v1, - bytes4 v2, - bytes4 v3, - bytes4 v4, - bytes4 v5, - bytes4 v6, - bytes4 v7, - bytes4 v8 - ) internal pure returns (bytes4[] memory arr) { - arr = new bytes4[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function bytes4s( - bytes4 v0, - bytes4 v1, - bytes4 v2, - bytes4 v3, - bytes4 v4, - bytes4 v5, - bytes4 v6, - bytes4 v7, - bytes4 v8, - bytes4 v9 - ) internal pure returns (bytes4[] memory arr) { - arr = new bytes4[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function bytes4s( - bytes4 v0, - bytes4 v1, - bytes4 v2, - bytes4 v3, - bytes4 v4, - bytes4 v5, - bytes4 v6, - bytes4 v7, - bytes4 v8, - bytes4 v9, - bytes4 v10 - ) internal pure returns (bytes4[] memory arr) { - arr = new bytes4[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function bytes4s( - bytes4 v0, - bytes4 v1, - bytes4 v2, - bytes4 v3, - bytes4 v4, - bytes4 v5, - bytes4 v6, - bytes4 v7, - bytes4 v8, - bytes4 v9, - bytes4 v10, - bytes4 v11 - ) internal pure returns (bytes4[] memory arr) { - arr = new bytes4[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function bytes8s(bytes8 v0) internal pure returns (bytes8[] memory arr) { - arr = new bytes8[](1); - arr[0] = v0; - } - - function bytes8s(bytes8 v0, bytes8 v1) internal pure returns (bytes8[] memory arr) { - arr = new bytes8[](2); - arr[0] = v0; - arr[1] = v1; - } - - function bytes8s(bytes8 v0, bytes8 v1, bytes8 v2) internal pure returns (bytes8[] memory arr) { - arr = new bytes8[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function bytes8s(bytes8 v0, bytes8 v1, bytes8 v2, bytes8 v3) internal pure returns (bytes8[] memory arr) { - arr = new bytes8[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function bytes8s( - bytes8 v0, - bytes8 v1, - bytes8 v2, - bytes8 v3, - bytes8 v4 - ) internal pure returns (bytes8[] memory arr) { - arr = new bytes8[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function bytes8s( - bytes8 v0, - bytes8 v1, - bytes8 v2, - bytes8 v3, - bytes8 v4, - bytes8 v5 - ) internal pure returns (bytes8[] memory arr) { - arr = new bytes8[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function bytes8s( - bytes8 v0, - bytes8 v1, - bytes8 v2, - bytes8 v3, - bytes8 v4, - bytes8 v5, - bytes8 v6 - ) internal pure returns (bytes8[] memory arr) { - arr = new bytes8[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function bytes8s( - bytes8 v0, - bytes8 v1, - bytes8 v2, - bytes8 v3, - bytes8 v4, - bytes8 v5, - bytes8 v6, - bytes8 v7 - ) internal pure returns (bytes8[] memory arr) { - arr = new bytes8[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function bytes8s( - bytes8 v0, - bytes8 v1, - bytes8 v2, - bytes8 v3, - bytes8 v4, - bytes8 v5, - bytes8 v6, - bytes8 v7, - bytes8 v8 - ) internal pure returns (bytes8[] memory arr) { - arr = new bytes8[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function bytes8s( - bytes8 v0, - bytes8 v1, - bytes8 v2, - bytes8 v3, - bytes8 v4, - bytes8 v5, - bytes8 v6, - bytes8 v7, - bytes8 v8, - bytes8 v9 - ) internal pure returns (bytes8[] memory arr) { - arr = new bytes8[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function bytes8s( - bytes8 v0, - bytes8 v1, - bytes8 v2, - bytes8 v3, - bytes8 v4, - bytes8 v5, - bytes8 v6, - bytes8 v7, - bytes8 v8, - bytes8 v9, - bytes8 v10 - ) internal pure returns (bytes8[] memory arr) { - arr = new bytes8[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function bytes8s( - bytes8 v0, - bytes8 v1, - bytes8 v2, - bytes8 v3, - bytes8 v4, - bytes8 v5, - bytes8 v6, - bytes8 v7, - bytes8 v8, - bytes8 v9, - bytes8 v10, - bytes8 v11 - ) internal pure returns (bytes8[] memory arr) { - arr = new bytes8[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function bytes10s(bytes10 v0) internal pure returns (bytes10[] memory arr) { - arr = new bytes10[](1); - arr[0] = v0; - } - - function bytes10s(bytes10 v0, bytes10 v1) internal pure returns (bytes10[] memory arr) { - arr = new bytes10[](2); - arr[0] = v0; - arr[1] = v1; - } - - function bytes10s(bytes10 v0, bytes10 v1, bytes10 v2) internal pure returns (bytes10[] memory arr) { - arr = new bytes10[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function bytes10s(bytes10 v0, bytes10 v1, bytes10 v2, bytes10 v3) internal pure returns (bytes10[] memory arr) { - arr = new bytes10[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function bytes10s( - bytes10 v0, - bytes10 v1, - bytes10 v2, - bytes10 v3, - bytes10 v4 - ) internal pure returns (bytes10[] memory arr) { - arr = new bytes10[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function bytes10s( - bytes10 v0, - bytes10 v1, - bytes10 v2, - bytes10 v3, - bytes10 v4, - bytes10 v5 - ) internal pure returns (bytes10[] memory arr) { - arr = new bytes10[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function bytes10s( - bytes10 v0, - bytes10 v1, - bytes10 v2, - bytes10 v3, - bytes10 v4, - bytes10 v5, - bytes10 v6 - ) internal pure returns (bytes10[] memory arr) { - arr = new bytes10[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function bytes10s( - bytes10 v0, - bytes10 v1, - bytes10 v2, - bytes10 v3, - bytes10 v4, - bytes10 v5, - bytes10 v6, - bytes10 v7 - ) internal pure returns (bytes10[] memory arr) { - arr = new bytes10[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function bytes10s( - bytes10 v0, - bytes10 v1, - bytes10 v2, - bytes10 v3, - bytes10 v4, - bytes10 v5, - bytes10 v6, - bytes10 v7, - bytes10 v8 - ) internal pure returns (bytes10[] memory arr) { - arr = new bytes10[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function bytes10s( - bytes10 v0, - bytes10 v1, - bytes10 v2, - bytes10 v3, - bytes10 v4, - bytes10 v5, - bytes10 v6, - bytes10 v7, - bytes10 v8, - bytes10 v9 - ) internal pure returns (bytes10[] memory arr) { - arr = new bytes10[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function bytes10s( - bytes10 v0, - bytes10 v1, - bytes10 v2, - bytes10 v3, - bytes10 v4, - bytes10 v5, - bytes10 v6, - bytes10 v7, - bytes10 v8, - bytes10 v9, - bytes10 v10 - ) internal pure returns (bytes10[] memory arr) { - arr = new bytes10[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function bytes10s( - bytes10 v0, - bytes10 v1, - bytes10 v2, - bytes10 v3, - bytes10 v4, - bytes10 v5, - bytes10 v6, - bytes10 v7, - bytes10 v8, - bytes10 v9, - bytes10 v10, - bytes10 v11 - ) internal pure returns (bytes10[] memory arr) { - arr = new bytes10[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function bytes20s(bytes20 v0) internal pure returns (bytes20[] memory arr) { - arr = new bytes20[](1); - arr[0] = v0; - } - - function bytes20s(bytes20 v0, bytes20 v1) internal pure returns (bytes20[] memory arr) { - arr = new bytes20[](2); - arr[0] = v0; - arr[1] = v1; - } - - function bytes20s(bytes20 v0, bytes20 v1, bytes20 v2) internal pure returns (bytes20[] memory arr) { - arr = new bytes20[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function bytes20s(bytes20 v0, bytes20 v1, bytes20 v2, bytes20 v3) internal pure returns (bytes20[] memory arr) { - arr = new bytes20[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function bytes20s( - bytes20 v0, - bytes20 v1, - bytes20 v2, - bytes20 v3, - bytes20 v4 - ) internal pure returns (bytes20[] memory arr) { - arr = new bytes20[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function bytes20s( - bytes20 v0, - bytes20 v1, - bytes20 v2, - bytes20 v3, - bytes20 v4, - bytes20 v5 - ) internal pure returns (bytes20[] memory arr) { - arr = new bytes20[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function bytes20s( - bytes20 v0, - bytes20 v1, - bytes20 v2, - bytes20 v3, - bytes20 v4, - bytes20 v5, - bytes20 v6 - ) internal pure returns (bytes20[] memory arr) { - arr = new bytes20[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function bytes20s( - bytes20 v0, - bytes20 v1, - bytes20 v2, - bytes20 v3, - bytes20 v4, - bytes20 v5, - bytes20 v6, - bytes20 v7 - ) internal pure returns (bytes20[] memory arr) { - arr = new bytes20[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function bytes20s( - bytes20 v0, - bytes20 v1, - bytes20 v2, - bytes20 v3, - bytes20 v4, - bytes20 v5, - bytes20 v6, - bytes20 v7, - bytes20 v8 - ) internal pure returns (bytes20[] memory arr) { - arr = new bytes20[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function bytes20s( - bytes20 v0, - bytes20 v1, - bytes20 v2, - bytes20 v3, - bytes20 v4, - bytes20 v5, - bytes20 v6, - bytes20 v7, - bytes20 v8, - bytes20 v9 - ) internal pure returns (bytes20[] memory arr) { - arr = new bytes20[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function bytes20s( - bytes20 v0, - bytes20 v1, - bytes20 v2, - bytes20 v3, - bytes20 v4, - bytes20 v5, - bytes20 v6, - bytes20 v7, - bytes20 v8, - bytes20 v9, - bytes20 v10 - ) internal pure returns (bytes20[] memory arr) { - arr = new bytes20[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function bytes20s( - bytes20 v0, - bytes20 v1, - bytes20 v2, - bytes20 v3, - bytes20 v4, - bytes20 v5, - bytes20 v6, - bytes20 v7, - bytes20 v8, - bytes20 v9, - bytes20 v10, - bytes20 v11 - ) internal pure returns (bytes20[] memory arr) { - arr = new bytes20[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function bytes32s(bytes32 v0) internal pure returns (bytes32[] memory arr) { - arr = new bytes32[](1); - arr[0] = v0; - } - - function bytes32s(bytes32 v0, bytes32 v1) internal pure returns (bytes32[] memory arr) { - arr = new bytes32[](2); - arr[0] = v0; - arr[1] = v1; - } - - function bytes32s(bytes32 v0, bytes32 v1, bytes32 v2) internal pure returns (bytes32[] memory arr) { - arr = new bytes32[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function bytes32s(bytes32 v0, bytes32 v1, bytes32 v2, bytes32 v3) internal pure returns (bytes32[] memory arr) { - arr = new bytes32[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function bytes32s( - bytes32 v0, - bytes32 v1, - bytes32 v2, - bytes32 v3, - bytes32 v4 - ) internal pure returns (bytes32[] memory arr) { - arr = new bytes32[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function bytes32s( - bytes32 v0, - bytes32 v1, - bytes32 v2, - bytes32 v3, - bytes32 v4, - bytes32 v5 - ) internal pure returns (bytes32[] memory arr) { - arr = new bytes32[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function bytes32s( - bytes32 v0, - bytes32 v1, - bytes32 v2, - bytes32 v3, - bytes32 v4, - bytes32 v5, - bytes32 v6 - ) internal pure returns (bytes32[] memory arr) { - arr = new bytes32[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function bytes32s( - bytes32 v0, - bytes32 v1, - bytes32 v2, - bytes32 v3, - bytes32 v4, - bytes32 v5, - bytes32 v6, - bytes32 v7 - ) internal pure returns (bytes32[] memory arr) { - arr = new bytes32[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function bytes32s( - bytes32 v0, - bytes32 v1, - bytes32 v2, - bytes32 v3, - bytes32 v4, - bytes32 v5, - bytes32 v6, - bytes32 v7, - bytes32 v8 - ) internal pure returns (bytes32[] memory arr) { - arr = new bytes32[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function bytes32s( - bytes32 v0, - bytes32 v1, - bytes32 v2, - bytes32 v3, - bytes32 v4, - bytes32 v5, - bytes32 v6, - bytes32 v7, - bytes32 v8, - bytes32 v9 - ) internal pure returns (bytes32[] memory arr) { - arr = new bytes32[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function bytes32s( - bytes32 v0, - bytes32 v1, - bytes32 v2, - bytes32 v3, - bytes32 v4, - bytes32 v5, - bytes32 v6, - bytes32 v7, - bytes32 v8, - bytes32 v9, - bytes32 v10 - ) internal pure returns (bytes32[] memory arr) { - arr = new bytes32[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function bytes32s( - bytes32 v0, - bytes32 v1, - bytes32 v2, - bytes32 v3, - bytes32 v4, - bytes32 v5, - bytes32 v6, - bytes32 v7, - bytes32 v8, - bytes32 v9, - bytes32 v10, - bytes32 v11 - ) internal pure returns (bytes32[] memory arr) { - arr = new bytes32[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function bytess(bytes memory v0) internal pure returns (bytes[] memory arr) { - arr = new bytes[](1); - arr[0] = v0; - } - - function bytess(bytes memory v0, bytes memory v1) internal pure returns (bytes[] memory arr) { - arr = new bytes[](2); - arr[0] = v0; - arr[1] = v1; - } - - function bytess(bytes memory v0, bytes memory v1, bytes memory v2) internal pure returns (bytes[] memory arr) { - arr = new bytes[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function bytess( - bytes memory v0, - bytes memory v1, - bytes memory v2, - bytes memory v3 - ) internal pure returns (bytes[] memory arr) { - arr = new bytes[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function bytess( - bytes memory v0, - bytes memory v1, - bytes memory v2, - bytes memory v3, - bytes memory v4 - ) internal pure returns (bytes[] memory arr) { - arr = new bytes[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function bytess( - bytes memory v0, - bytes memory v1, - bytes memory v2, - bytes memory v3, - bytes memory v4, - bytes memory v5 - ) internal pure returns (bytes[] memory arr) { - arr = new bytes[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function bytess( - bytes memory v0, - bytes memory v1, - bytes memory v2, - bytes memory v3, - bytes memory v4, - bytes memory v5, - bytes memory v6 - ) internal pure returns (bytes[] memory arr) { - arr = new bytes[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function bytess( - bytes memory v0, - bytes memory v1, - bytes memory v2, - bytes memory v3, - bytes memory v4, - bytes memory v5, - bytes memory v6, - bytes memory v7 - ) internal pure returns (bytes[] memory arr) { - arr = new bytes[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function bytess( - bytes memory v0, - bytes memory v1, - bytes memory v2, - bytes memory v3, - bytes memory v4, - bytes memory v5, - bytes memory v6, - bytes memory v7, - bytes memory v8 - ) internal pure returns (bytes[] memory arr) { - arr = new bytes[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function bytess( - bytes memory v0, - bytes memory v1, - bytes memory v2, - bytes memory v3, - bytes memory v4, - bytes memory v5, - bytes memory v6, - bytes memory v7, - bytes memory v8, - bytes memory v9 - ) internal pure returns (bytes[] memory arr) { - arr = new bytes[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function bytess( - bytes memory v0, - bytes memory v1, - bytes memory v2, - bytes memory v3, - bytes memory v4, - bytes memory v5, - bytes memory v6, - bytes memory v7, - bytes memory v8, - bytes memory v9, - bytes memory v10 - ) internal pure returns (bytes[] memory arr) { - arr = new bytes[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function bytess( - bytes memory v0, - bytes memory v1, - bytes memory v2, - bytes memory v3, - bytes memory v4, - bytes memory v5, - bytes memory v6, - bytes memory v7, - bytes memory v8, - bytes memory v9, - bytes memory v10, - bytes memory v11 - ) internal pure returns (bytes[] memory arr) { - arr = new bytes[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } - - function strings(string memory v0) internal pure returns (string[] memory arr) { - arr = new string[](1); - arr[0] = v0; - } - - function strings(string memory v0, string memory v1) internal pure returns (string[] memory arr) { - arr = new string[](2); - arr[0] = v0; - arr[1] = v1; - } - - function strings(string memory v0, string memory v1, string memory v2) internal pure returns (string[] memory arr) { - arr = new string[](3); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - } - - function strings( - string memory v0, - string memory v1, - string memory v2, - string memory v3 - ) internal pure returns (string[] memory arr) { - arr = new string[](4); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - } - - function strings( - string memory v0, - string memory v1, - string memory v2, - string memory v3, - string memory v4 - ) internal pure returns (string[] memory arr) { - arr = new string[](5); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - } - - function strings( - string memory v0, - string memory v1, - string memory v2, - string memory v3, - string memory v4, - string memory v5 - ) internal pure returns (string[] memory arr) { - arr = new string[](6); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - } - - function strings( - string memory v0, - string memory v1, - string memory v2, - string memory v3, - string memory v4, - string memory v5, - string memory v6 - ) internal pure returns (string[] memory arr) { - arr = new string[](7); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - } - - function strings( - string memory v0, - string memory v1, - string memory v2, - string memory v3, - string memory v4, - string memory v5, - string memory v6, - string memory v7 - ) internal pure returns (string[] memory arr) { - arr = new string[](8); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - } - - function strings( - string memory v0, - string memory v1, - string memory v2, - string memory v3, - string memory v4, - string memory v5, - string memory v6, - string memory v7, - string memory v8 - ) internal pure returns (string[] memory arr) { - arr = new string[](9); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - } - - function strings( - string memory v0, - string memory v1, - string memory v2, - string memory v3, - string memory v4, - string memory v5, - string memory v6, - string memory v7, - string memory v8, - string memory v9 - ) internal pure returns (string[] memory arr) { - arr = new string[](10); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - } - - function strings( - string memory v0, - string memory v1, - string memory v2, - string memory v3, - string memory v4, - string memory v5, - string memory v6, - string memory v7, - string memory v8, - string memory v9, - string memory v10 - ) internal pure returns (string[] memory arr) { - arr = new string[](11); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - } - - function strings( - string memory v0, - string memory v1, - string memory v2, - string memory v3, - string memory v4, - string memory v5, - string memory v6, - string memory v7, - string memory v8, - string memory v9, - string memory v10, - string memory v11 - ) internal pure returns (string[] memory arr) { - arr = new string[](12); - arr[0] = v0; - arr[1] = v1; - arr[2] = v2; - arr[3] = v3; - arr[4] = v4; - arr[5] = v5; - arr[6] = v6; - arr[7] = v7; - arr[8] = v8; - arr[9] = v9; - arr[10] = v10; - arr[11] = v11; - } + function addresses(address v0) internal pure returns (address[] memory arr) { + arr = new address[](1); + arr[0] = v0; + } + + function addresses(address v0, address v1) internal pure returns (address[] memory arr) { + arr = new address[](2); + arr[0] = v0; + arr[1] = v1; + } + + function addresses(address v0, address v1, address v2) internal pure returns (address[] memory arr) { + arr = new address[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function addresses(address v0, address v1, address v2, address v3) internal pure returns (address[] memory arr) { + arr = new address[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function addresses(address v0, address v1, address v2, address v3, address v4) + internal + pure + returns (address[] memory arr) + { + arr = new address[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function addresses(address v0, address v1, address v2, address v3, address v4, address v5) + internal + pure + returns (address[] memory arr) + { + arr = new address[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function addresses(address v0, address v1, address v2, address v3, address v4, address v5, address v6) + internal + pure + returns (address[] memory arr) + { + arr = new address[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function addresses(address v0, address v1, address v2, address v3, address v4, address v5, address v6, address v7) + internal + pure + returns (address[] memory arr) + { + arr = new address[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function addresses( + address v0, + address v1, + address v2, + address v3, + address v4, + address v5, + address v6, + address v7, + address v8 + ) internal pure returns (address[] memory arr) { + arr = new address[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function addresses( + address v0, + address v1, + address v2, + address v3, + address v4, + address v5, + address v6, + address v7, + address v8, + address v9 + ) internal pure returns (address[] memory arr) { + arr = new address[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function addresses( + address v0, + address v1, + address v2, + address v3, + address v4, + address v5, + address v6, + address v7, + address v8, + address v9, + address v10 + ) internal pure returns (address[] memory arr) { + arr = new address[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function addresses( + address v0, + address v1, + address v2, + address v3, + address v4, + address v5, + address v6, + address v7, + address v8, + address v9, + address v10, + address v11 + ) internal pure returns (address[] memory arr) { + arr = new address[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function bools(bool v0) internal pure returns (bool[] memory arr) { + arr = new bool[](1); + arr[0] = v0; + } + + function bools(bool v0, bool v1) internal pure returns (bool[] memory arr) { + arr = new bool[](2); + arr[0] = v0; + arr[1] = v1; + } + + function bools(bool v0, bool v1, bool v2) internal pure returns (bool[] memory arr) { + arr = new bool[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function bools(bool v0, bool v1, bool v2, bool v3) internal pure returns (bool[] memory arr) { + arr = new bool[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function bools(bool v0, bool v1, bool v2, bool v3, bool v4) internal pure returns (bool[] memory arr) { + arr = new bool[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function bools(bool v0, bool v1, bool v2, bool v3, bool v4, bool v5) internal pure returns (bool[] memory arr) { + arr = new bool[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function bools(bool v0, bool v1, bool v2, bool v3, bool v4, bool v5, bool v6) + internal + pure + returns (bool[] memory arr) + { + arr = new bool[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function bools(bool v0, bool v1, bool v2, bool v3, bool v4, bool v5, bool v6, bool v7) + internal + pure + returns (bool[] memory arr) + { + arr = new bool[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function bools(bool v0, bool v1, bool v2, bool v3, bool v4, bool v5, bool v6, bool v7, bool v8) + internal + pure + returns (bool[] memory arr) + { + arr = new bool[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function bools(bool v0, bool v1, bool v2, bool v3, bool v4, bool v5, bool v6, bool v7, bool v8, bool v9) + internal + pure + returns (bool[] memory arr) + { + arr = new bool[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function bools(bool v0, bool v1, bool v2, bool v3, bool v4, bool v5, bool v6, bool v7, bool v8, bool v9, bool v10) + internal + pure + returns (bool[] memory arr) + { + arr = new bool[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function bools( + bool v0, + bool v1, + bool v2, + bool v3, + bool v4, + bool v5, + bool v6, + bool v7, + bool v8, + bool v9, + bool v10, + bool v11 + ) internal pure returns (bool[] memory arr) { + arr = new bool[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function uint8s(uint8 v0) internal pure returns (uint8[] memory arr) { + arr = new uint8[](1); + arr[0] = v0; + } + + function uint8s(uint8 v0, uint8 v1) internal pure returns (uint8[] memory arr) { + arr = new uint8[](2); + arr[0] = v0; + arr[1] = v1; + } + + function uint8s(uint8 v0, uint8 v1, uint8 v2) internal pure returns (uint8[] memory arr) { + arr = new uint8[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function uint8s(uint8 v0, uint8 v1, uint8 v2, uint8 v3) internal pure returns (uint8[] memory arr) { + arr = new uint8[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function uint8s(uint8 v0, uint8 v1, uint8 v2, uint8 v3, uint8 v4) internal pure returns (uint8[] memory arr) { + arr = new uint8[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function uint8s(uint8 v0, uint8 v1, uint8 v2, uint8 v3, uint8 v4, uint8 v5) + internal + pure + returns (uint8[] memory arr) + { + arr = new uint8[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function uint8s(uint8 v0, uint8 v1, uint8 v2, uint8 v3, uint8 v4, uint8 v5, uint8 v6) + internal + pure + returns (uint8[] memory arr) + { + arr = new uint8[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function uint8s(uint8 v0, uint8 v1, uint8 v2, uint8 v3, uint8 v4, uint8 v5, uint8 v6, uint8 v7) + internal + pure + returns (uint8[] memory arr) + { + arr = new uint8[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function uint8s(uint8 v0, uint8 v1, uint8 v2, uint8 v3, uint8 v4, uint8 v5, uint8 v6, uint8 v7, uint8 v8) + internal + pure + returns (uint8[] memory arr) + { + arr = new uint8[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function uint8s(uint8 v0, uint8 v1, uint8 v2, uint8 v3, uint8 v4, uint8 v5, uint8 v6, uint8 v7, uint8 v8, uint8 v9) + internal + pure + returns (uint8[] memory arr) + { + arr = new uint8[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function uint8s( + uint8 v0, + uint8 v1, + uint8 v2, + uint8 v3, + uint8 v4, + uint8 v5, + uint8 v6, + uint8 v7, + uint8 v8, + uint8 v9, + uint8 v10 + ) internal pure returns (uint8[] memory arr) { + arr = new uint8[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function uint8s( + uint8 v0, + uint8 v1, + uint8 v2, + uint8 v3, + uint8 v4, + uint8 v5, + uint8 v6, + uint8 v7, + uint8 v8, + uint8 v9, + uint8 v10, + uint8 v11 + ) internal pure returns (uint8[] memory arr) { + arr = new uint8[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function uint16s(uint16 v0) internal pure returns (uint16[] memory arr) { + arr = new uint16[](1); + arr[0] = v0; + } + + function uint16s(uint16 v0, uint16 v1) internal pure returns (uint16[] memory arr) { + arr = new uint16[](2); + arr[0] = v0; + arr[1] = v1; + } + + function uint16s(uint16 v0, uint16 v1, uint16 v2) internal pure returns (uint16[] memory arr) { + arr = new uint16[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function uint16s(uint16 v0, uint16 v1, uint16 v2, uint16 v3) internal pure returns (uint16[] memory arr) { + arr = new uint16[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function uint16s(uint16 v0, uint16 v1, uint16 v2, uint16 v3, uint16 v4) + internal + pure + returns (uint16[] memory arr) + { + arr = new uint16[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function uint16s(uint16 v0, uint16 v1, uint16 v2, uint16 v3, uint16 v4, uint16 v5) + internal + pure + returns (uint16[] memory arr) + { + arr = new uint16[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function uint16s(uint16 v0, uint16 v1, uint16 v2, uint16 v3, uint16 v4, uint16 v5, uint16 v6) + internal + pure + returns (uint16[] memory arr) + { + arr = new uint16[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function uint16s(uint16 v0, uint16 v1, uint16 v2, uint16 v3, uint16 v4, uint16 v5, uint16 v6, uint16 v7) + internal + pure + returns (uint16[] memory arr) + { + arr = new uint16[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function uint16s(uint16 v0, uint16 v1, uint16 v2, uint16 v3, uint16 v4, uint16 v5, uint16 v6, uint16 v7, uint16 v8) + internal + pure + returns (uint16[] memory arr) + { + arr = new uint16[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function uint16s( + uint16 v0, + uint16 v1, + uint16 v2, + uint16 v3, + uint16 v4, + uint16 v5, + uint16 v6, + uint16 v7, + uint16 v8, + uint16 v9 + ) internal pure returns (uint16[] memory arr) { + arr = new uint16[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function uint16s( + uint16 v0, + uint16 v1, + uint16 v2, + uint16 v3, + uint16 v4, + uint16 v5, + uint16 v6, + uint16 v7, + uint16 v8, + uint16 v9, + uint16 v10 + ) internal pure returns (uint16[] memory arr) { + arr = new uint16[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function uint16s( + uint16 v0, + uint16 v1, + uint16 v2, + uint16 v3, + uint16 v4, + uint16 v5, + uint16 v6, + uint16 v7, + uint16 v8, + uint16 v9, + uint16 v10, + uint16 v11 + ) internal pure returns (uint16[] memory arr) { + arr = new uint16[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function uint24s(uint24 v0) internal pure returns (uint24[] memory arr) { + arr = new uint24[](1); + arr[0] = v0; + } + + function uint24s(uint24 v0, uint24 v1) internal pure returns (uint24[] memory arr) { + arr = new uint24[](2); + arr[0] = v0; + arr[1] = v1; + } + + function uint24s(uint24 v0, uint24 v1, uint24 v2) internal pure returns (uint24[] memory arr) { + arr = new uint24[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function uint24s(uint24 v0, uint24 v1, uint24 v2, uint24 v3) internal pure returns (uint24[] memory arr) { + arr = new uint24[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function uint24s(uint24 v0, uint24 v1, uint24 v2, uint24 v3, uint24 v4) + internal + pure + returns (uint24[] memory arr) + { + arr = new uint24[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function uint24s(uint24 v0, uint24 v1, uint24 v2, uint24 v3, uint24 v4, uint24 v5) + internal + pure + returns (uint24[] memory arr) + { + arr = new uint24[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function uint24s(uint24 v0, uint24 v1, uint24 v2, uint24 v3, uint24 v4, uint24 v5, uint24 v6) + internal + pure + returns (uint24[] memory arr) + { + arr = new uint24[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function uint24s(uint24 v0, uint24 v1, uint24 v2, uint24 v3, uint24 v4, uint24 v5, uint24 v6, uint24 v7) + internal + pure + returns (uint24[] memory arr) + { + arr = new uint24[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function uint24s(uint24 v0, uint24 v1, uint24 v2, uint24 v3, uint24 v4, uint24 v5, uint24 v6, uint24 v7, uint24 v8) + internal + pure + returns (uint24[] memory arr) + { + arr = new uint24[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function uint24s( + uint24 v0, + uint24 v1, + uint24 v2, + uint24 v3, + uint24 v4, + uint24 v5, + uint24 v6, + uint24 v7, + uint24 v8, + uint24 v9 + ) internal pure returns (uint24[] memory arr) { + arr = new uint24[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function uint24s( + uint24 v0, + uint24 v1, + uint24 v2, + uint24 v3, + uint24 v4, + uint24 v5, + uint24 v6, + uint24 v7, + uint24 v8, + uint24 v9, + uint24 v10 + ) internal pure returns (uint24[] memory arr) { + arr = new uint24[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function uint24s( + uint24 v0, + uint24 v1, + uint24 v2, + uint24 v3, + uint24 v4, + uint24 v5, + uint24 v6, + uint24 v7, + uint24 v8, + uint24 v9, + uint24 v10, + uint24 v11 + ) internal pure returns (uint24[] memory arr) { + arr = new uint24[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function uint32s(uint32 v0) internal pure returns (uint32[] memory arr) { + arr = new uint32[](1); + arr[0] = v0; + } + + function uint32s(uint32 v0, uint32 v1) internal pure returns (uint32[] memory arr) { + arr = new uint32[](2); + arr[0] = v0; + arr[1] = v1; + } + + function uint32s(uint32 v0, uint32 v1, uint32 v2) internal pure returns (uint32[] memory arr) { + arr = new uint32[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function uint32s(uint32 v0, uint32 v1, uint32 v2, uint32 v3) internal pure returns (uint32[] memory arr) { + arr = new uint32[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function uint32s(uint32 v0, uint32 v1, uint32 v2, uint32 v3, uint32 v4) + internal + pure + returns (uint32[] memory arr) + { + arr = new uint32[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function uint32s(uint32 v0, uint32 v1, uint32 v2, uint32 v3, uint32 v4, uint32 v5) + internal + pure + returns (uint32[] memory arr) + { + arr = new uint32[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function uint32s(uint32 v0, uint32 v1, uint32 v2, uint32 v3, uint32 v4, uint32 v5, uint32 v6) + internal + pure + returns (uint32[] memory arr) + { + arr = new uint32[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function uint32s(uint32 v0, uint32 v1, uint32 v2, uint32 v3, uint32 v4, uint32 v5, uint32 v6, uint32 v7) + internal + pure + returns (uint32[] memory arr) + { + arr = new uint32[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function uint32s(uint32 v0, uint32 v1, uint32 v2, uint32 v3, uint32 v4, uint32 v5, uint32 v6, uint32 v7, uint32 v8) + internal + pure + returns (uint32[] memory arr) + { + arr = new uint32[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function uint32s( + uint32 v0, + uint32 v1, + uint32 v2, + uint32 v3, + uint32 v4, + uint32 v5, + uint32 v6, + uint32 v7, + uint32 v8, + uint32 v9 + ) internal pure returns (uint32[] memory arr) { + arr = new uint32[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function uint32s( + uint32 v0, + uint32 v1, + uint32 v2, + uint32 v3, + uint32 v4, + uint32 v5, + uint32 v6, + uint32 v7, + uint32 v8, + uint32 v9, + uint32 v10 + ) internal pure returns (uint32[] memory arr) { + arr = new uint32[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function uint32s( + uint32 v0, + uint32 v1, + uint32 v2, + uint32 v3, + uint32 v4, + uint32 v5, + uint32 v6, + uint32 v7, + uint32 v8, + uint32 v9, + uint32 v10, + uint32 v11 + ) internal pure returns (uint32[] memory arr) { + arr = new uint32[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function uint40s(uint40 v0) internal pure returns (uint40[] memory arr) { + arr = new uint40[](1); + arr[0] = v0; + } + + function uint40s(uint40 v0, uint40 v1) internal pure returns (uint40[] memory arr) { + arr = new uint40[](2); + arr[0] = v0; + arr[1] = v1; + } + + function uint40s(uint40 v0, uint40 v1, uint40 v2) internal pure returns (uint40[] memory arr) { + arr = new uint40[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function uint40s(uint40 v0, uint40 v1, uint40 v2, uint40 v3) internal pure returns (uint40[] memory arr) { + arr = new uint40[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function uint40s(uint40 v0, uint40 v1, uint40 v2, uint40 v3, uint40 v4) + internal + pure + returns (uint40[] memory arr) + { + arr = new uint40[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function uint40s(uint40 v0, uint40 v1, uint40 v2, uint40 v3, uint40 v4, uint40 v5) + internal + pure + returns (uint40[] memory arr) + { + arr = new uint40[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function uint40s(uint40 v0, uint40 v1, uint40 v2, uint40 v3, uint40 v4, uint40 v5, uint40 v6) + internal + pure + returns (uint40[] memory arr) + { + arr = new uint40[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function uint40s(uint40 v0, uint40 v1, uint40 v2, uint40 v3, uint40 v4, uint40 v5, uint40 v6, uint40 v7) + internal + pure + returns (uint40[] memory arr) + { + arr = new uint40[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function uint40s(uint40 v0, uint40 v1, uint40 v2, uint40 v3, uint40 v4, uint40 v5, uint40 v6, uint40 v7, uint40 v8) + internal + pure + returns (uint40[] memory arr) + { + arr = new uint40[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function uint40s( + uint40 v0, + uint40 v1, + uint40 v2, + uint40 v3, + uint40 v4, + uint40 v5, + uint40 v6, + uint40 v7, + uint40 v8, + uint40 v9 + ) internal pure returns (uint40[] memory arr) { + arr = new uint40[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function uint40s( + uint40 v0, + uint40 v1, + uint40 v2, + uint40 v3, + uint40 v4, + uint40 v5, + uint40 v6, + uint40 v7, + uint40 v8, + uint40 v9, + uint40 v10 + ) internal pure returns (uint40[] memory arr) { + arr = new uint40[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function uint40s( + uint40 v0, + uint40 v1, + uint40 v2, + uint40 v3, + uint40 v4, + uint40 v5, + uint40 v6, + uint40 v7, + uint40 v8, + uint40 v9, + uint40 v10, + uint40 v11 + ) internal pure returns (uint40[] memory arr) { + arr = new uint40[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function uint48s(uint48 v0) internal pure returns (uint48[] memory arr) { + arr = new uint48[](1); + arr[0] = v0; + } + + function uint48s(uint48 v0, uint48 v1) internal pure returns (uint48[] memory arr) { + arr = new uint48[](2); + arr[0] = v0; + arr[1] = v1; + } + + function uint48s(uint48 v0, uint48 v1, uint48 v2) internal pure returns (uint48[] memory arr) { + arr = new uint48[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function uint48s(uint48 v0, uint48 v1, uint48 v2, uint48 v3) internal pure returns (uint48[] memory arr) { + arr = new uint48[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function uint48s(uint48 v0, uint48 v1, uint48 v2, uint48 v3, uint48 v4) + internal + pure + returns (uint48[] memory arr) + { + arr = new uint48[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function uint48s(uint48 v0, uint48 v1, uint48 v2, uint48 v3, uint48 v4, uint48 v5) + internal + pure + returns (uint48[] memory arr) + { + arr = new uint48[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function uint48s(uint48 v0, uint48 v1, uint48 v2, uint48 v3, uint48 v4, uint48 v5, uint48 v6) + internal + pure + returns (uint48[] memory arr) + { + arr = new uint48[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function uint48s(uint48 v0, uint48 v1, uint48 v2, uint48 v3, uint48 v4, uint48 v5, uint48 v6, uint48 v7) + internal + pure + returns (uint48[] memory arr) + { + arr = new uint48[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function uint48s(uint48 v0, uint48 v1, uint48 v2, uint48 v3, uint48 v4, uint48 v5, uint48 v6, uint48 v7, uint48 v8) + internal + pure + returns (uint48[] memory arr) + { + arr = new uint48[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function uint48s( + uint48 v0, + uint48 v1, + uint48 v2, + uint48 v3, + uint48 v4, + uint48 v5, + uint48 v6, + uint48 v7, + uint48 v8, + uint48 v9 + ) internal pure returns (uint48[] memory arr) { + arr = new uint48[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function uint48s( + uint48 v0, + uint48 v1, + uint48 v2, + uint48 v3, + uint48 v4, + uint48 v5, + uint48 v6, + uint48 v7, + uint48 v8, + uint48 v9, + uint48 v10 + ) internal pure returns (uint48[] memory arr) { + arr = new uint48[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function uint48s( + uint48 v0, + uint48 v1, + uint48 v2, + uint48 v3, + uint48 v4, + uint48 v5, + uint48 v6, + uint48 v7, + uint48 v8, + uint48 v9, + uint48 v10, + uint48 v11 + ) internal pure returns (uint48[] memory arr) { + arr = new uint48[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function uint64s(uint64 v0) internal pure returns (uint64[] memory arr) { + arr = new uint64[](1); + arr[0] = v0; + } + + function uint64s(uint64 v0, uint64 v1) internal pure returns (uint64[] memory arr) { + arr = new uint64[](2); + arr[0] = v0; + arr[1] = v1; + } + + function uint64s(uint64 v0, uint64 v1, uint64 v2) internal pure returns (uint64[] memory arr) { + arr = new uint64[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function uint64s(uint64 v0, uint64 v1, uint64 v2, uint64 v3) internal pure returns (uint64[] memory arr) { + arr = new uint64[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function uint64s(uint64 v0, uint64 v1, uint64 v2, uint64 v3, uint64 v4) + internal + pure + returns (uint64[] memory arr) + { + arr = new uint64[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function uint64s(uint64 v0, uint64 v1, uint64 v2, uint64 v3, uint64 v4, uint64 v5) + internal + pure + returns (uint64[] memory arr) + { + arr = new uint64[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function uint64s(uint64 v0, uint64 v1, uint64 v2, uint64 v3, uint64 v4, uint64 v5, uint64 v6) + internal + pure + returns (uint64[] memory arr) + { + arr = new uint64[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function uint64s(uint64 v0, uint64 v1, uint64 v2, uint64 v3, uint64 v4, uint64 v5, uint64 v6, uint64 v7) + internal + pure + returns (uint64[] memory arr) + { + arr = new uint64[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function uint64s(uint64 v0, uint64 v1, uint64 v2, uint64 v3, uint64 v4, uint64 v5, uint64 v6, uint64 v7, uint64 v8) + internal + pure + returns (uint64[] memory arr) + { + arr = new uint64[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function uint64s( + uint64 v0, + uint64 v1, + uint64 v2, + uint64 v3, + uint64 v4, + uint64 v5, + uint64 v6, + uint64 v7, + uint64 v8, + uint64 v9 + ) internal pure returns (uint64[] memory arr) { + arr = new uint64[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function uint64s( + uint64 v0, + uint64 v1, + uint64 v2, + uint64 v3, + uint64 v4, + uint64 v5, + uint64 v6, + uint64 v7, + uint64 v8, + uint64 v9, + uint64 v10 + ) internal pure returns (uint64[] memory arr) { + arr = new uint64[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function uint64s( + uint64 v0, + uint64 v1, + uint64 v2, + uint64 v3, + uint64 v4, + uint64 v5, + uint64 v6, + uint64 v7, + uint64 v8, + uint64 v9, + uint64 v10, + uint64 v11 + ) internal pure returns (uint64[] memory arr) { + arr = new uint64[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function uint96s(uint96 v0) internal pure returns (uint96[] memory arr) { + arr = new uint96[](1); + arr[0] = v0; + } + + function uint96s(uint96 v0, uint96 v1) internal pure returns (uint96[] memory arr) { + arr = new uint96[](2); + arr[0] = v0; + arr[1] = v1; + } + + function uint96s(uint96 v0, uint96 v1, uint96 v2) internal pure returns (uint96[] memory arr) { + arr = new uint96[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function uint96s(uint96 v0, uint96 v1, uint96 v2, uint96 v3) internal pure returns (uint96[] memory arr) { + arr = new uint96[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function uint96s(uint96 v0, uint96 v1, uint96 v2, uint96 v3, uint96 v4) + internal + pure + returns (uint96[] memory arr) + { + arr = new uint96[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function uint96s(uint96 v0, uint96 v1, uint96 v2, uint96 v3, uint96 v4, uint96 v5) + internal + pure + returns (uint96[] memory arr) + { + arr = new uint96[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function uint96s(uint96 v0, uint96 v1, uint96 v2, uint96 v3, uint96 v4, uint96 v5, uint96 v6) + internal + pure + returns (uint96[] memory arr) + { + arr = new uint96[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function uint96s(uint96 v0, uint96 v1, uint96 v2, uint96 v3, uint96 v4, uint96 v5, uint96 v6, uint96 v7) + internal + pure + returns (uint96[] memory arr) + { + arr = new uint96[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function uint96s(uint96 v0, uint96 v1, uint96 v2, uint96 v3, uint96 v4, uint96 v5, uint96 v6, uint96 v7, uint96 v8) + internal + pure + returns (uint96[] memory arr) + { + arr = new uint96[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function uint96s( + uint96 v0, + uint96 v1, + uint96 v2, + uint96 v3, + uint96 v4, + uint96 v5, + uint96 v6, + uint96 v7, + uint96 v8, + uint96 v9 + ) internal pure returns (uint96[] memory arr) { + arr = new uint96[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function uint96s( + uint96 v0, + uint96 v1, + uint96 v2, + uint96 v3, + uint96 v4, + uint96 v5, + uint96 v6, + uint96 v7, + uint96 v8, + uint96 v9, + uint96 v10 + ) internal pure returns (uint96[] memory arr) { + arr = new uint96[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function uint96s( + uint96 v0, + uint96 v1, + uint96 v2, + uint96 v3, + uint96 v4, + uint96 v5, + uint96 v6, + uint96 v7, + uint96 v8, + uint96 v9, + uint96 v10, + uint96 v11 + ) internal pure returns (uint96[] memory arr) { + arr = new uint96[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function uint128s(uint128 v0) internal pure returns (uint128[] memory arr) { + arr = new uint128[](1); + arr[0] = v0; + } + + function uint128s(uint128 v0, uint128 v1) internal pure returns (uint128[] memory arr) { + arr = new uint128[](2); + arr[0] = v0; + arr[1] = v1; + } + + function uint128s(uint128 v0, uint128 v1, uint128 v2) internal pure returns (uint128[] memory arr) { + arr = new uint128[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function uint128s(uint128 v0, uint128 v1, uint128 v2, uint128 v3) internal pure returns (uint128[] memory arr) { + arr = new uint128[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function uint128s(uint128 v0, uint128 v1, uint128 v2, uint128 v3, uint128 v4) + internal + pure + returns (uint128[] memory arr) + { + arr = new uint128[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function uint128s(uint128 v0, uint128 v1, uint128 v2, uint128 v3, uint128 v4, uint128 v5) + internal + pure + returns (uint128[] memory arr) + { + arr = new uint128[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function uint128s(uint128 v0, uint128 v1, uint128 v2, uint128 v3, uint128 v4, uint128 v5, uint128 v6) + internal + pure + returns (uint128[] memory arr) + { + arr = new uint128[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function uint128s(uint128 v0, uint128 v1, uint128 v2, uint128 v3, uint128 v4, uint128 v5, uint128 v6, uint128 v7) + internal + pure + returns (uint128[] memory arr) + { + arr = new uint128[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function uint128s( + uint128 v0, + uint128 v1, + uint128 v2, + uint128 v3, + uint128 v4, + uint128 v5, + uint128 v6, + uint128 v7, + uint128 v8 + ) internal pure returns (uint128[] memory arr) { + arr = new uint128[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function uint128s( + uint128 v0, + uint128 v1, + uint128 v2, + uint128 v3, + uint128 v4, + uint128 v5, + uint128 v6, + uint128 v7, + uint128 v8, + uint128 v9 + ) internal pure returns (uint128[] memory arr) { + arr = new uint128[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function uint128s( + uint128 v0, + uint128 v1, + uint128 v2, + uint128 v3, + uint128 v4, + uint128 v5, + uint128 v6, + uint128 v7, + uint128 v8, + uint128 v9, + uint128 v10 + ) internal pure returns (uint128[] memory arr) { + arr = new uint128[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function uint128s( + uint128 v0, + uint128 v1, + uint128 v2, + uint128 v3, + uint128 v4, + uint128 v5, + uint128 v6, + uint128 v7, + uint128 v8, + uint128 v9, + uint128 v10, + uint128 v11 + ) internal pure returns (uint128[] memory arr) { + arr = new uint128[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function uint160s(uint160 v0) internal pure returns (uint160[] memory arr) { + arr = new uint160[](1); + arr[0] = v0; + } + + function uint160s(uint160 v0, uint160 v1) internal pure returns (uint160[] memory arr) { + arr = new uint160[](2); + arr[0] = v0; + arr[1] = v1; + } + + function uint160s(uint160 v0, uint160 v1, uint160 v2) internal pure returns (uint160[] memory arr) { + arr = new uint160[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function uint160s(uint160 v0, uint160 v1, uint160 v2, uint160 v3) internal pure returns (uint160[] memory arr) { + arr = new uint160[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function uint160s(uint160 v0, uint160 v1, uint160 v2, uint160 v3, uint160 v4) + internal + pure + returns (uint160[] memory arr) + { + arr = new uint160[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function uint160s(uint160 v0, uint160 v1, uint160 v2, uint160 v3, uint160 v4, uint160 v5) + internal + pure + returns (uint160[] memory arr) + { + arr = new uint160[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function uint160s(uint160 v0, uint160 v1, uint160 v2, uint160 v3, uint160 v4, uint160 v5, uint160 v6) + internal + pure + returns (uint160[] memory arr) + { + arr = new uint160[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function uint160s(uint160 v0, uint160 v1, uint160 v2, uint160 v3, uint160 v4, uint160 v5, uint160 v6, uint160 v7) + internal + pure + returns (uint160[] memory arr) + { + arr = new uint160[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function uint160s( + uint160 v0, + uint160 v1, + uint160 v2, + uint160 v3, + uint160 v4, + uint160 v5, + uint160 v6, + uint160 v7, + uint160 v8 + ) internal pure returns (uint160[] memory arr) { + arr = new uint160[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function uint160s( + uint160 v0, + uint160 v1, + uint160 v2, + uint160 v3, + uint160 v4, + uint160 v5, + uint160 v6, + uint160 v7, + uint160 v8, + uint160 v9 + ) internal pure returns (uint160[] memory arr) { + arr = new uint160[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function uint160s( + uint160 v0, + uint160 v1, + uint160 v2, + uint160 v3, + uint160 v4, + uint160 v5, + uint160 v6, + uint160 v7, + uint160 v8, + uint160 v9, + uint160 v10 + ) internal pure returns (uint160[] memory arr) { + arr = new uint160[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function uint160s( + uint160 v0, + uint160 v1, + uint160 v2, + uint160 v3, + uint160 v4, + uint160 v5, + uint160 v6, + uint160 v7, + uint160 v8, + uint160 v9, + uint160 v10, + uint160 v11 + ) internal pure returns (uint160[] memory arr) { + arr = new uint160[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function uint256s(uint256 v0) internal pure returns (uint256[] memory arr) { + arr = new uint256[](1); + arr[0] = v0; + } + + function uint256s(uint256 v0, uint256 v1) internal pure returns (uint256[] memory arr) { + arr = new uint256[](2); + arr[0] = v0; + arr[1] = v1; + } + + function uint256s(uint256 v0, uint256 v1, uint256 v2) internal pure returns (uint256[] memory arr) { + arr = new uint256[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function uint256s(uint256 v0, uint256 v1, uint256 v2, uint256 v3) internal pure returns (uint256[] memory arr) { + arr = new uint256[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function uint256s(uint256 v0, uint256 v1, uint256 v2, uint256 v3, uint256 v4) + internal + pure + returns (uint256[] memory arr) + { + arr = new uint256[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function uint256s(uint256 v0, uint256 v1, uint256 v2, uint256 v3, uint256 v4, uint256 v5) + internal + pure + returns (uint256[] memory arr) + { + arr = new uint256[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function uint256s(uint256 v0, uint256 v1, uint256 v2, uint256 v3, uint256 v4, uint256 v5, uint256 v6) + internal + pure + returns (uint256[] memory arr) + { + arr = new uint256[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function uint256s(uint256 v0, uint256 v1, uint256 v2, uint256 v3, uint256 v4, uint256 v5, uint256 v6, uint256 v7) + internal + pure + returns (uint256[] memory arr) + { + arr = new uint256[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function uint256s( + uint256 v0, + uint256 v1, + uint256 v2, + uint256 v3, + uint256 v4, + uint256 v5, + uint256 v6, + uint256 v7, + uint256 v8 + ) internal pure returns (uint256[] memory arr) { + arr = new uint256[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function uint256s( + uint256 v0, + uint256 v1, + uint256 v2, + uint256 v3, + uint256 v4, + uint256 v5, + uint256 v6, + uint256 v7, + uint256 v8, + uint256 v9 + ) internal pure returns (uint256[] memory arr) { + arr = new uint256[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function uint256s( + uint256 v0, + uint256 v1, + uint256 v2, + uint256 v3, + uint256 v4, + uint256 v5, + uint256 v6, + uint256 v7, + uint256 v8, + uint256 v9, + uint256 v10 + ) internal pure returns (uint256[] memory arr) { + arr = new uint256[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function uint256s( + uint256 v0, + uint256 v1, + uint256 v2, + uint256 v3, + uint256 v4, + uint256 v5, + uint256 v6, + uint256 v7, + uint256 v8, + uint256 v9, + uint256 v10, + uint256 v11 + ) internal pure returns (uint256[] memory arr) { + arr = new uint256[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function int8s(int8 v0) internal pure returns (int8[] memory arr) { + arr = new int8[](1); + arr[0] = v0; + } + + function int8s(int8 v0, int8 v1) internal pure returns (int8[] memory arr) { + arr = new int8[](2); + arr[0] = v0; + arr[1] = v1; + } + + function int8s(int8 v0, int8 v1, int8 v2) internal pure returns (int8[] memory arr) { + arr = new int8[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function int8s(int8 v0, int8 v1, int8 v2, int8 v3) internal pure returns (int8[] memory arr) { + arr = new int8[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function int8s(int8 v0, int8 v1, int8 v2, int8 v3, int8 v4) internal pure returns (int8[] memory arr) { + arr = new int8[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function int8s(int8 v0, int8 v1, int8 v2, int8 v3, int8 v4, int8 v5) internal pure returns (int8[] memory arr) { + arr = new int8[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function int8s(int8 v0, int8 v1, int8 v2, int8 v3, int8 v4, int8 v5, int8 v6) + internal + pure + returns (int8[] memory arr) + { + arr = new int8[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function int8s(int8 v0, int8 v1, int8 v2, int8 v3, int8 v4, int8 v5, int8 v6, int8 v7) + internal + pure + returns (int8[] memory arr) + { + arr = new int8[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function int8s(int8 v0, int8 v1, int8 v2, int8 v3, int8 v4, int8 v5, int8 v6, int8 v7, int8 v8) + internal + pure + returns (int8[] memory arr) + { + arr = new int8[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function int8s(int8 v0, int8 v1, int8 v2, int8 v3, int8 v4, int8 v5, int8 v6, int8 v7, int8 v8, int8 v9) + internal + pure + returns (int8[] memory arr) + { + arr = new int8[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function int8s(int8 v0, int8 v1, int8 v2, int8 v3, int8 v4, int8 v5, int8 v6, int8 v7, int8 v8, int8 v9, int8 v10) + internal + pure + returns (int8[] memory arr) + { + arr = new int8[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function int8s( + int8 v0, + int8 v1, + int8 v2, + int8 v3, + int8 v4, + int8 v5, + int8 v6, + int8 v7, + int8 v8, + int8 v9, + int8 v10, + int8 v11 + ) internal pure returns (int8[] memory arr) { + arr = new int8[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function int16s(int16 v0) internal pure returns (int16[] memory arr) { + arr = new int16[](1); + arr[0] = v0; + } + + function int16s(int16 v0, int16 v1) internal pure returns (int16[] memory arr) { + arr = new int16[](2); + arr[0] = v0; + arr[1] = v1; + } + + function int16s(int16 v0, int16 v1, int16 v2) internal pure returns (int16[] memory arr) { + arr = new int16[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function int16s(int16 v0, int16 v1, int16 v2, int16 v3) internal pure returns (int16[] memory arr) { + arr = new int16[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function int16s(int16 v0, int16 v1, int16 v2, int16 v3, int16 v4) internal pure returns (int16[] memory arr) { + arr = new int16[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function int16s(int16 v0, int16 v1, int16 v2, int16 v3, int16 v4, int16 v5) + internal + pure + returns (int16[] memory arr) + { + arr = new int16[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function int16s(int16 v0, int16 v1, int16 v2, int16 v3, int16 v4, int16 v5, int16 v6) + internal + pure + returns (int16[] memory arr) + { + arr = new int16[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function int16s(int16 v0, int16 v1, int16 v2, int16 v3, int16 v4, int16 v5, int16 v6, int16 v7) + internal + pure + returns (int16[] memory arr) + { + arr = new int16[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function int16s(int16 v0, int16 v1, int16 v2, int16 v3, int16 v4, int16 v5, int16 v6, int16 v7, int16 v8) + internal + pure + returns (int16[] memory arr) + { + arr = new int16[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function int16s(int16 v0, int16 v1, int16 v2, int16 v3, int16 v4, int16 v5, int16 v6, int16 v7, int16 v8, int16 v9) + internal + pure + returns (int16[] memory arr) + { + arr = new int16[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function int16s( + int16 v0, + int16 v1, + int16 v2, + int16 v3, + int16 v4, + int16 v5, + int16 v6, + int16 v7, + int16 v8, + int16 v9, + int16 v10 + ) internal pure returns (int16[] memory arr) { + arr = new int16[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function int16s( + int16 v0, + int16 v1, + int16 v2, + int16 v3, + int16 v4, + int16 v5, + int16 v6, + int16 v7, + int16 v8, + int16 v9, + int16 v10, + int16 v11 + ) internal pure returns (int16[] memory arr) { + arr = new int16[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function int24s(int24 v0) internal pure returns (int24[] memory arr) { + arr = new int24[](1); + arr[0] = v0; + } + + function int24s(int24 v0, int24 v1) internal pure returns (int24[] memory arr) { + arr = new int24[](2); + arr[0] = v0; + arr[1] = v1; + } + + function int24s(int24 v0, int24 v1, int24 v2) internal pure returns (int24[] memory arr) { + arr = new int24[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function int24s(int24 v0, int24 v1, int24 v2, int24 v3) internal pure returns (int24[] memory arr) { + arr = new int24[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function int24s(int24 v0, int24 v1, int24 v2, int24 v3, int24 v4) internal pure returns (int24[] memory arr) { + arr = new int24[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function int24s(int24 v0, int24 v1, int24 v2, int24 v3, int24 v4, int24 v5) + internal + pure + returns (int24[] memory arr) + { + arr = new int24[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function int24s(int24 v0, int24 v1, int24 v2, int24 v3, int24 v4, int24 v5, int24 v6) + internal + pure + returns (int24[] memory arr) + { + arr = new int24[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function int24s(int24 v0, int24 v1, int24 v2, int24 v3, int24 v4, int24 v5, int24 v6, int24 v7) + internal + pure + returns (int24[] memory arr) + { + arr = new int24[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function int24s(int24 v0, int24 v1, int24 v2, int24 v3, int24 v4, int24 v5, int24 v6, int24 v7, int24 v8) + internal + pure + returns (int24[] memory arr) + { + arr = new int24[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function int24s(int24 v0, int24 v1, int24 v2, int24 v3, int24 v4, int24 v5, int24 v6, int24 v7, int24 v8, int24 v9) + internal + pure + returns (int24[] memory arr) + { + arr = new int24[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function int24s( + int24 v0, + int24 v1, + int24 v2, + int24 v3, + int24 v4, + int24 v5, + int24 v6, + int24 v7, + int24 v8, + int24 v9, + int24 v10 + ) internal pure returns (int24[] memory arr) { + arr = new int24[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function int24s( + int24 v0, + int24 v1, + int24 v2, + int24 v3, + int24 v4, + int24 v5, + int24 v6, + int24 v7, + int24 v8, + int24 v9, + int24 v10, + int24 v11 + ) internal pure returns (int24[] memory arr) { + arr = new int24[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function int32s(int32 v0) internal pure returns (int32[] memory arr) { + arr = new int32[](1); + arr[0] = v0; + } + + function int32s(int32 v0, int32 v1) internal pure returns (int32[] memory arr) { + arr = new int32[](2); + arr[0] = v0; + arr[1] = v1; + } + + function int32s(int32 v0, int32 v1, int32 v2) internal pure returns (int32[] memory arr) { + arr = new int32[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function int32s(int32 v0, int32 v1, int32 v2, int32 v3) internal pure returns (int32[] memory arr) { + arr = new int32[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function int32s(int32 v0, int32 v1, int32 v2, int32 v3, int32 v4) internal pure returns (int32[] memory arr) { + arr = new int32[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function int32s(int32 v0, int32 v1, int32 v2, int32 v3, int32 v4, int32 v5) + internal + pure + returns (int32[] memory arr) + { + arr = new int32[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function int32s(int32 v0, int32 v1, int32 v2, int32 v3, int32 v4, int32 v5, int32 v6) + internal + pure + returns (int32[] memory arr) + { + arr = new int32[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function int32s(int32 v0, int32 v1, int32 v2, int32 v3, int32 v4, int32 v5, int32 v6, int32 v7) + internal + pure + returns (int32[] memory arr) + { + arr = new int32[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function int32s(int32 v0, int32 v1, int32 v2, int32 v3, int32 v4, int32 v5, int32 v6, int32 v7, int32 v8) + internal + pure + returns (int32[] memory arr) + { + arr = new int32[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function int32s(int32 v0, int32 v1, int32 v2, int32 v3, int32 v4, int32 v5, int32 v6, int32 v7, int32 v8, int32 v9) + internal + pure + returns (int32[] memory arr) + { + arr = new int32[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function int32s( + int32 v0, + int32 v1, + int32 v2, + int32 v3, + int32 v4, + int32 v5, + int32 v6, + int32 v7, + int32 v8, + int32 v9, + int32 v10 + ) internal pure returns (int32[] memory arr) { + arr = new int32[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function int32s( + int32 v0, + int32 v1, + int32 v2, + int32 v3, + int32 v4, + int32 v5, + int32 v6, + int32 v7, + int32 v8, + int32 v9, + int32 v10, + int32 v11 + ) internal pure returns (int32[] memory arr) { + arr = new int32[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function int40s(int40 v0) internal pure returns (int40[] memory arr) { + arr = new int40[](1); + arr[0] = v0; + } + + function int40s(int40 v0, int40 v1) internal pure returns (int40[] memory arr) { + arr = new int40[](2); + arr[0] = v0; + arr[1] = v1; + } + + function int40s(int40 v0, int40 v1, int40 v2) internal pure returns (int40[] memory arr) { + arr = new int40[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function int40s(int40 v0, int40 v1, int40 v2, int40 v3) internal pure returns (int40[] memory arr) { + arr = new int40[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function int40s(int40 v0, int40 v1, int40 v2, int40 v3, int40 v4) internal pure returns (int40[] memory arr) { + arr = new int40[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function int40s(int40 v0, int40 v1, int40 v2, int40 v3, int40 v4, int40 v5) + internal + pure + returns (int40[] memory arr) + { + arr = new int40[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function int40s(int40 v0, int40 v1, int40 v2, int40 v3, int40 v4, int40 v5, int40 v6) + internal + pure + returns (int40[] memory arr) + { + arr = new int40[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function int40s(int40 v0, int40 v1, int40 v2, int40 v3, int40 v4, int40 v5, int40 v6, int40 v7) + internal + pure + returns (int40[] memory arr) + { + arr = new int40[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function int40s(int40 v0, int40 v1, int40 v2, int40 v3, int40 v4, int40 v5, int40 v6, int40 v7, int40 v8) + internal + pure + returns (int40[] memory arr) + { + arr = new int40[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function int40s(int40 v0, int40 v1, int40 v2, int40 v3, int40 v4, int40 v5, int40 v6, int40 v7, int40 v8, int40 v9) + internal + pure + returns (int40[] memory arr) + { + arr = new int40[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function int40s( + int40 v0, + int40 v1, + int40 v2, + int40 v3, + int40 v4, + int40 v5, + int40 v6, + int40 v7, + int40 v8, + int40 v9, + int40 v10 + ) internal pure returns (int40[] memory arr) { + arr = new int40[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function int40s( + int40 v0, + int40 v1, + int40 v2, + int40 v3, + int40 v4, + int40 v5, + int40 v6, + int40 v7, + int40 v8, + int40 v9, + int40 v10, + int40 v11 + ) internal pure returns (int40[] memory arr) { + arr = new int40[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function int48s(int48 v0) internal pure returns (int48[] memory arr) { + arr = new int48[](1); + arr[0] = v0; + } + + function int48s(int48 v0, int48 v1) internal pure returns (int48[] memory arr) { + arr = new int48[](2); + arr[0] = v0; + arr[1] = v1; + } + + function int48s(int48 v0, int48 v1, int48 v2) internal pure returns (int48[] memory arr) { + arr = new int48[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function int48s(int48 v0, int48 v1, int48 v2, int48 v3) internal pure returns (int48[] memory arr) { + arr = new int48[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function int48s(int48 v0, int48 v1, int48 v2, int48 v3, int48 v4) internal pure returns (int48[] memory arr) { + arr = new int48[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function int48s(int48 v0, int48 v1, int48 v2, int48 v3, int48 v4, int48 v5) + internal + pure + returns (int48[] memory arr) + { + arr = new int48[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function int48s(int48 v0, int48 v1, int48 v2, int48 v3, int48 v4, int48 v5, int48 v6) + internal + pure + returns (int48[] memory arr) + { + arr = new int48[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function int48s(int48 v0, int48 v1, int48 v2, int48 v3, int48 v4, int48 v5, int48 v6, int48 v7) + internal + pure + returns (int48[] memory arr) + { + arr = new int48[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function int48s(int48 v0, int48 v1, int48 v2, int48 v3, int48 v4, int48 v5, int48 v6, int48 v7, int48 v8) + internal + pure + returns (int48[] memory arr) + { + arr = new int48[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function int48s(int48 v0, int48 v1, int48 v2, int48 v3, int48 v4, int48 v5, int48 v6, int48 v7, int48 v8, int48 v9) + internal + pure + returns (int48[] memory arr) + { + arr = new int48[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function int48s( + int48 v0, + int48 v1, + int48 v2, + int48 v3, + int48 v4, + int48 v5, + int48 v6, + int48 v7, + int48 v8, + int48 v9, + int48 v10 + ) internal pure returns (int48[] memory arr) { + arr = new int48[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function int48s( + int48 v0, + int48 v1, + int48 v2, + int48 v3, + int48 v4, + int48 v5, + int48 v6, + int48 v7, + int48 v8, + int48 v9, + int48 v10, + int48 v11 + ) internal pure returns (int48[] memory arr) { + arr = new int48[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function int64s(int64 v0) internal pure returns (int64[] memory arr) { + arr = new int64[](1); + arr[0] = v0; + } + + function int64s(int64 v0, int64 v1) internal pure returns (int64[] memory arr) { + arr = new int64[](2); + arr[0] = v0; + arr[1] = v1; + } + + function int64s(int64 v0, int64 v1, int64 v2) internal pure returns (int64[] memory arr) { + arr = new int64[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function int64s(int64 v0, int64 v1, int64 v2, int64 v3) internal pure returns (int64[] memory arr) { + arr = new int64[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function int64s(int64 v0, int64 v1, int64 v2, int64 v3, int64 v4) internal pure returns (int64[] memory arr) { + arr = new int64[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function int64s(int64 v0, int64 v1, int64 v2, int64 v3, int64 v4, int64 v5) + internal + pure + returns (int64[] memory arr) + { + arr = new int64[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function int64s(int64 v0, int64 v1, int64 v2, int64 v3, int64 v4, int64 v5, int64 v6) + internal + pure + returns (int64[] memory arr) + { + arr = new int64[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function int64s(int64 v0, int64 v1, int64 v2, int64 v3, int64 v4, int64 v5, int64 v6, int64 v7) + internal + pure + returns (int64[] memory arr) + { + arr = new int64[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function int64s(int64 v0, int64 v1, int64 v2, int64 v3, int64 v4, int64 v5, int64 v6, int64 v7, int64 v8) + internal + pure + returns (int64[] memory arr) + { + arr = new int64[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function int64s(int64 v0, int64 v1, int64 v2, int64 v3, int64 v4, int64 v5, int64 v6, int64 v7, int64 v8, int64 v9) + internal + pure + returns (int64[] memory arr) + { + arr = new int64[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function int64s( + int64 v0, + int64 v1, + int64 v2, + int64 v3, + int64 v4, + int64 v5, + int64 v6, + int64 v7, + int64 v8, + int64 v9, + int64 v10 + ) internal pure returns (int64[] memory arr) { + arr = new int64[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function int64s( + int64 v0, + int64 v1, + int64 v2, + int64 v3, + int64 v4, + int64 v5, + int64 v6, + int64 v7, + int64 v8, + int64 v9, + int64 v10, + int64 v11 + ) internal pure returns (int64[] memory arr) { + arr = new int64[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function int96s(int96 v0) internal pure returns (int96[] memory arr) { + arr = new int96[](1); + arr[0] = v0; + } + + function int96s(int96 v0, int96 v1) internal pure returns (int96[] memory arr) { + arr = new int96[](2); + arr[0] = v0; + arr[1] = v1; + } + + function int96s(int96 v0, int96 v1, int96 v2) internal pure returns (int96[] memory arr) { + arr = new int96[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function int96s(int96 v0, int96 v1, int96 v2, int96 v3) internal pure returns (int96[] memory arr) { + arr = new int96[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function int96s(int96 v0, int96 v1, int96 v2, int96 v3, int96 v4) internal pure returns (int96[] memory arr) { + arr = new int96[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function int96s(int96 v0, int96 v1, int96 v2, int96 v3, int96 v4, int96 v5) + internal + pure + returns (int96[] memory arr) + { + arr = new int96[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function int96s(int96 v0, int96 v1, int96 v2, int96 v3, int96 v4, int96 v5, int96 v6) + internal + pure + returns (int96[] memory arr) + { + arr = new int96[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function int96s(int96 v0, int96 v1, int96 v2, int96 v3, int96 v4, int96 v5, int96 v6, int96 v7) + internal + pure + returns (int96[] memory arr) + { + arr = new int96[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function int96s(int96 v0, int96 v1, int96 v2, int96 v3, int96 v4, int96 v5, int96 v6, int96 v7, int96 v8) + internal + pure + returns (int96[] memory arr) + { + arr = new int96[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function int96s(int96 v0, int96 v1, int96 v2, int96 v3, int96 v4, int96 v5, int96 v6, int96 v7, int96 v8, int96 v9) + internal + pure + returns (int96[] memory arr) + { + arr = new int96[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function int96s( + int96 v0, + int96 v1, + int96 v2, + int96 v3, + int96 v4, + int96 v5, + int96 v6, + int96 v7, + int96 v8, + int96 v9, + int96 v10 + ) internal pure returns (int96[] memory arr) { + arr = new int96[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function int96s( + int96 v0, + int96 v1, + int96 v2, + int96 v3, + int96 v4, + int96 v5, + int96 v6, + int96 v7, + int96 v8, + int96 v9, + int96 v10, + int96 v11 + ) internal pure returns (int96[] memory arr) { + arr = new int96[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function int128s(int128 v0) internal pure returns (int128[] memory arr) { + arr = new int128[](1); + arr[0] = v0; + } + + function int128s(int128 v0, int128 v1) internal pure returns (int128[] memory arr) { + arr = new int128[](2); + arr[0] = v0; + arr[1] = v1; + } + + function int128s(int128 v0, int128 v1, int128 v2) internal pure returns (int128[] memory arr) { + arr = new int128[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function int128s(int128 v0, int128 v1, int128 v2, int128 v3) internal pure returns (int128[] memory arr) { + arr = new int128[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function int128s(int128 v0, int128 v1, int128 v2, int128 v3, int128 v4) + internal + pure + returns (int128[] memory arr) + { + arr = new int128[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function int128s(int128 v0, int128 v1, int128 v2, int128 v3, int128 v4, int128 v5) + internal + pure + returns (int128[] memory arr) + { + arr = new int128[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function int128s(int128 v0, int128 v1, int128 v2, int128 v3, int128 v4, int128 v5, int128 v6) + internal + pure + returns (int128[] memory arr) + { + arr = new int128[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function int128s(int128 v0, int128 v1, int128 v2, int128 v3, int128 v4, int128 v5, int128 v6, int128 v7) + internal + pure + returns (int128[] memory arr) + { + arr = new int128[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function int128s(int128 v0, int128 v1, int128 v2, int128 v3, int128 v4, int128 v5, int128 v6, int128 v7, int128 v8) + internal + pure + returns (int128[] memory arr) + { + arr = new int128[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function int128s( + int128 v0, + int128 v1, + int128 v2, + int128 v3, + int128 v4, + int128 v5, + int128 v6, + int128 v7, + int128 v8, + int128 v9 + ) internal pure returns (int128[] memory arr) { + arr = new int128[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function int128s( + int128 v0, + int128 v1, + int128 v2, + int128 v3, + int128 v4, + int128 v5, + int128 v6, + int128 v7, + int128 v8, + int128 v9, + int128 v10 + ) internal pure returns (int128[] memory arr) { + arr = new int128[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function int128s( + int128 v0, + int128 v1, + int128 v2, + int128 v3, + int128 v4, + int128 v5, + int128 v6, + int128 v7, + int128 v8, + int128 v9, + int128 v10, + int128 v11 + ) internal pure returns (int128[] memory arr) { + arr = new int128[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function int160s(int160 v0) internal pure returns (int160[] memory arr) { + arr = new int160[](1); + arr[0] = v0; + } + + function int160s(int160 v0, int160 v1) internal pure returns (int160[] memory arr) { + arr = new int160[](2); + arr[0] = v0; + arr[1] = v1; + } + + function int160s(int160 v0, int160 v1, int160 v2) internal pure returns (int160[] memory arr) { + arr = new int160[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function int160s(int160 v0, int160 v1, int160 v2, int160 v3) internal pure returns (int160[] memory arr) { + arr = new int160[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function int160s(int160 v0, int160 v1, int160 v2, int160 v3, int160 v4) + internal + pure + returns (int160[] memory arr) + { + arr = new int160[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function int160s(int160 v0, int160 v1, int160 v2, int160 v3, int160 v4, int160 v5) + internal + pure + returns (int160[] memory arr) + { + arr = new int160[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function int160s(int160 v0, int160 v1, int160 v2, int160 v3, int160 v4, int160 v5, int160 v6) + internal + pure + returns (int160[] memory arr) + { + arr = new int160[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function int160s(int160 v0, int160 v1, int160 v2, int160 v3, int160 v4, int160 v5, int160 v6, int160 v7) + internal + pure + returns (int160[] memory arr) + { + arr = new int160[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function int160s(int160 v0, int160 v1, int160 v2, int160 v3, int160 v4, int160 v5, int160 v6, int160 v7, int160 v8) + internal + pure + returns (int160[] memory arr) + { + arr = new int160[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function int160s( + int160 v0, + int160 v1, + int160 v2, + int160 v3, + int160 v4, + int160 v5, + int160 v6, + int160 v7, + int160 v8, + int160 v9 + ) internal pure returns (int160[] memory arr) { + arr = new int160[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function int160s( + int160 v0, + int160 v1, + int160 v2, + int160 v3, + int160 v4, + int160 v5, + int160 v6, + int160 v7, + int160 v8, + int160 v9, + int160 v10 + ) internal pure returns (int160[] memory arr) { + arr = new int160[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function int160s( + int160 v0, + int160 v1, + int160 v2, + int160 v3, + int160 v4, + int160 v5, + int160 v6, + int160 v7, + int160 v8, + int160 v9, + int160 v10, + int160 v11 + ) internal pure returns (int160[] memory arr) { + arr = new int160[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function int256s(int256 v0) internal pure returns (int256[] memory arr) { + arr = new int256[](1); + arr[0] = v0; + } + + function int256s(int256 v0, int256 v1) internal pure returns (int256[] memory arr) { + arr = new int256[](2); + arr[0] = v0; + arr[1] = v1; + } + + function int256s(int256 v0, int256 v1, int256 v2) internal pure returns (int256[] memory arr) { + arr = new int256[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function int256s(int256 v0, int256 v1, int256 v2, int256 v3) internal pure returns (int256[] memory arr) { + arr = new int256[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function int256s(int256 v0, int256 v1, int256 v2, int256 v3, int256 v4) + internal + pure + returns (int256[] memory arr) + { + arr = new int256[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function int256s(int256 v0, int256 v1, int256 v2, int256 v3, int256 v4, int256 v5) + internal + pure + returns (int256[] memory arr) + { + arr = new int256[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function int256s(int256 v0, int256 v1, int256 v2, int256 v3, int256 v4, int256 v5, int256 v6) + internal + pure + returns (int256[] memory arr) + { + arr = new int256[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function int256s(int256 v0, int256 v1, int256 v2, int256 v3, int256 v4, int256 v5, int256 v6, int256 v7) + internal + pure + returns (int256[] memory arr) + { + arr = new int256[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function int256s(int256 v0, int256 v1, int256 v2, int256 v3, int256 v4, int256 v5, int256 v6, int256 v7, int256 v8) + internal + pure + returns (int256[] memory arr) + { + arr = new int256[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function int256s( + int256 v0, + int256 v1, + int256 v2, + int256 v3, + int256 v4, + int256 v5, + int256 v6, + int256 v7, + int256 v8, + int256 v9 + ) internal pure returns (int256[] memory arr) { + arr = new int256[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function int256s( + int256 v0, + int256 v1, + int256 v2, + int256 v3, + int256 v4, + int256 v5, + int256 v6, + int256 v7, + int256 v8, + int256 v9, + int256 v10 + ) internal pure returns (int256[] memory arr) { + arr = new int256[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function int256s( + int256 v0, + int256 v1, + int256 v2, + int256 v3, + int256 v4, + int256 v5, + int256 v6, + int256 v7, + int256 v8, + int256 v9, + int256 v10, + int256 v11 + ) internal pure returns (int256[] memory arr) { + arr = new int256[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function bytes1s(bytes1 v0) internal pure returns (bytes1[] memory arr) { + arr = new bytes1[](1); + arr[0] = v0; + } + + function bytes1s(bytes1 v0, bytes1 v1) internal pure returns (bytes1[] memory arr) { + arr = new bytes1[](2); + arr[0] = v0; + arr[1] = v1; + } + + function bytes1s(bytes1 v0, bytes1 v1, bytes1 v2) internal pure returns (bytes1[] memory arr) { + arr = new bytes1[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function bytes1s(bytes1 v0, bytes1 v1, bytes1 v2, bytes1 v3) internal pure returns (bytes1[] memory arr) { + arr = new bytes1[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function bytes1s(bytes1 v0, bytes1 v1, bytes1 v2, bytes1 v3, bytes1 v4) + internal + pure + returns (bytes1[] memory arr) + { + arr = new bytes1[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function bytes1s(bytes1 v0, bytes1 v1, bytes1 v2, bytes1 v3, bytes1 v4, bytes1 v5) + internal + pure + returns (bytes1[] memory arr) + { + arr = new bytes1[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function bytes1s(bytes1 v0, bytes1 v1, bytes1 v2, bytes1 v3, bytes1 v4, bytes1 v5, bytes1 v6) + internal + pure + returns (bytes1[] memory arr) + { + arr = new bytes1[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function bytes1s(bytes1 v0, bytes1 v1, bytes1 v2, bytes1 v3, bytes1 v4, bytes1 v5, bytes1 v6, bytes1 v7) + internal + pure + returns (bytes1[] memory arr) + { + arr = new bytes1[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function bytes1s(bytes1 v0, bytes1 v1, bytes1 v2, bytes1 v3, bytes1 v4, bytes1 v5, bytes1 v6, bytes1 v7, bytes1 v8) + internal + pure + returns (bytes1[] memory arr) + { + arr = new bytes1[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function bytes1s( + bytes1 v0, + bytes1 v1, + bytes1 v2, + bytes1 v3, + bytes1 v4, + bytes1 v5, + bytes1 v6, + bytes1 v7, + bytes1 v8, + bytes1 v9 + ) internal pure returns (bytes1[] memory arr) { + arr = new bytes1[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function bytes1s( + bytes1 v0, + bytes1 v1, + bytes1 v2, + bytes1 v3, + bytes1 v4, + bytes1 v5, + bytes1 v6, + bytes1 v7, + bytes1 v8, + bytes1 v9, + bytes1 v10 + ) internal pure returns (bytes1[] memory arr) { + arr = new bytes1[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function bytes1s( + bytes1 v0, + bytes1 v1, + bytes1 v2, + bytes1 v3, + bytes1 v4, + bytes1 v5, + bytes1 v6, + bytes1 v7, + bytes1 v8, + bytes1 v9, + bytes1 v10, + bytes1 v11 + ) internal pure returns (bytes1[] memory arr) { + arr = new bytes1[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function bytes4s(bytes4 v0) internal pure returns (bytes4[] memory arr) { + arr = new bytes4[](1); + arr[0] = v0; + } + + function bytes4s(bytes4 v0, bytes4 v1) internal pure returns (bytes4[] memory arr) { + arr = new bytes4[](2); + arr[0] = v0; + arr[1] = v1; + } + + function bytes4s(bytes4 v0, bytes4 v1, bytes4 v2) internal pure returns (bytes4[] memory arr) { + arr = new bytes4[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function bytes4s(bytes4 v0, bytes4 v1, bytes4 v2, bytes4 v3) internal pure returns (bytes4[] memory arr) { + arr = new bytes4[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function bytes4s(bytes4 v0, bytes4 v1, bytes4 v2, bytes4 v3, bytes4 v4) + internal + pure + returns (bytes4[] memory arr) + { + arr = new bytes4[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function bytes4s(bytes4 v0, bytes4 v1, bytes4 v2, bytes4 v3, bytes4 v4, bytes4 v5) + internal + pure + returns (bytes4[] memory arr) + { + arr = new bytes4[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function bytes4s(bytes4 v0, bytes4 v1, bytes4 v2, bytes4 v3, bytes4 v4, bytes4 v5, bytes4 v6) + internal + pure + returns (bytes4[] memory arr) + { + arr = new bytes4[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function bytes4s(bytes4 v0, bytes4 v1, bytes4 v2, bytes4 v3, bytes4 v4, bytes4 v5, bytes4 v6, bytes4 v7) + internal + pure + returns (bytes4[] memory arr) + { + arr = new bytes4[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function bytes4s(bytes4 v0, bytes4 v1, bytes4 v2, bytes4 v3, bytes4 v4, bytes4 v5, bytes4 v6, bytes4 v7, bytes4 v8) + internal + pure + returns (bytes4[] memory arr) + { + arr = new bytes4[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function bytes4s( + bytes4 v0, + bytes4 v1, + bytes4 v2, + bytes4 v3, + bytes4 v4, + bytes4 v5, + bytes4 v6, + bytes4 v7, + bytes4 v8, + bytes4 v9 + ) internal pure returns (bytes4[] memory arr) { + arr = new bytes4[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function bytes4s( + bytes4 v0, + bytes4 v1, + bytes4 v2, + bytes4 v3, + bytes4 v4, + bytes4 v5, + bytes4 v6, + bytes4 v7, + bytes4 v8, + bytes4 v9, + bytes4 v10 + ) internal pure returns (bytes4[] memory arr) { + arr = new bytes4[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function bytes4s( + bytes4 v0, + bytes4 v1, + bytes4 v2, + bytes4 v3, + bytes4 v4, + bytes4 v5, + bytes4 v6, + bytes4 v7, + bytes4 v8, + bytes4 v9, + bytes4 v10, + bytes4 v11 + ) internal pure returns (bytes4[] memory arr) { + arr = new bytes4[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function bytes8s(bytes8 v0) internal pure returns (bytes8[] memory arr) { + arr = new bytes8[](1); + arr[0] = v0; + } + + function bytes8s(bytes8 v0, bytes8 v1) internal pure returns (bytes8[] memory arr) { + arr = new bytes8[](2); + arr[0] = v0; + arr[1] = v1; + } + + function bytes8s(bytes8 v0, bytes8 v1, bytes8 v2) internal pure returns (bytes8[] memory arr) { + arr = new bytes8[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function bytes8s(bytes8 v0, bytes8 v1, bytes8 v2, bytes8 v3) internal pure returns (bytes8[] memory arr) { + arr = new bytes8[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function bytes8s(bytes8 v0, bytes8 v1, bytes8 v2, bytes8 v3, bytes8 v4) + internal + pure + returns (bytes8[] memory arr) + { + arr = new bytes8[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function bytes8s(bytes8 v0, bytes8 v1, bytes8 v2, bytes8 v3, bytes8 v4, bytes8 v5) + internal + pure + returns (bytes8[] memory arr) + { + arr = new bytes8[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function bytes8s(bytes8 v0, bytes8 v1, bytes8 v2, bytes8 v3, bytes8 v4, bytes8 v5, bytes8 v6) + internal + pure + returns (bytes8[] memory arr) + { + arr = new bytes8[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function bytes8s(bytes8 v0, bytes8 v1, bytes8 v2, bytes8 v3, bytes8 v4, bytes8 v5, bytes8 v6, bytes8 v7) + internal + pure + returns (bytes8[] memory arr) + { + arr = new bytes8[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function bytes8s(bytes8 v0, bytes8 v1, bytes8 v2, bytes8 v3, bytes8 v4, bytes8 v5, bytes8 v6, bytes8 v7, bytes8 v8) + internal + pure + returns (bytes8[] memory arr) + { + arr = new bytes8[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function bytes8s( + bytes8 v0, + bytes8 v1, + bytes8 v2, + bytes8 v3, + bytes8 v4, + bytes8 v5, + bytes8 v6, + bytes8 v7, + bytes8 v8, + bytes8 v9 + ) internal pure returns (bytes8[] memory arr) { + arr = new bytes8[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function bytes8s( + bytes8 v0, + bytes8 v1, + bytes8 v2, + bytes8 v3, + bytes8 v4, + bytes8 v5, + bytes8 v6, + bytes8 v7, + bytes8 v8, + bytes8 v9, + bytes8 v10 + ) internal pure returns (bytes8[] memory arr) { + arr = new bytes8[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function bytes8s( + bytes8 v0, + bytes8 v1, + bytes8 v2, + bytes8 v3, + bytes8 v4, + bytes8 v5, + bytes8 v6, + bytes8 v7, + bytes8 v8, + bytes8 v9, + bytes8 v10, + bytes8 v11 + ) internal pure returns (bytes8[] memory arr) { + arr = new bytes8[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function bytes10s(bytes10 v0) internal pure returns (bytes10[] memory arr) { + arr = new bytes10[](1); + arr[0] = v0; + } + + function bytes10s(bytes10 v0, bytes10 v1) internal pure returns (bytes10[] memory arr) { + arr = new bytes10[](2); + arr[0] = v0; + arr[1] = v1; + } + + function bytes10s(bytes10 v0, bytes10 v1, bytes10 v2) internal pure returns (bytes10[] memory arr) { + arr = new bytes10[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function bytes10s(bytes10 v0, bytes10 v1, bytes10 v2, bytes10 v3) internal pure returns (bytes10[] memory arr) { + arr = new bytes10[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function bytes10s(bytes10 v0, bytes10 v1, bytes10 v2, bytes10 v3, bytes10 v4) + internal + pure + returns (bytes10[] memory arr) + { + arr = new bytes10[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function bytes10s(bytes10 v0, bytes10 v1, bytes10 v2, bytes10 v3, bytes10 v4, bytes10 v5) + internal + pure + returns (bytes10[] memory arr) + { + arr = new bytes10[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function bytes10s(bytes10 v0, bytes10 v1, bytes10 v2, bytes10 v3, bytes10 v4, bytes10 v5, bytes10 v6) + internal + pure + returns (bytes10[] memory arr) + { + arr = new bytes10[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function bytes10s(bytes10 v0, bytes10 v1, bytes10 v2, bytes10 v3, bytes10 v4, bytes10 v5, bytes10 v6, bytes10 v7) + internal + pure + returns (bytes10[] memory arr) + { + arr = new bytes10[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function bytes10s( + bytes10 v0, + bytes10 v1, + bytes10 v2, + bytes10 v3, + bytes10 v4, + bytes10 v5, + bytes10 v6, + bytes10 v7, + bytes10 v8 + ) internal pure returns (bytes10[] memory arr) { + arr = new bytes10[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function bytes10s( + bytes10 v0, + bytes10 v1, + bytes10 v2, + bytes10 v3, + bytes10 v4, + bytes10 v5, + bytes10 v6, + bytes10 v7, + bytes10 v8, + bytes10 v9 + ) internal pure returns (bytes10[] memory arr) { + arr = new bytes10[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function bytes10s( + bytes10 v0, + bytes10 v1, + bytes10 v2, + bytes10 v3, + bytes10 v4, + bytes10 v5, + bytes10 v6, + bytes10 v7, + bytes10 v8, + bytes10 v9, + bytes10 v10 + ) internal pure returns (bytes10[] memory arr) { + arr = new bytes10[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function bytes10s( + bytes10 v0, + bytes10 v1, + bytes10 v2, + bytes10 v3, + bytes10 v4, + bytes10 v5, + bytes10 v6, + bytes10 v7, + bytes10 v8, + bytes10 v9, + bytes10 v10, + bytes10 v11 + ) internal pure returns (bytes10[] memory arr) { + arr = new bytes10[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function bytes20s(bytes20 v0) internal pure returns (bytes20[] memory arr) { + arr = new bytes20[](1); + arr[0] = v0; + } + + function bytes20s(bytes20 v0, bytes20 v1) internal pure returns (bytes20[] memory arr) { + arr = new bytes20[](2); + arr[0] = v0; + arr[1] = v1; + } + + function bytes20s(bytes20 v0, bytes20 v1, bytes20 v2) internal pure returns (bytes20[] memory arr) { + arr = new bytes20[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function bytes20s(bytes20 v0, bytes20 v1, bytes20 v2, bytes20 v3) internal pure returns (bytes20[] memory arr) { + arr = new bytes20[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function bytes20s(bytes20 v0, bytes20 v1, bytes20 v2, bytes20 v3, bytes20 v4) + internal + pure + returns (bytes20[] memory arr) + { + arr = new bytes20[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function bytes20s(bytes20 v0, bytes20 v1, bytes20 v2, bytes20 v3, bytes20 v4, bytes20 v5) + internal + pure + returns (bytes20[] memory arr) + { + arr = new bytes20[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function bytes20s(bytes20 v0, bytes20 v1, bytes20 v2, bytes20 v3, bytes20 v4, bytes20 v5, bytes20 v6) + internal + pure + returns (bytes20[] memory arr) + { + arr = new bytes20[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function bytes20s(bytes20 v0, bytes20 v1, bytes20 v2, bytes20 v3, bytes20 v4, bytes20 v5, bytes20 v6, bytes20 v7) + internal + pure + returns (bytes20[] memory arr) + { + arr = new bytes20[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function bytes20s( + bytes20 v0, + bytes20 v1, + bytes20 v2, + bytes20 v3, + bytes20 v4, + bytes20 v5, + bytes20 v6, + bytes20 v7, + bytes20 v8 + ) internal pure returns (bytes20[] memory arr) { + arr = new bytes20[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function bytes20s( + bytes20 v0, + bytes20 v1, + bytes20 v2, + bytes20 v3, + bytes20 v4, + bytes20 v5, + bytes20 v6, + bytes20 v7, + bytes20 v8, + bytes20 v9 + ) internal pure returns (bytes20[] memory arr) { + arr = new bytes20[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function bytes20s( + bytes20 v0, + bytes20 v1, + bytes20 v2, + bytes20 v3, + bytes20 v4, + bytes20 v5, + bytes20 v6, + bytes20 v7, + bytes20 v8, + bytes20 v9, + bytes20 v10 + ) internal pure returns (bytes20[] memory arr) { + arr = new bytes20[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function bytes20s( + bytes20 v0, + bytes20 v1, + bytes20 v2, + bytes20 v3, + bytes20 v4, + bytes20 v5, + bytes20 v6, + bytes20 v7, + bytes20 v8, + bytes20 v9, + bytes20 v10, + bytes20 v11 + ) internal pure returns (bytes20[] memory arr) { + arr = new bytes20[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function bytes32s(bytes32 v0) internal pure returns (bytes32[] memory arr) { + arr = new bytes32[](1); + arr[0] = v0; + } + + function bytes32s(bytes32 v0, bytes32 v1) internal pure returns (bytes32[] memory arr) { + arr = new bytes32[](2); + arr[0] = v0; + arr[1] = v1; + } + + function bytes32s(bytes32 v0, bytes32 v1, bytes32 v2) internal pure returns (bytes32[] memory arr) { + arr = new bytes32[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function bytes32s(bytes32 v0, bytes32 v1, bytes32 v2, bytes32 v3) internal pure returns (bytes32[] memory arr) { + arr = new bytes32[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function bytes32s(bytes32 v0, bytes32 v1, bytes32 v2, bytes32 v3, bytes32 v4) + internal + pure + returns (bytes32[] memory arr) + { + arr = new bytes32[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function bytes32s(bytes32 v0, bytes32 v1, bytes32 v2, bytes32 v3, bytes32 v4, bytes32 v5) + internal + pure + returns (bytes32[] memory arr) + { + arr = new bytes32[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function bytes32s(bytes32 v0, bytes32 v1, bytes32 v2, bytes32 v3, bytes32 v4, bytes32 v5, bytes32 v6) + internal + pure + returns (bytes32[] memory arr) + { + arr = new bytes32[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function bytes32s(bytes32 v0, bytes32 v1, bytes32 v2, bytes32 v3, bytes32 v4, bytes32 v5, bytes32 v6, bytes32 v7) + internal + pure + returns (bytes32[] memory arr) + { + arr = new bytes32[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function bytes32s( + bytes32 v0, + bytes32 v1, + bytes32 v2, + bytes32 v3, + bytes32 v4, + bytes32 v5, + bytes32 v6, + bytes32 v7, + bytes32 v8 + ) internal pure returns (bytes32[] memory arr) { + arr = new bytes32[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function bytes32s( + bytes32 v0, + bytes32 v1, + bytes32 v2, + bytes32 v3, + bytes32 v4, + bytes32 v5, + bytes32 v6, + bytes32 v7, + bytes32 v8, + bytes32 v9 + ) internal pure returns (bytes32[] memory arr) { + arr = new bytes32[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function bytes32s( + bytes32 v0, + bytes32 v1, + bytes32 v2, + bytes32 v3, + bytes32 v4, + bytes32 v5, + bytes32 v6, + bytes32 v7, + bytes32 v8, + bytes32 v9, + bytes32 v10 + ) internal pure returns (bytes32[] memory arr) { + arr = new bytes32[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function bytes32s( + bytes32 v0, + bytes32 v1, + bytes32 v2, + bytes32 v3, + bytes32 v4, + bytes32 v5, + bytes32 v6, + bytes32 v7, + bytes32 v8, + bytes32 v9, + bytes32 v10, + bytes32 v11 + ) internal pure returns (bytes32[] memory arr) { + arr = new bytes32[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function bytess(bytes memory v0) internal pure returns (bytes[] memory arr) { + arr = new bytes[](1); + arr[0] = v0; + } + + function bytess(bytes memory v0, bytes memory v1) internal pure returns (bytes[] memory arr) { + arr = new bytes[](2); + arr[0] = v0; + arr[1] = v1; + } + + function bytess(bytes memory v0, bytes memory v1, bytes memory v2) internal pure returns (bytes[] memory arr) { + arr = new bytes[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function bytess(bytes memory v0, bytes memory v1, bytes memory v2, bytes memory v3) + internal + pure + returns (bytes[] memory arr) + { + arr = new bytes[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function bytess(bytes memory v0, bytes memory v1, bytes memory v2, bytes memory v3, bytes memory v4) + internal + pure + returns (bytes[] memory arr) + { + arr = new bytes[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function bytess( + bytes memory v0, + bytes memory v1, + bytes memory v2, + bytes memory v3, + bytes memory v4, + bytes memory v5 + ) internal pure returns (bytes[] memory arr) { + arr = new bytes[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function bytess( + bytes memory v0, + bytes memory v1, + bytes memory v2, + bytes memory v3, + bytes memory v4, + bytes memory v5, + bytes memory v6 + ) internal pure returns (bytes[] memory arr) { + arr = new bytes[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function bytess( + bytes memory v0, + bytes memory v1, + bytes memory v2, + bytes memory v3, + bytes memory v4, + bytes memory v5, + bytes memory v6, + bytes memory v7 + ) internal pure returns (bytes[] memory arr) { + arr = new bytes[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function bytess( + bytes memory v0, + bytes memory v1, + bytes memory v2, + bytes memory v3, + bytes memory v4, + bytes memory v5, + bytes memory v6, + bytes memory v7, + bytes memory v8 + ) internal pure returns (bytes[] memory arr) { + arr = new bytes[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function bytess( + bytes memory v0, + bytes memory v1, + bytes memory v2, + bytes memory v3, + bytes memory v4, + bytes memory v5, + bytes memory v6, + bytes memory v7, + bytes memory v8, + bytes memory v9 + ) internal pure returns (bytes[] memory arr) { + arr = new bytes[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function bytess( + bytes memory v0, + bytes memory v1, + bytes memory v2, + bytes memory v3, + bytes memory v4, + bytes memory v5, + bytes memory v6, + bytes memory v7, + bytes memory v8, + bytes memory v9, + bytes memory v10 + ) internal pure returns (bytes[] memory arr) { + arr = new bytes[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function bytess( + bytes memory v0, + bytes memory v1, + bytes memory v2, + bytes memory v3, + bytes memory v4, + bytes memory v5, + bytes memory v6, + bytes memory v7, + bytes memory v8, + bytes memory v9, + bytes memory v10, + bytes memory v11 + ) internal pure returns (bytes[] memory arr) { + arr = new bytes[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } + + function strings(string memory v0) internal pure returns (string[] memory arr) { + arr = new string[](1); + arr[0] = v0; + } + + function strings(string memory v0, string memory v1) internal pure returns (string[] memory arr) { + arr = new string[](2); + arr[0] = v0; + arr[1] = v1; + } + + function strings(string memory v0, string memory v1, string memory v2) + internal + pure + returns (string[] memory arr) + { + arr = new string[](3); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + } + + function strings(string memory v0, string memory v1, string memory v2, string memory v3) + internal + pure + returns (string[] memory arr) + { + arr = new string[](4); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + } + + function strings(string memory v0, string memory v1, string memory v2, string memory v3, string memory v4) + internal + pure + returns (string[] memory arr) + { + arr = new string[](5); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + } + + function strings( + string memory v0, + string memory v1, + string memory v2, + string memory v3, + string memory v4, + string memory v5 + ) internal pure returns (string[] memory arr) { + arr = new string[](6); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + } + + function strings( + string memory v0, + string memory v1, + string memory v2, + string memory v3, + string memory v4, + string memory v5, + string memory v6 + ) internal pure returns (string[] memory arr) { + arr = new string[](7); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + } + + function strings( + string memory v0, + string memory v1, + string memory v2, + string memory v3, + string memory v4, + string memory v5, + string memory v6, + string memory v7 + ) internal pure returns (string[] memory arr) { + arr = new string[](8); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + } + + function strings( + string memory v0, + string memory v1, + string memory v2, + string memory v3, + string memory v4, + string memory v5, + string memory v6, + string memory v7, + string memory v8 + ) internal pure returns (string[] memory arr) { + arr = new string[](9); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + } + + function strings( + string memory v0, + string memory v1, + string memory v2, + string memory v3, + string memory v4, + string memory v5, + string memory v6, + string memory v7, + string memory v8, + string memory v9 + ) internal pure returns (string[] memory arr) { + arr = new string[](10); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + } + + function strings( + string memory v0, + string memory v1, + string memory v2, + string memory v3, + string memory v4, + string memory v5, + string memory v6, + string memory v7, + string memory v8, + string memory v9, + string memory v10 + ) internal pure returns (string[] memory arr) { + arr = new string[](11); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + } + + function strings( + string memory v0, + string memory v1, + string memory v2, + string memory v3, + string memory v4, + string memory v5, + string memory v6, + string memory v7, + string memory v8, + string memory v9, + string memory v10, + string memory v11 + ) internal pure returns (string[] memory arr) { + arr = new string[](12); + arr[0] = v0; + arr[1] = v1; + arr[2] = v2; + arr[3] = v3; + arr[4] = v4; + arr[5] = v5; + arr[6] = v6; + arr[7] = v7; + arr[8] = v8; + arr[9] = v9; + arr[10] = v10; + arr[11] = v11; + } } diff --git a/test/types/BitMap.t.sol b/test/types/BitMap.t.sol index da86dfc..b047bef 100644 --- a/test/types/BitMap.t.sol +++ b/test/types/BitMap.t.sol @@ -5,112 +5,112 @@ import {Test} from "forge-std/Test.sol"; import {BitMap} from "src/types/BitMap.sol"; contract BitMapTest is Test { - function test_fuzz_set(BitMap bitmap, uint256 index) public pure { - bitmap = bitmap.set(index); - bool value = bitmap.get(index); - bool isTrue; - assembly ("memory-safe") { - isTrue := iszero(iszero(value)) - } - assertTrue(value); - assertTrue(isTrue); - } - - function test_fuzz_unset(BitMap bitmap, uint256 index) public pure { - bitmap = bitmap.unset(index); - bool value = bitmap.get(index); - bool isFalse; - assembly ("memory-safe") { - isFalse := iszero(value) - } - assertFalse(value); - assertTrue(isFalse); - } - - function test_fuzz_setTo(BitMap bitmap, uint256 index) public pure { - bool value = bitmap.get(index); - bitmap = bitmap.setTo(index, !value); - assertEq(bitmap.get(index), !value); - bitmap = bitmap.setTo(index, value); - assertEq(bitmap.get(index), value); - } - - function test_fuzz_toggle(BitMap bitmap, uint256 index) public pure { - bool value = bitmap.get(index); - bitmap = bitmap.toggle(index); - assertEq(bitmap.get(index), !value); - bitmap = bitmap.toggle(index); - assertEq(bitmap.get(index), value); - } - - function test_count() public pure { - unchecked { - for (uint256 i = 1; i < 256; ++i) { - assertEq(BitMap.wrap(uint256((1 << i) | 1)).count(), 2); - } - } - } - - function test_fuzz_count(BitMap bitmap) public pure { - uint256 c; - unchecked { - for (uint256 t = BitMap.unwrap(bitmap); t != 0; ++c) { - t &= t - 1; - } - } - assertEq(bitmap.count(), c); - } - - function test_findFirstSet_revertsWhenZero() public { - vm.expectRevert(); - BitMap.wrap(0).findFirstSet(); - } - - function test_findFirstSet_powersOfTwo() public pure { - for (uint256 i = 1; i < 256; ++i) { - assertEq(BitMap.wrap(1 << i).findFirstSet(), i); - } - } - - function test_fuzz_findFirstSet(BitMap bitmap) public pure { - vm.assume(!bitmap.isZero()); - assertEq(bitmap.findFirstSet(), leastSignificantBitReference(BitMap.unwrap(bitmap))); - } - - function test_findLastSet_revertsWhenZero() public { - vm.expectRevert(); - BitMap.wrap(0).findLastSet(); - } - - function test_findLastSet_powersOfTwo() public pure { - for (uint256 i = 1; i < 255; ++i) { - assertEq(BitMap.wrap(1 << i).findLastSet(), i); - } - } - - function test_fuzz_findLastSet(BitMap bitmap) public pure { - vm.assume(!bitmap.isZero()); - assertEq(bitmap.findLastSet(), mostSignificantBitReference(BitMap.unwrap(bitmap))); - } - - function test_isZero() public pure { - assertTrue(BitMap.wrap(0).isZero()); - assertFalse(BitMap.wrap(1).isZero()); - } - - function mostSignificantBitReference(uint256 x) private pure returns (uint256 i) { - unchecked { - while ((x >>= 1) > 0) { - ++i; - } - } - } - - function leastSignificantBitReference(uint256 x) private pure returns (uint256 i) { - unchecked { - while ((x >> i) & 1 == 0) { - ++i; - } - } - } + function test_fuzz_set(BitMap bitmap, uint256 index) public pure { + bitmap = bitmap.set(index); + bool value = bitmap.get(index); + bool isTrue; + assembly ("memory-safe") { + isTrue := iszero(iszero(value)) + } + assertTrue(value); + assertTrue(isTrue); + } + + function test_fuzz_unset(BitMap bitmap, uint256 index) public pure { + bitmap = bitmap.unset(index); + bool value = bitmap.get(index); + bool isFalse; + assembly ("memory-safe") { + isFalse := iszero(value) + } + assertFalse(value); + assertTrue(isFalse); + } + + function test_fuzz_setTo(BitMap bitmap, uint256 index) public pure { + bool value = bitmap.get(index); + bitmap = bitmap.setTo(index, !value); + assertEq(bitmap.get(index), !value); + bitmap = bitmap.setTo(index, value); + assertEq(bitmap.get(index), value); + } + + function test_fuzz_toggle(BitMap bitmap, uint256 index) public pure { + bool value = bitmap.get(index); + bitmap = bitmap.toggle(index); + assertEq(bitmap.get(index), !value); + bitmap = bitmap.toggle(index); + assertEq(bitmap.get(index), value); + } + + function test_count() public pure { + unchecked { + for (uint256 i = 1; i < 256; ++i) { + assertEq(BitMap.wrap(uint256((1 << i) | 1)).count(), 2); + } + } + } + + function test_fuzz_count(BitMap bitmap) public pure { + uint256 c; + unchecked { + for (uint256 t = BitMap.unwrap(bitmap); t != 0; ++c) { + t &= t - 1; + } + } + assertEq(bitmap.count(), c); + } + + function test_findFirstSet_revertsWhenZero() public { + vm.expectRevert(); + BitMap.wrap(0).findFirstSet(); + } + + function test_findFirstSet_powersOfTwo() public pure { + for (uint256 i = 1; i < 256; ++i) { + assertEq(BitMap.wrap(1 << i).findFirstSet(), i); + } + } + + function test_fuzz_findFirstSet(BitMap bitmap) public pure { + vm.assume(!bitmap.isZero()); + assertEq(bitmap.findFirstSet(), leastSignificantBitReference(BitMap.unwrap(bitmap))); + } + + function test_findLastSet_revertsWhenZero() public { + vm.expectRevert(); + BitMap.wrap(0).findLastSet(); + } + + function test_findLastSet_powersOfTwo() public pure { + for (uint256 i = 1; i < 255; ++i) { + assertEq(BitMap.wrap(1 << i).findLastSet(), i); + } + } + + function test_fuzz_findLastSet(BitMap bitmap) public pure { + vm.assume(!bitmap.isZero()); + assertEq(bitmap.findLastSet(), mostSignificantBitReference(BitMap.unwrap(bitmap))); + } + + function test_isZero() public pure { + assertTrue(BitMap.wrap(0).isZero()); + assertFalse(BitMap.wrap(1).isZero()); + } + + function mostSignificantBitReference(uint256 x) private pure returns (uint256 i) { + unchecked { + while ((x >>= 1) > 0) { + ++i; + } + } + } + + function leastSignificantBitReference(uint256 x) private pure returns (uint256 i) { + unchecked { + while ((x >> i) & 1 == 0) { + ++i; + } + } + } } diff --git a/test/types/FeedConfig.t.sol b/test/types/FeedConfig.t.sol index ea1df9b..2dd6461 100644 --- a/test/types/FeedConfig.t.sol +++ b/test/types/FeedConfig.t.sol @@ -5,18 +5,15 @@ import {Test} from "forge-std/Test.sol"; import {FeedConfig, toFeedConfig} from "src/types/FeedConfig.sol"; contract FeedConfigTest is Test { - function test_fuzz_toFeedConfig( - address feed, - uint8 baseId, - uint8 baseDecimals, - uint8 quoteId, - uint8 quoteDecimals - ) public pure { - FeedConfig config = toFeedConfig(feed, baseId, baseDecimals, quoteId, quoteDecimals); - assertEq(config.feed(), feed); - assertEq(config.baseId(), baseId); - assertEq(config.baseDecimals(), baseDecimals); - assertEq(config.quoteId(), quoteId); - assertEq(config.quoteDecimals(), quoteDecimals); - } + function test_fuzz_toFeedConfig(address feed, uint8 baseId, uint8 baseDecimals, uint8 quoteId, uint8 quoteDecimals) + public + pure + { + FeedConfig config = toFeedConfig(feed, baseId, baseDecimals, quoteId, quoteDecimals); + assertEq(config.feed(), feed); + assertEq(config.baseId(), baseId); + assertEq(config.baseDecimals(), baseDecimals); + assertEq(config.quoteId(), quoteId); + assertEq(config.quoteDecimals(), quoteDecimals); + } } From 2060b81e3073c8ccf916141daee482657f72350e Mon Sep 17 00:00:00 2001 From: Ryan Date: Thu, 30 Oct 2025 00:10:10 -0700 Subject: [PATCH 5/6] Updated prettier configuration --- .prettierrc.json | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.prettierrc.json b/.prettierrc.json index 4ce4ce3..a07ce5d 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -3,19 +3,12 @@ "tabWidth": 4, "useTabs": true, "singleQuote": false, + "bracketSpacing": true, "trailingComma": "all", "overrides": [ - { - "files": "*.sol", - "options": { - "bracketSpacing": false - } - }, { "files": ["*.ts", "*.js", "*.json"], - "options": { - "bracketSpacing": true - } + "options": {} } ] } From a1a871f2fb06f14c653ef87b6e58c1af8c2e8d37 Mon Sep 17 00:00:00 2001 From: Ryan Date: Thu, 30 Oct 2025 00:11:44 -0700 Subject: [PATCH 6/6] Removed format cmd from workflows --- .github/workflows/test.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ace0b64..76f1680 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,11 +33,6 @@ jobs: run: | forge --version - - name: Run Forge fmt - run: | - forge fmt --check - id: fmt - - name: Run Forge build run: | forge build --sizes