From f187114a8b74096b7d00a1aa16e0dff58cc4b16b Mon Sep 17 00:00:00 2001 From: Gleb Alekseev Date: Thu, 4 Apr 2024 19:25:57 -0300 Subject: [PATCH 1/2] doc engine upgrade to v0.6 --- hardhat.config.ts | 7 + package.json | 7 +- utils/contract.hbs | 69 ---- utils/docify.utils.js | 31 -- utils/templates/common.hbs | 38 +++ utils/templates/contract.hbs | 73 +++++ utils/templates/enum.hbs | 9 + utils/templates/error.hbs | 1 + utils/templates/event.hbs | 1 + utils/templates/function.hbs | 1 + utils/templates/helpers.js | 76 +++++ utils/templates/modifier.hbs | 1 + utils/templates/page.hbs | 7 + utils/templates/signature.hbs | 1 + utils/templates/struct.hbs | 9 + utils/templates/user-defined-value-type.hbs | 1 + utils/templates/variable.hbs | 1 + yarn.lock | 331 +++----------------- 18 files changed, 273 insertions(+), 391 deletions(-) delete mode 100644 utils/contract.hbs create mode 100644 utils/templates/common.hbs create mode 100644 utils/templates/contract.hbs create mode 100644 utils/templates/enum.hbs create mode 100644 utils/templates/error.hbs create mode 100644 utils/templates/event.hbs create mode 100644 utils/templates/function.hbs create mode 100644 utils/templates/helpers.js create mode 100644 utils/templates/modifier.hbs create mode 100644 utils/templates/page.hbs create mode 100644 utils/templates/signature.hbs create mode 100644 utils/templates/struct.hbs create mode 100644 utils/templates/user-defined-value-type.hbs create mode 100644 utils/templates/variable.hbs diff --git a/hardhat.config.ts b/hardhat.config.ts index 9ba44b2a..cd872ef2 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -4,6 +4,7 @@ import '@nomicfoundation/hardhat-chai-matchers'; import 'hardhat-gas-reporter'; import 'hardhat-deploy'; import '@nomicfoundation/hardhat-verify'; +import 'solidity-docgen'; require('solidity-coverage'); // require because no TS typings available import dotenv from 'dotenv'; import { HardhatUserConfig } from 'hardhat/config'; @@ -43,6 +44,12 @@ const config: HardhatUserConfig = { typechain: { target: 'ethers-v6', }, + docgen: { + outputDir: 'docs/contracts', + templates: 'utils/templates', + pages: 'files', + exclude: ['mocks', 'tests'], + }, }; export default config; diff --git a/package.json b/package.json index 4275d033..630f13d4 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,9 @@ "build": "yarn typechain && cti src hardhat-setup -b && tsc -p tsconfig.publish.json", "prepack": "yarn clean && yarn build", "coverage": "hardhat coverage", - "docify": "npx solidity-utils-docify && npx typedoc --options typedoc.json", + "docgen": "yarn hardhat docgen; npx solidity-utils-docify && npx typedoc --options typedoc.json", + "docgen:ts": "npx typedoc --options typedoc.json", + "docgen:sol": "yarn hardhat docgen; npx solidity-utils-docify", "format": "yarn format-ts && yarn format-sol", "format-ts": "prettier '**/*.ts' --write", "format-sol": "prettier '**/*.sol' --write", @@ -61,7 +63,6 @@ "acquit": "1.3.0", "commander": "12.0.0", "create-ts-index": "1.14.0", - "cross-spawn": "7.0.3", "eslint": "8.57.0", "eslint-config-standard": "17.1.0", "eslint-plugin-import": "2.29.1", @@ -74,7 +75,7 @@ "solc": "0.8.25", "solhint": "4.5.2", "solidity-coverage": "0.8.11", - "solidity-docgen": "0.5.17", + "solidity-docgen": "0.6.0-beta.36", "ts-node": "10.9.2", "typechain": "8.3.2", "typedoc": "0.25.12", diff --git a/utils/contract.hbs b/utils/contract.hbs deleted file mode 100644 index 523fffe0..00000000 --- a/utils/contract.hbs +++ /dev/null @@ -1,69 +0,0 @@ -# {{{name}}} - - -{{{natspec.title}}} -{{{natspec.userdoc}}} -{{{natspec.devdoc}}} - -{{#if (withoutFirstElement inheritance)}} -## Derives -{{/if}} -{{#each (withoutFirstElement inheritance)}} -{{#if (getRelativeDocPath name source.contractsDir source.solcOutput.sources)}} -- [{{name}}]({{getRelativeDocPath name source.contractsDir source.solcOutput.sources}}) -{{else}} -- {{name}} -{{/if}} -{{/each}} - -{{#if ownFunctions}} -## Functions -{{/if}} -{{#ownFunctions}} -### {{name}} -```solidity -function {{name}}( - {{#args}} - {{type}} {{name}}{{#if @last}}{{else}},{{/if}} - {{/args}} -) {{visibility}}{{#if outputs}} returns ({{outputs}}){{/if}} -``` -{{#if natspec.userdoc}}{{natspec.userdoc}}{{/if}} -{{#if natspec.devdoc}}{{natspec.devdoc}}{{/if}} -{{#if args}} -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -{{#args}} -|`{{name}}` | {{type}} | {{#with (lookup ../natspec.params @index)~}} {{ removeNewlines description }} {{/with}} -{{/args}}{{/if}} -{{#if natspec.returns}} -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -{{#natspec.returns}} -|`{{param}}`| {{#lookup ../outputs.types @index}}{{/lookup}} | {{{removeNewlines description}}} -{{/natspec.returns}}{{/if}} -{{/ownFunctions}} -{{#if ownEvents}} -## Events -{{/if}} -{{#ownEvents}} -### {{name}} -```solidity -event {{name}}( - {{#args}} - {{type}} {{name}}{{#if @last}}{{else}},{{/if}} - {{/args}} -) -``` -{{#if natspec.userdoc}}{{natspec.userdoc}}{{/if}} -{{#if natspec.devdoc}}{{natspec.devdoc}}{{/if}} -{{#if args}} -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -{{#args}} -|`{{name}}` | {{type}} | {{#with (lookup ../natspec.params @index)~}} {{ removeNewlines description }} {{/with}} -{{/args}}{{/if}} -{{/ownEvents}} diff --git a/utils/docify.utils.js b/utils/docify.utils.js index 98edfde1..b21fa17e 100755 --- a/utils/docify.utils.js +++ b/utils/docify.utils.js @@ -1,27 +1,14 @@ #!/usr/bin/env node -const SOLC_NPM_NAME = 'solc'; const BASE_DIR = 'docs'; -const SCRIPT_DIR = __dirname; -const INPUT_DIR = 'contracts'; const OUTPUT_DIR = process.env.DOCGEN_OUTPUT_DIR || `${BASE_DIR}/contracts`; -const HELPERS_PATH = `${SCRIPT_DIR}/solidity-docgen-helpers.js`; const fs = require('fs'); const path = require('path'); -const spawn = require('cross-spawn'); function getFileNameWithoutExtension (fileName) { return fileName.substr(0, fileName.lastIndexOf('.')); } -function runProcess (name, args) { - console.log(`running ${name} with args ${JSON.stringify(args)}`); - const result = spawn.sync(name, args, { stdio: ['inherit', 'inherit', 'pipe'] }); - if (result.stderr.length > 0) { - throw new Error(result.stderr); - } -} - function getReadmes (targetPath) { let result = []; const readmePath = path.join(targetPath, 'README.md'); @@ -108,23 +95,5 @@ function removeUnwantedDocs () { } } -const solidityDocgenArgs = [ - 'solidity-docgen', - '-i', - INPUT_DIR, - '-o', - OUTPUT_DIR, - '--solc-module', - SOLC_NPM_NAME, - '--solc-settings', - JSON.stringify({ optimizer: { enabled: false } }), - '--templates', - SCRIPT_DIR, - '--helpers', - HELPERS_PATH, -]; - -fs.rmSync(OUTPUT_DIR, { force: true, recursive: true }); -runProcess('npx', solidityDocgenArgs); generateGitbookFiles(); removeUnwantedDocs(); diff --git a/utils/templates/common.hbs b/utils/templates/common.hbs new file mode 100644 index 00000000..67c478eb --- /dev/null +++ b/utils/templates/common.hbs @@ -0,0 +1,38 @@ +{{h}} {{name}} + +{{#if signature}} +```solidity +{{{signature}}} +``` +{{/if}} +{{{natspec.notice}}} + +{{#if natspec.dev}} +_{{{natspec.dev}}}_ +{{/if}} + +{{#if params}} +{{#if (arrayHasDescriptions params)}} +{{h 2}} Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +{{#each params}} +| {{name}} | {{type}} | {{{joinLines natspec}}} | +{{/each}} +{{/if}} +{{/if}} + +{{#if returns}} +{{#if (arrayHasDescriptions returns)}} + +{{h 2}} Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +{{#each returns}} +{{#if name}}{{name}}{{else}}[{{@index}}]{{/if}} | {{type}} | {{{joinLines natspec}}} | +{{/each}} +{{/if}} +{{/if}} + diff --git a/utils/templates/contract.hbs b/utils/templates/contract.hbs new file mode 100644 index 00000000..08d8570f --- /dev/null +++ b/utils/templates/contract.hbs @@ -0,0 +1,73 @@ +{{>common}} + +{{#if types}} +{{h 2}} Types list +{{#each types}} +- [{{name}}](#{{lower name}}) +{{/each}} +{{/if}} + +{{#if functions}} +{{h 2}} Functions list +{{#each functions}} +{{>signature}} +{{/each}} +{{/if}} + +{{#if events}} +{{h 2}} Events list +{{#each events}} +{{>signature}} +{{/each}} +{{/if}} + +{{#if errors}} +{{h 2}} Errors list +{{#each errors}} +{{>signature}} +{{/each}} +{{/if}} + +{{#if types}} +{{h 2}} Types +{{#hsection}} +{{#each types}} +{{>item}} +{{/each}} +{{/hsection}} +{{/if}} + +{{#if functions}} +{{h 2}} Functions +{{#hsection}} +{{#each functions}} +{{>function}} +{{/each}} +{{/hsection}} +{{/if}} + +{{#if events}} +{{h 2}} Events +{{#hsection}} +{{#each events}} +{{>common}} +{{/each}} +{{/hsection}} +{{/if}} + +{{#if errors}} +{{h 2}} Errors +{{#hsection}} +{{#each errors}} +{{>common}} +{{/each}} +{{/hsection}} +{{/if}} + +{{!-- +{{#each items}} +{{#hsection}} +{{>item}} +{{/hsection}} +{{/each}} +--}} diff --git a/utils/templates/enum.hbs b/utils/templates/enum.hbs new file mode 100644 index 00000000..677406db --- /dev/null +++ b/utils/templates/enum.hbs @@ -0,0 +1,9 @@ +{{>common}} + +```solidity +enum {{name}} { +{{#each members}} + {{name}}{{#unless @last}},{{/unless}} +{{/each}} +} +``` diff --git a/utils/templates/error.hbs b/utils/templates/error.hbs new file mode 100644 index 00000000..5373296c --- /dev/null +++ b/utils/templates/error.hbs @@ -0,0 +1 @@ +{{>common}} diff --git a/utils/templates/event.hbs b/utils/templates/event.hbs new file mode 100644 index 00000000..5373296c --- /dev/null +++ b/utils/templates/event.hbs @@ -0,0 +1 @@ +{{>common}} diff --git a/utils/templates/function.hbs b/utils/templates/function.hbs new file mode 100644 index 00000000..5373296c --- /dev/null +++ b/utils/templates/function.hbs @@ -0,0 +1 @@ +{{>common}} diff --git a/utils/templates/helpers.js b/utils/templates/helpers.js new file mode 100644 index 00000000..078b957a --- /dev/null +++ b/utils/templates/helpers.js @@ -0,0 +1,76 @@ +exports.lower = lower; +exports.isContract = isContract; +exports.getFunctionsToDisplay = getFunctionsToDisplay; +exports.findContractById = findContractById; +exports.arrayHasDescriptions = arrayHasDescriptions; +// exports + +function lower (text) { + if (typeof text === 'string') { + return text.toLowerCase(); + } +} + +function isContract(item){ + return item != undefined && item.nodeType === 'ContractDefinition'; +} + +function arrayHasDescriptions(items){ + if (items != undefined){ + return items.map(item => item.natspec).filter(natspec => natspec !== undefined).length > 0; + } + return false; +} + +function getFunctionsToDisplay (baseContractIds, allContracts){ + const resultMap = []; + if (baseContractIds.length > 0){ + primaryContractFns = getContractFunctions(baseContractIds[0], allContracts); + primaryContractFns.map(fn => resultMap.push({id: baseContractIds[0], fnId: fn.id, selector: fn.functionSelector, name: fn.name})); + + for(let i=1; i < baseContractIds.length; i++) { + const baseContractId = baseContractIds[i]; + const functions = getContractFunctions(baseContractId, allContracts); + + const newFn = functions.filter(fn => { + //console.log(fn); + //console.log(baseContractId, fn.id, fn.name, fn.functionSelector); + const exclude = fn.kind === 'constructor' && !(fn.visibility === 'public' || fn.visibility === 'external'); + const include = resultMap.find(item => item.selector === fn.functionSelector); + return !exclude && !include; + }); + + newFn.map(fn => resultMap.push({id: fn.scope, fnId: fn.id, selector: fn.functionSelector, name: fn.name})); + } + } + + resultArray = Object.values(resultMap.reduce((acc, item) => { + if (!acc[item.id]) { + acc[item.id] = { + id: item.id, + functions: [] + }; + } + acc[item.id].functions.push({ + fnId: item.fnId, + selector: item.selector, + name: item.name + }); + return acc; + }, {})); + + //console.log(resultArray); + + return resultArray; +} + +function findContractById (id, allContracts) { + return allContracts.find(contract => contract.id === id); +} + +// helpers + +getContractFunctions = (id, allContracts) => { + const contract = findContractById(id, allContracts); + return contract ? contract.functions : []; +} \ No newline at end of file diff --git a/utils/templates/modifier.hbs b/utils/templates/modifier.hbs new file mode 100644 index 00000000..5373296c --- /dev/null +++ b/utils/templates/modifier.hbs @@ -0,0 +1 @@ +{{>common}} diff --git a/utils/templates/page.hbs b/utils/templates/page.hbs new file mode 100644 index 00000000..6a2f4caf --- /dev/null +++ b/utils/templates/page.hbs @@ -0,0 +1,7 @@ +{{#each items}} + +{{#hsection}} +{{>item}} +{{/hsection}} + +{{/each}} diff --git a/utils/templates/signature.hbs b/utils/templates/signature.hbs new file mode 100644 index 00000000..e9970401 --- /dev/null +++ b/utils/templates/signature.hbs @@ -0,0 +1 @@ +- [{{name}}({{#each parameters.parameters}}{{name}}{{#unless @last}}, {{/unless}}{{/each}}) {{visibility}}](#{{lower name}}) diff --git a/utils/templates/struct.hbs b/utils/templates/struct.hbs new file mode 100644 index 00000000..867069e2 --- /dev/null +++ b/utils/templates/struct.hbs @@ -0,0 +1,9 @@ +{{>common}} + +```solidity +struct {{name}} { +{{#each members}} + {{{typeName.typeDescriptions.typeString}}} {{name}}; +{{/each}} +} +``` diff --git a/utils/templates/user-defined-value-type.hbs b/utils/templates/user-defined-value-type.hbs new file mode 100644 index 00000000..5373296c --- /dev/null +++ b/utils/templates/user-defined-value-type.hbs @@ -0,0 +1 @@ +{{>common}} diff --git a/utils/templates/variable.hbs b/utils/templates/variable.hbs new file mode 100644 index 00000000..5373296c --- /dev/null +++ b/utils/templates/variable.hbs @@ -0,0 +1 @@ +{{>common}} diff --git a/yarn.lock b/yarn.lock index bc12657a..88e0e97e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1182,124 +1182,6 @@ "@nomicfoundation/solidity-analyzer-win32-ia32-msvc" "0.1.1" "@nomicfoundation/solidity-analyzer-win32-x64-msvc" "0.1.1" -"@oclif/command@^1.8.0": - version "1.8.36" - resolved "https://registry.yarnpkg.com/@oclif/command/-/command-1.8.36.tgz#9739b9c268580d064a50887c4597d1b4e86ca8b5" - integrity sha512-/zACSgaYGtAQRzc7HjzrlIs14FuEYAZrMOEwicRoUnZVyRunG4+t5iSEeQu0Xy2bgbCD0U1SP/EdeNZSTXRwjQ== - dependencies: - "@oclif/config" "^1.18.2" - "@oclif/errors" "^1.3.6" - "@oclif/help" "^1.0.1" - "@oclif/parser" "^3.8.17" - debug "^4.1.1" - semver "^7.5.4" - -"@oclif/config@1.18.16": - version "1.18.16" - resolved "https://registry.yarnpkg.com/@oclif/config/-/config-1.18.16.tgz#3235d260ab1eb8388ebb6255bca3dd956249d796" - integrity sha512-VskIxVcN22qJzxRUq+raalq6Q3HUde7sokB7/xk5TqRZGEKRVbFeqdQBxDWwQeudiJEgcNiMvIFbMQ43dY37FA== - dependencies: - "@oclif/errors" "^1.3.6" - "@oclif/parser" "^3.8.16" - debug "^4.3.4" - globby "^11.1.0" - is-wsl "^2.1.1" - tslib "^2.6.1" - -"@oclif/config@^1.17.0", "@oclif/config@^1.18.2": - version "1.18.17" - resolved "https://registry.yarnpkg.com/@oclif/config/-/config-1.18.17.tgz#00aa4049da27edca8f06fc106832d9f0f38786a5" - integrity sha512-k77qyeUvjU8qAJ3XK3fr/QVAqsZO8QOBuESnfeM5HHtPNLSyfVcwiMM2zveSW5xRdLSG3MfV8QnLVkuyCL2ENg== - dependencies: - "@oclif/errors" "^1.3.6" - "@oclif/parser" "^3.8.17" - debug "^4.3.4" - globby "^11.1.0" - is-wsl "^2.1.1" - tslib "^2.6.1" - -"@oclif/core@^2.15.0": - version "2.15.0" - resolved "https://registry.yarnpkg.com/@oclif/core/-/core-2.15.0.tgz#f27797b30a77d13279fba88c1698fc34a0bd0d2a" - integrity sha512-fNEMG5DzJHhYmI3MgpByTvltBOMyFcnRIUMxbiz2ai8rhaYgaTHMG3Q38HcosfIvtw9nCjxpcQtC8MN8QtVCcA== - dependencies: - "@types/cli-progress" "^3.11.0" - ansi-escapes "^4.3.2" - ansi-styles "^4.3.0" - cardinal "^2.1.1" - chalk "^4.1.2" - clean-stack "^3.0.1" - cli-progress "^3.12.0" - debug "^4.3.4" - ejs "^3.1.8" - get-package-type "^0.1.0" - globby "^11.1.0" - hyperlinker "^1.0.0" - indent-string "^4.0.0" - is-wsl "^2.2.0" - js-yaml "^3.14.1" - natural-orderby "^2.0.3" - object-treeify "^1.1.33" - password-prompt "^1.1.2" - slice-ansi "^4.0.0" - string-width "^4.2.3" - strip-ansi "^6.0.1" - supports-color "^8.1.1" - supports-hyperlinks "^2.2.0" - ts-node "^10.9.1" - tslib "^2.5.0" - widest-line "^3.1.0" - wordwrap "^1.0.0" - wrap-ansi "^7.0.0" - -"@oclif/errors@1.3.6", "@oclif/errors@^1.3.3", "@oclif/errors@^1.3.6": - version "1.3.6" - resolved "https://registry.yarnpkg.com/@oclif/errors/-/errors-1.3.6.tgz#e8fe1fc12346cb77c4f274e26891964f5175f75d" - integrity sha512-fYaU4aDceETd89KXP+3cLyg9EHZsLD3RxF2IU9yxahhBpspWjkWi3Dy3bTgcwZ3V47BgxQaGapzJWDM33XIVDQ== - dependencies: - clean-stack "^3.0.0" - fs-extra "^8.1" - indent-string "^4.0.0" - strip-ansi "^6.0.1" - wrap-ansi "^7.0.0" - -"@oclif/help@^1.0.1": - version "1.0.15" - resolved "https://registry.yarnpkg.com/@oclif/help/-/help-1.0.15.tgz#5e36e576b8132a4906d2662204ad9de7ece87e8f" - integrity sha512-Yt8UHoetk/XqohYX76DfdrUYLsPKMc5pgkzsZVHDyBSkLiGRzujVaGZdjr32ckVZU9q3a47IjhWxhip7Dz5W/g== - dependencies: - "@oclif/config" "1.18.16" - "@oclif/errors" "1.3.6" - chalk "^4.1.2" - indent-string "^4.0.0" - lodash "^4.17.21" - string-width "^4.2.0" - strip-ansi "^6.0.0" - widest-line "^3.1.0" - wrap-ansi "^6.2.0" - -"@oclif/linewrap@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@oclif/linewrap/-/linewrap-1.0.0.tgz#aedcb64b479d4db7be24196384897b5000901d91" - integrity sha512-Ups2dShK52xXa8w6iBWLgcjPJWjais6KPJQq3gQ/88AY6BXoTX+MIGFPrWQO1KLMiQfoTpcLnUwloN4brrVUHw== - -"@oclif/parser@^3.8.16", "@oclif/parser@^3.8.17": - version "3.8.17" - resolved "https://registry.yarnpkg.com/@oclif/parser/-/parser-3.8.17.tgz#e1ce0f29b22762d752d9da1c7abd57ad81c56188" - integrity sha512-l04iSd0xoh/16TGVpXb81Gg3z7tlQGrEup16BrVLsZBK6SEYpYHRJZnM32BwZrHI97ZSFfuSwVlzoo6HdsaK8A== - dependencies: - "@oclif/errors" "^1.3.6" - "@oclif/linewrap" "^1.0.0" - chalk "^4.1.0" - tslib "^2.6.2" - -"@oclif/plugin-help@^5.0.0": - version "5.2.20" - resolved "https://registry.yarnpkg.com/@oclif/plugin-help/-/plugin-help-5.2.20.tgz#4035a0ac231f95fb8e334da342175e3ca00f6abc" - integrity sha512-u+GXX/KAGL9S10LxAwNUaWdzbEBARJ92ogmM7g3gDVud2HioCmvWQCDohNRVZ9GYV9oKwZ/M8xwd6a1d95rEKQ== - dependencies: - "@oclif/core" "^2.15.0" - "@openzeppelin/contracts@5.0.2": version "5.0.2" resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-5.0.2.tgz#b1d03075e49290d06570b2fd42154d76c2a5d210" @@ -1550,13 +1432,6 @@ resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.14.tgz#ae3055ea2be43c91c9fd700a36d67820026d96e6" integrity sha512-Wj71sXE4Q4AkGdG9Tvq1u/fquNz9EdG4LIJMwVVII7ashjD/8cf8fyIfJAjRr6YcsXnSE8cOGQPq1gqeR8z+3w== -"@types/cli-progress@^3.11.0": - version "3.11.5" - resolved "https://registry.yarnpkg.com/@types/cli-progress/-/cli-progress-3.11.5.tgz#9518c745e78557efda057e3f96a5990c717268c3" - integrity sha512-D4PbNRbviKyppS5ivBGyFO29POlySLmA2HyUFE4p5QGazAMM3CwkKWcvTl8gvElSuxRh6FPKL8XmidX873ou4g== - dependencies: - "@types/node" "*" - "@types/debug@^4.1.7": version "4.1.12" resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.12.tgz#a155f21690871953410df4b6b6f53187f0500917" @@ -1907,7 +1782,7 @@ ansi-colors@^4.1.1: resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b" integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw== -ansi-escapes@^4.3.0, ansi-escapes@^4.3.2: +ansi-escapes@^4.3.0: version "4.3.2" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== @@ -1936,7 +1811,7 @@ ansi-styles@^3.2.1: dependencies: color-convert "^1.9.0" -ansi-styles@^4.0.0, ansi-styles@^4.1.0, ansi-styles@^4.3.0: +ansi-styles@^4.0.0, ansi-styles@^4.1.0: version "4.3.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== @@ -1953,11 +1828,6 @@ ansi-styles@^6.1.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== -ansicolors@~0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/ansicolors/-/ansicolors-0.3.2.tgz#665597de86a9ffe3aa9bfbe6cae5c6ea426b4979" - integrity sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg== - antlr4@^4.13.1-patch-1: version "4.13.1-patch-1" resolved "https://registry.yarnpkg.com/antlr4/-/antlr4-4.13.1-patch-1.tgz#946176f863f890964a050c4f18c47fd6f7e57602" @@ -2023,6 +1893,18 @@ array-union@^2.1.0: resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== +array.prototype.findlast@^1.2.2: + version "1.2.5" + resolved "https://registry.yarnpkg.com/array.prototype.findlast/-/array.prototype.findlast-1.2.5.tgz#3e4fbcb30a15a7f5bf64cf2faae22d139c2e4904" + integrity sha512-CVvd6FHg1Z3POpBLxO6E6zr+rSKEQ9L6rZHAaY7lLfhKsWYUBBOuMs0e9o24oopj6H+geRCX0YJ+TJLBK2eHyQ== + dependencies: + call-bind "^1.0.7" + define-properties "^1.2.1" + es-abstract "^1.23.2" + es-errors "^1.3.0" + es-object-atoms "^1.0.0" + es-shim-unscopables "^1.0.2" + array.prototype.findlastindex@^1.2.3: version "1.2.5" resolved "https://registry.yarnpkg.com/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.5.tgz#8c35a755c72908719453f87145ca011e39334d0d" @@ -2089,11 +1971,6 @@ async@1.x: resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" integrity sha512-nSVgobk4rv61R9PUSDtYt7mPVB2olxNR5RWJcAsH676/ef11bUZwvu7+RGYrYauVdDPcO519v68wRhXQtxsV9w== -async@^3.2.3: - version "3.2.5" - resolved "https://registry.yarnpkg.com/async/-/async-3.2.5.tgz#ebd52a8fdaf7a2289a24df399f8d8485c8a46b66" - integrity sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg== - asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" @@ -2365,14 +2242,6 @@ caniuse-lite@^1.0.30001587: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001605.tgz#ca12d7330dd8bcb784557eb9aa64f0037870d9d6" integrity sha512-nXwGlFWo34uliI9z3n6Qc0wZaf7zaZWA1CPZ169La5mV3I/gem7bst0vr5XQH5TJXZIMfDeZyOrZnSlVzKxxHQ== -cardinal@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/cardinal/-/cardinal-2.1.1.tgz#7cc1055d822d212954d07b085dea251cc7bc5505" - integrity sha512-JSr5eOgoEymtYHBjNWyjrMqet9Am2miJhlfKNdqLp6zoeAh0KN5dRAcxlecj5mAJrmQomgiOBj35xHLrFjqBpw== - dependencies: - ansicolors "~0.3.2" - redeyed "~2.1.0" - cbor@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/cbor/-/cbor-8.1.0.tgz#cfc56437e770b73417a2ecbfc9caf6b771af60d5" @@ -2400,7 +2269,7 @@ chai@4.4.0: pathval "^1.1.1" type-detect "^4.0.8" -chalk@4.1.2, chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0, chalk@^4.1.2: +chalk@4.1.2, chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== @@ -2482,25 +2351,11 @@ clean-stack@^2.0.0: resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A== -clean-stack@^3.0.0, clean-stack@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-3.0.1.tgz#155bf0b2221bf5f4fba89528d24c5953f17fe3a8" - integrity sha512-lR9wNiMRcVQjSB3a7xXGLuz4cr4wJuuXlaAEbRutGowQTmlp7R72/DOgN21e8jdwblMWl9UOJMJXarX94pzKdg== - dependencies: - escape-string-regexp "4.0.0" - cli-boxes@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-2.2.1.tgz#ddd5035d25094fce220e9cab40a45840a440318f" integrity sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw== -cli-progress@^3.12.0: - version "3.12.0" - resolved "https://registry.yarnpkg.com/cli-progress/-/cli-progress-3.12.0.tgz#807ee14b66bcc086258e444ad0f19e7d42577942" - integrity sha512-tRkV3HJ1ASwm19THiiLIXLO7Im7wlTuKnvkYaTkyoAPefqjNg7W7DHKUlGRxy9vxDvbyCYQkQozvptuMkGCg8A== - dependencies: - string-width "^4.2.3" - cli-table3@^0.6.3: version "0.6.4" resolved "https://registry.yarnpkg.com/cli-table3/-/cli-table3-0.6.4.tgz#d1c536b8a3f2e7bec58f67ac9e5769b1b30088b0" @@ -2699,7 +2554,7 @@ create-ts-index@1.14.0: tslib "^2.3.1" yargs "^17.3.0" -cross-spawn@7.0.3, cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: +cross-spawn@^7.0.0, cross-spawn@^7.0.2: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -2884,13 +2739,6 @@ eastasianwidth@^0.2.0: resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== -ejs@^3.1.8: - version "3.1.9" - resolved "https://registry.yarnpkg.com/ejs/-/ejs-3.1.9.tgz#03c9e8777fe12686a9effcef22303ca3d8eeb361" - integrity sha512-rC+QVNMJWv+MtPgkt0y+0rVEIdbtxVADApW9JXrUVlzHetgcyczP/E7DJmWJ4fJCZF2cPcBk0laWO9ZHMG3DmQ== - dependencies: - jake "^10.8.5" - electron-to-chromium@^1.4.668: version "1.4.723" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.723.tgz#827da30c96b316684d352c3d81430029df01bb8e" @@ -3238,7 +3086,7 @@ esprima@2.7.x, esprima@^2.7.1: resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" integrity sha512-OarPfz0lFCiW4/AV2Oy1Rp9qu0iusTKqykwTspGCZtPxmF81JR4MmIebvF1F9+UOKth2ZubLQ4XGGaU+hSn99A== -esprima@4.0.1, esprima@^4.0.0, esprima@~4.0.0: +esprima@4.0.1, esprima@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== @@ -3488,13 +3336,6 @@ file-entry-cache@^6.0.1: dependencies: flat-cache "^3.0.4" -filelist@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/filelist/-/filelist-1.0.4.tgz#f78978a1e944775ff9e62e744424f215e58352b5" - integrity sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q== - dependencies: - minimatch "^5.0.1" - fill-range@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" @@ -3641,7 +3482,7 @@ fs-extra@^7.0.0, fs-extra@^7.0.1: jsonfile "^4.0.0" universalify "^0.1.0" -fs-extra@^8.1, fs-extra@^8.1.0: +fs-extra@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== @@ -3882,7 +3723,7 @@ globby@^10.0.1: merge2 "^1.2.3" slash "^3.0.0" -globby@^11.0.0, globby@^11.1.0: +globby@^11.1.0: version "11.1.0" resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== @@ -3933,7 +3774,7 @@ graphemer@^1.4.0: resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== -handlebars@^4.0.1, handlebars@^4.7.6, handlebars@^4.7.7: +handlebars@^4.0.1, handlebars@^4.7.7: version "4.7.8" resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.8.tgz#41c42c18b1be2365439188c77c6afae71c0cd9e9" integrity sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ== @@ -4163,11 +4004,6 @@ https-proxy-agent@^5.0.0: agent-base "6" debug "4" -hyperlinker@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/hyperlinker/-/hyperlinker-1.0.0.tgz#23dc9e38a206b208ee49bc2d6c8ef47027df0c0e" - integrity sha512-Ty8UblRWFEcfSuIaajM34LdPXIhbs1ajEX/BBPv24J+enSVaEVY63xQ6lTO9VRYS5LAoghIG0IDJ+p+IPzKUQQ== - iconv-lite@0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" @@ -4315,11 +4151,6 @@ is-date-object@^1.0.1: dependencies: has-tostringtag "^1.0.0" -is-docker@^2.0.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa" - integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ== - is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" @@ -4417,13 +4248,6 @@ is-weakref@^1.0.2: dependencies: call-bind "^1.0.2" -is-wsl@^2.1.1, is-wsl@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" - integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== - dependencies: - is-docker "^2.0.0" - isarray@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" @@ -4464,16 +4288,6 @@ jackspeak@^2.3.6: optionalDependencies: "@pkgjs/parseargs" "^0.11.0" -jake@^10.8.5: - version "10.8.7" - resolved "https://registry.yarnpkg.com/jake/-/jake-10.8.7.tgz#63a32821177940c33f356e0ba44ff9d34e1c7d8f" - integrity sha512-ZDi3aP+fG/LchyBzUM804VjddnwfSfsdeYkwt8NcbKRvo4rFkjhs456iLFn3k2ZUWvNe4i48WACDbza8fhq2+w== - dependencies: - async "^3.2.3" - chalk "^4.0.2" - filelist "^1.0.4" - minimatch "^3.1.2" - jest-diff@^28.1.3: version "28.1.3" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-28.1.3.tgz#948a192d86f4e7a64c5264ad4da4877133d8792f" @@ -4598,7 +4412,7 @@ js-tokens@^4.0.0: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@3.x, js-yaml@^3.13.1, js-yaml@^3.14.1: +js-yaml@3.x, js-yaml@^3.13.1: version "3.14.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== @@ -4650,7 +4464,7 @@ json5@^1.0.2: dependencies: minimist "^1.2.0" -json5@^2.1.3, json5@^2.2.0, json5@^2.2.3: +json5@^2.2.0, json5@^2.2.3: version "2.2.3" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== @@ -4908,7 +4722,7 @@ micro-ftch@^0.3.1: resolved "https://registry.yarnpkg.com/micro-ftch/-/micro-ftch-0.3.1.tgz#6cb83388de4c1f279a034fb0cf96dfc050853c5f" integrity sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg== -micromatch@^4.0.2, micromatch@^4.0.4: +micromatch@^4.0.4: version "4.0.5" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== @@ -4969,7 +4783,7 @@ minimatch@9.0.3: dependencies: brace-expansion "^2.0.1" -minimatch@^5.0.0, minimatch@^5.0.1: +minimatch@^5.0.1: version "5.1.6" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== @@ -5083,11 +4897,6 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== -natural-orderby@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/natural-orderby/-/natural-orderby-2.0.3.tgz#8623bc518ba162f8ff1cdb8941d74deb0fdcc016" - integrity sha512-p7KTHxU0CUrcOXe62Zfrb5Z13nLvPhSWR/so3kFulUQU0sgUll2Z0LwpsLN351eOOD+hRGu/F1g+6xDfPeD++Q== - neo-async@^2.6.2: version "2.6.2" resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" @@ -5167,11 +4976,6 @@ object-keys@^1.1.1: resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== -object-treeify@^1.1.33: - version "1.1.33" - resolved "https://registry.yarnpkg.com/object-treeify/-/object-treeify-1.1.33.tgz#f06fece986830a3cba78ddd32d4c11d1f76cdf40" - integrity sha512-EFVjAYfzWqWsBMRHPMAXLCDIJnpMhdWAqR7xG6M6a2cs6PMFpl/+Z20w9zDW4vkxOFfddegBKq9Rehd0bxWE7A== - object.assign@^4.1.5: version "4.1.5" resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.5.tgz#3a833f9ab7fdb80fc9e8d2300c803d216d8fdbb0" @@ -5347,14 +5151,6 @@ parse-json@^5.2.0: json-parse-even-better-errors "^2.3.0" lines-and-columns "^1.1.6" -password-prompt@^1.1.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/password-prompt/-/password-prompt-1.1.3.tgz#05e539f4e7ca4d6c865d479313f10eb9db63ee5f" - integrity sha512-HkrjG2aJlvF0t2BMH0e2LB/EHf3Lcq3fNMzy4GYHcQblAvOl+QQji1Lx7WRBMqpVK8p+KR7bCg7oqAMXtdgqyw== - dependencies: - ansi-escapes "^4.3.2" - cross-spawn "^7.0.3" - path-exists@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" @@ -5577,13 +5373,6 @@ recursive-readdir@^2.2.2: dependencies: minimatch "^3.0.5" -redeyed@~2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/redeyed/-/redeyed-2.1.1.tgz#8984b5815d99cb220469c99eeeffe38913e6cc0b" - integrity sha512-FNpGGo1DycYAdnrKFxCMmKYgo/mILAqtRYbkdQD8Ep/Hk2PQ5+aEAEx+IU713RTDmuBaH0c8P5ZozurNu5ObRQ== - dependencies: - esprima "~4.0.0" - reduce-flatten@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/reduce-flatten/-/reduce-flatten-2.0.0.tgz#734fd84e65f375d7ca4465c69798c25c9d10ae27" @@ -5797,7 +5586,7 @@ semver@^6.3.0, semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.0.0, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.5.2, semver@^7.5.3, semver@^7.5.4: +semver@^7.0.0, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.5.2, semver@^7.5.3, semver@^7.5.4: version "7.6.0" resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d" integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg== @@ -5952,20 +5741,6 @@ solc@0.8.25: semver "^5.5.0" tmp "0.0.33" -solc@^0.6.7: - version "0.6.12" - resolved "https://registry.yarnpkg.com/solc/-/solc-0.6.12.tgz#48ac854e0c729361b22a7483645077f58cba080e" - integrity sha512-Lm0Ql2G9Qc7yPP2Ba+WNmzw2jwsrd3u4PobHYlSOxaut3TtUbj9+5ZrT6f4DUpNPEoBaFUOEg9Op9C0mk7ge9g== - dependencies: - command-exists "^1.2.8" - commander "3.0.2" - fs-extra "^0.30.0" - js-sha3 "0.8.0" - memorystream "^0.3.1" - require-from-string "^2.0.0" - semver "^5.5.0" - tmp "0.0.33" - solhint@4.5.2: version "4.5.2" resolved "https://registry.yarnpkg.com/solhint/-/solhint-4.5.2.tgz#a3fa101366dd1fb37009d24a9f16c99a4a745b5d" @@ -5992,6 +5767,13 @@ solhint@4.5.2: optionalDependencies: prettier "^2.8.3" +solidity-ast@^0.4.38: + version "0.4.56" + resolved "https://registry.yarnpkg.com/solidity-ast/-/solidity-ast-0.4.56.tgz#94fe296f12e8de1a3bed319bc06db8d05a113d7a" + integrity sha512-HgmsA/Gfklm/M8GFbCX/J1qkVH0spXHgALCNZ8fA8x5X+MFdn/8CP2gr5OVyXjXw6RZTPC/Sxl2RUDQOXyNMeA== + dependencies: + array.prototype.findlast "^1.2.2" + solidity-comments-extractor@^0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/solidity-comments-extractor/-/solidity-comments-extractor-0.0.8.tgz#f6e148ab0c49f30c1abcbecb8b8df01ed8e879f8" @@ -6022,23 +5804,13 @@ solidity-coverage@0.8.11: shelljs "^0.8.3" web3-utils "^1.3.6" -solidity-docgen@0.5.17: - version "0.5.17" - resolved "https://registry.yarnpkg.com/solidity-docgen/-/solidity-docgen-0.5.17.tgz#3b0ab450afc2cd4d29cea895e05e50a07d43fbfc" - integrity sha512-RX5SPLFL9z0ZVBcZ/o5l/TKXMgSjNhWdumLuuv+Dy1O/66sThpHYd0HVpzdwAjVff0Ajk76bYM2zZYiMnqBfng== - dependencies: - "@oclif/command" "^1.8.0" - "@oclif/config" "^1.17.0" - "@oclif/errors" "^1.3.3" - "@oclif/plugin-help" "^5.0.0" - globby "^11.0.0" - handlebars "^4.7.6" - json5 "^2.1.3" - lodash "^4.17.15" - micromatch "^4.0.2" - minimatch "^5.0.0" - semver "^7.3.2" - solc "^0.6.7" +solidity-docgen@0.6.0-beta.36: + version "0.6.0-beta.36" + resolved "https://registry.yarnpkg.com/solidity-docgen/-/solidity-docgen-0.6.0-beta.36.tgz#9c76eda58580fb52e2db318c22fe3154e0c09dd1" + integrity sha512-f/I5G2iJgU1h0XrrjRD0hHMr7C10u276vYvm//rw1TzFcYQ4xTOyAoi9oNAHRU0JU4mY9eTuxdVc2zahdMuhaQ== + dependencies: + handlebars "^4.7.7" + solidity-ast "^0.4.38" source-map-support@^0.5.13: version "0.5.21" @@ -6183,7 +5955,7 @@ superstruct@^1.0.3: resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-1.0.4.tgz#0adb99a7578bd2f1c526220da6571b2d485d91ca" integrity sha512-7JpaAoX2NGyoFlI9NBh66BQXGONc+uE+MRS5i2iOBKuS4e+ccgMDjATgZldkah+33DakBxDHiss9kvUcGAO8UQ== -supports-color@8.1.1, supports-color@^8.0.0, supports-color@^8.1.1: +supports-color@8.1.1, supports-color@^8.0.0: version "8.1.1" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== @@ -6204,21 +5976,13 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" -supports-color@^7.0.0, supports-color@^7.1.0: +supports-color@^7.1.0: version "7.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== dependencies: has-flag "^4.0.0" -supports-hyperlinks@^2.2.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz#3943544347c1ff90b15effb03fc14ae45ec10624" - integrity sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA== - dependencies: - has-flag "^4.0.0" - supports-color "^7.0.0" - supports-preserve-symlinks-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" @@ -6318,7 +6082,7 @@ ts-essentials@^7.0.1: resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-7.0.3.tgz#686fd155a02133eedcc5362dc8b5056cde3e5a38" integrity sha512-8+gr5+lqO3G84KdiTSMRLtuyJ+nTBVRKuCrK4lidMPdVeEp0uqC875uE5NMcaA7YYMN7XsNiFQuMvasF8HT/xQ== -ts-node@10.9.2, ts-node@^10.9.1: +ts-node@10.9.2: version "10.9.2" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.2.tgz#70f021c9e185bccdca820e26dc413805c101c71f" integrity sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ== @@ -6362,7 +6126,7 @@ tslib@^1.9.3: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2.3.1, tslib@^2.5.0, tslib@^2.6.1, tslib@^2.6.2: +tslib@^2.3.1: version "2.6.2" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== @@ -6723,15 +6487,6 @@ workerpool@6.2.1: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" - integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" From 5a4227e847dddbd6022cc7ee2b0f0cd8bf42b2b0 Mon Sep 17 00:00:00 2001 From: Gleb Alekseev Date: Thu, 4 Apr 2024 19:26:07 -0300 Subject: [PATCH 2/2] docs updates --- docs/contracts/SUMMARY.md | 45 +- docs/contracts/interfaces/ICreate3Deployer.md | 59 ++- docs/contracts/interfaces/IDaiLikePermit.md | 48 +- .../interfaces/IERC20MetadataUppercase.md | 38 +- docs/contracts/interfaces/IERC7597Permit.md | 30 +- docs/contracts/interfaces/IPermit2.md | 121 +++-- docs/contracts/interfaces/IWETH.md | 62 +-- docs/contracts/libraries/AddressArray.md | 249 +++++----- docs/contracts/libraries/AddressLib.md | 108 ++--- docs/contracts/libraries/AddressSet.md | 221 +++++---- docs/contracts/libraries/BySigTraits.md | 76 ++- docs/contracts/libraries/BytesMemory.md | 116 +++-- docs/contracts/libraries/BytesStorage.md | 118 +++-- docs/contracts/libraries/ECDSA.md | 426 ++++++++--------- .../libraries/RevertReasonForwarder.md | 35 +- .../contracts/libraries/RevertReasonParser.md | 46 +- docs/contracts/libraries/SafeERC20.md | 441 +++++++++--------- docs/contracts/libraries/StringUtil.md | 84 ++-- docs/contracts/libraries/UniERC20.md | 245 ++++++---- docs/contracts/mixins/BySig.md | 213 +++------ docs/contracts/mixins/EthReceiver.md | 38 +- docs/contracts/mixins/OnlyWethReceiver.md | 40 +- docs/contracts/mixins/PermitAndCall.md | 30 +- .../contracts/mixins/SelfdestructEthSender.md | 30 +- 24 files changed, 1475 insertions(+), 1444 deletions(-) diff --git a/docs/contracts/SUMMARY.md b/docs/contracts/SUMMARY.md index 756418be..fb430b1e 100644 --- a/docs/contracts/SUMMARY.md +++ b/docs/contracts/SUMMARY.md @@ -26,47 +26,4 @@ * [EthReceiver](mixins/EthReceiver.md) * [OnlyWethReceiver](mixins/OnlyWethReceiver.md) * [PermitAndCall](mixins/PermitAndCall.md) - * [SelfdestructEthSender](mixins/SelfdestructEthSender.md) -* [mocks](mocks/README.md) - * [ERC20PermitMock](mocks/ERC20PermitMock.md) - * [SelfdestructEthSenderMock](mocks/SelfdestructEthSenderMock.md) - * [TokenCustomDecimalsMock](mocks/TokenCustomDecimalsMock.md) - * [TokenMock](mocks/TokenMock.md) -* [tests](tests/README.md) - * [libraries](tests/libraries/README.md) - * [StringUtilNaive](tests/libraries/StringUtilNaive.md) - * [mocks](tests/mocks/README.md) - * [AddressArrayMock](tests/mocks/AddressArrayMock.md) - * [AddressLibMock](tests/mocks/AddressLibMock.md) - * [AddressSetMock](tests/mocks/AddressSetMock.md) - * [BySigTraitsMock](tests/mocks/BySigTraitsMock.md) - * [BytesMemoryMock](tests/mocks/BytesMemoryMock.md) - * [BytesStorageMock](tests/mocks/BytesStorageMock.md) - * [DaiLikePermitMock](tests/mocks/DaiLikePermitMock.md) - * [ERC1271WalletMock](tests/mocks/ERC1271WalletMock.md) - * [ERC20Capitals](tests/mocks/ERC20Capitals.md) - * [ERC20NoReturnMock](tests/mocks/ERC20NoReturnMock.md) - * [ERC20PermitNoRevertMock](tests/mocks/ERC20PermitNoRevertMock.md) - * [ERC20ReturnFalseMock](tests/mocks/ERC20ReturnFalseMock.md) - * [ERC20ReturnTrueMock](tests/mocks/ERC20ReturnTrueMock.md) - * [ERC20ThroughZeroApprove](tests/mocks/ERC20ThroughZeroApprove.md) - * [ERC20WithSafeBalance](tests/mocks/ERC20WithSafeBalance.md) - * [ERC20bytes32](tests/mocks/ERC20bytes32.md) - * [ERC20bytes32Capitals](tests/mocks/ERC20bytes32Capitals.md) - * [ETHBadReceiver](tests/mocks/ETHBadReceiver.md) - * [EthReceiverMock](tests/mocks/EthReceiverMock.md) - * [EthSenderMock](tests/mocks/EthSenderMock.md) - * [IUniERC20Wrapper](tests/mocks/IUniERC20Wrapper.md) - * [Permit2ReturnTrueMock](tests/mocks/Permit2ReturnTrueMock.md) - * [PermitAndCallMock](tests/mocks/PermitAndCallMock.md) - * [PermitableMock](tests/mocks/PermitableMock.md) - * [SafeERC20Wrapper](tests/mocks/SafeERC20Wrapper.md) - * [SafeWETHWrapper](tests/mocks/SafeWETHWrapper.md) - * [TokenWithBySig](tests/mocks/TokenWithBySig.md) - * [USDCLikePermitMock](tests/mocks/USDCLikePermitMock.md) - * [UniERC20Wrapper](tests/mocks/UniERC20Wrapper.md) - * [WETH](tests/mocks/WETH.md) - * [WethReceiverMock](tests/mocks/WethReceiverMock.md) - * [ECDSATest](tests/ECDSATest.md) - * [RevertReasonParserTest](tests/RevertReasonParserTest.md) - * [StringUtilTest](tests/StringUtilTest.md) \ No newline at end of file + * [SelfdestructEthSender](mixins/SelfdestructEthSender.md) \ No newline at end of file diff --git a/docs/contracts/interfaces/ICreate3Deployer.md b/docs/contracts/interfaces/ICreate3Deployer.md index e37b96b2..6d950f06 100644 --- a/docs/contracts/interfaces/ICreate3Deployer.md +++ b/docs/contracts/interfaces/ICreate3Deployer.md @@ -1,50 +1,49 @@ -# ICreate3Deployer +## ICreate3Deployer -ICreate3Deployer +_Interface for deploying contracts with deterministic addresses via CREATE3._ +### Functions list +- [deploy(salt, code) external](#deploy) +- [addressOf(salt) external](#addressof) -Interface for deploying contracts with deterministic addresses via CREATE3. - - -## Functions +### Functions ### deploy + ```solidity -function deploy( - bytes32 salt, - bytes code -) external returns (address) +function deploy(bytes32 salt, bytes code) external returns (address) ``` Deploys a contract using CREATE3 with a given salt and bytecode. +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`salt` | bytes32 | Unique value to create deterministic address. -|`code` | bytes | Contract bytecode to deploy. +| Name | Type | Description | +| ---- | ---- | ----------- | +| salt | bytes32 | Unique value to create deterministic address. | +| code | bytes | Contract bytecode to deploy. | -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`Address`| address | of the deployed contract. +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | address | Address of the deployed contract. | ### addressOf + ```solidity -function addressOf( - bytes32 salt -) external returns (address) +function addressOf(bytes32 salt) external view returns (address) ``` Computes the address of a contract deployed with the given salt. +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| salt | bytes32 | Unique value used during deployment. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`salt` | bytes32 | Unique value used during deployment. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`Address`| address | of the contract. +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | address | Address of the contract. | diff --git a/docs/contracts/interfaces/IDaiLikePermit.md b/docs/contracts/interfaces/IDaiLikePermit.md index 4165350c..30c23fa0 100644 --- a/docs/contracts/interfaces/IDaiLikePermit.md +++ b/docs/contracts/interfaces/IDaiLikePermit.md @@ -1,39 +1,29 @@ -# IDaiLikePermit +## IDaiLikePermit -IDaiLikePermit +_Interface for Dai-like permit function allowing token spending via signatures._ +### Functions list +- [permit(holder, spender, nonce, expiry, allowed, v, r, s) external](#permit) -Interface for Dai-like permit function allowing token spending via signatures. - - -## Functions +### Functions ### permit + ```solidity -function permit( - address holder, - address spender, - uint256 nonce, - uint256 expiry, - bool allowed, - uint8 v, - bytes32 r, - bytes32 s -) external +function permit(address holder, address spender, uint256 nonce, uint256 expiry, bool allowed, uint8 v, bytes32 r, bytes32 s) external ``` Approves spending of tokens via off-chain signatures. - -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`holder` | address | Token holder's address. -|`spender` | address | Spender's address. -|`nonce` | uint256 | Current nonce of the holder. -|`expiry` | uint256 | Time when the permit expires. -|`allowed` | bool | True to allow, false to disallow spending. -|`v` | uint8 | Signature components. -|`r` | bytes32 | -|`s` | bytes32 | - +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| holder | address | Token holder's address. | +| spender | address | Spender's address. | +| nonce | uint256 | Current nonce of the holder. | +| expiry | uint256 | Time when the permit expires. | +| allowed | bool | True to allow, false to disallow spending. | +| v | uint8 | | +| r | bytes32 | | +| s | bytes32 | Signature components. | diff --git a/docs/contracts/interfaces/IERC20MetadataUppercase.md b/docs/contracts/interfaces/IERC20MetadataUppercase.md index 6cddcb8d..2dacbbcd 100644 --- a/docs/contracts/interfaces/IERC20MetadataUppercase.md +++ b/docs/contracts/interfaces/IERC20MetadataUppercase.md @@ -1,38 +1,36 @@ -# IERC20MetadataUppercase +## IERC20MetadataUppercase -IERC20MetadataUppercase +_Interface for ERC20 token metadata with uppercase naming convention._ +### Functions list +- [NAME() external](#name) +- [SYMBOL() external](#symbol) -Interface for ERC20 token metadata with uppercase naming convention. - - -## Functions +### Functions ### NAME + ```solidity -function NAME( -) external returns (string) +function NAME() external view returns (string) ``` Gets the token name. +#### Return Values - -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`Token`| string | name. +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | string | Token name. | ### SYMBOL + ```solidity -function SYMBOL( -) external returns (string) +function SYMBOL() external view returns (string) ``` Gets the token symbol. +#### Return Values - -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`Token`| string | symbol. +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | string | Token symbol. | diff --git a/docs/contracts/interfaces/IERC7597Permit.md b/docs/contracts/interfaces/IERC7597Permit.md index 5632a98d..f304e251 100644 --- a/docs/contracts/interfaces/IERC7597Permit.md +++ b/docs/contracts/interfaces/IERC7597Permit.md @@ -1,31 +1,13 @@ -# IERC7597Permit +## IERC7597Permit +### Functions list +- [permit(owner, spender, value, deadline, signature) external](#permit) - - - - -## Functions +### Functions ### permit + ```solidity -function permit( - address owner, - address spender, - uint256 value, - uint256 deadline, - bytes signature -) external +function permit(address owner, address spender, uint256 value, uint256 deadline, bytes signature) external ``` - -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`owner` | address | -|`spender` | address | -|`value` | uint256 | -|`deadline` | uint256 | -|`signature` | bytes | - - diff --git a/docs/contracts/interfaces/IPermit2.md b/docs/contracts/interfaces/IPermit2.md index a8fd07ba..7ec368b5 100644 --- a/docs/contracts/interfaces/IPermit2.md +++ b/docs/contracts/interfaces/IPermit2.md @@ -1,73 +1,104 @@ -# IPermit2 +## IPermit2 -IPermit2 +_Interface for a flexible permit system that extends ERC20 tokens to support permits in tokens lacking native permit functionality._ +### Types list +- [PermitDetails](#permitdetails) +- [PermitSingle](#permitsingle) +- [PackedAllowance](#packedallowance) -Interface for a flexible permit system that extends ERC20 tokens to support permits in tokens lacking native permit functionality. +### Functions list +- [transferFrom(user, spender, amount, token) external](#transferfrom) +- [permit(owner, permitSingle, signature) external](#permit) +- [allowance(user, token, spender) external](#allowance) +### Types +### PermitDetails -## Functions +_Struct for holding permit details._ + +```solidity +struct PermitDetails { + address token; + uint160 amount; + uint48 expiration; + uint48 nonce; +} +``` +### PermitSingle + +_Struct for a single token allowance permit._ + +```solidity +struct PermitSingle { + struct IPermit2.PermitDetails details; + address spender; + uint256 sigDeadline; +} +``` +### PackedAllowance + +_Struct for packed allowance data to optimize storage._ + +```solidity +struct PackedAllowance { + uint160 amount; + uint48 expiration; + uint48 nonce; +} +``` + +### Functions ### transferFrom + ```solidity -function transferFrom( - address user, - address spender, - uint160 amount, - address token -) external +function transferFrom(address user, address spender, uint160 amount, address token) external ``` Executes a token transfer from one address to another. +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`user` | address | The token owner's address. -|`spender` | address | The address authorized to spend the tokens. -|`amount` | uint160 | The amount of tokens to transfer. -|`token` | address | The address of the token being transferred. - +| Name | Type | Description | +| ---- | ---- | ----------- | +| user | address | The token owner's address. | +| spender | address | The address authorized to spend the tokens. | +| amount | uint160 | The amount of tokens to transfer. | +| token | address | The address of the token being transferred. | ### permit + ```solidity -function permit( - address owner, - struct IPermit2.PermitSingle permitSingle, - bytes signature -) external +function permit(address owner, struct IPermit2.PermitSingle permitSingle, bytes signature) external ``` Issues a permit for spending tokens via a signed authorization. +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`owner` | address | The token owner's address. -|`permitSingle` | struct IPermit2.PermitSingle | Struct containing the permit details. -|`signature` | bytes | The signature proving the owner authorized the permit. - +| Name | Type | Description | +| ---- | ---- | ----------- | +| owner | address | The token owner's address. | +| permitSingle | struct IPermit2.PermitSingle | Struct containing the permit details. | +| signature | bytes | The signature proving the owner authorized the permit. | ### allowance + ```solidity -function allowance( - address user, - address token, - address spender -) external returns (struct IPermit2.PackedAllowance) +function allowance(address user, address token, address spender) external view returns (struct IPermit2.PackedAllowance) ``` Retrieves the allowance details between a token owner and spender. +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| user | address | The token owner's address. | +| token | address | The token address. | +| spender | address | The spender's address. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`user` | address | The token owner's address. -|`token` | address | The token address. -|`spender` | address | The spender's address. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`The`| struct IPermit2.PackedAllowance | packed allowance details. +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | struct IPermit2.PackedAllowance | The packed allowance details. | diff --git a/docs/contracts/interfaces/IWETH.md b/docs/contracts/interfaces/IWETH.md index cca26e20..8a046954 100644 --- a/docs/contracts/interfaces/IWETH.md +++ b/docs/contracts/interfaces/IWETH.md @@ -1,67 +1,49 @@ -# IWETH +## IWETH -IWETH +_Interface for wrapper as WETH-like token._ +### Functions list +- [deposit() external](#deposit) +- [withdraw(amount) external](#withdraw) -Interface for wrapper as WETH-like token. +### Events list +- [Deposit(dst, wad) ](#deposit) +- [Withdrawal(src, wad) ](#withdrawal) -## Derives -- [IERC20](https://docs.openzeppelin.com/contracts/3.x/api/token/ERC20#IERC20) - -## Functions +### Functions ### deposit + ```solidity -function deposit( -) external +function deposit() external payable ``` Deposit Ether to get wrapper tokens. - - ### withdraw + ```solidity -function withdraw( - uint256 amount -) external +function withdraw(uint256 amount) external ``` Withdraw wrapped tokens as Ether. +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`amount` | uint256 | Amount of wrapped tokens to withdraw. +| Name | Type | Description | +| ---- | ---- | ----------- | +| amount | uint256 | Amount of wrapped tokens to withdraw. | - -## Events +### Events ### Deposit + ```solidity -event Deposit( - address dst, - uint256 wad -) +event Deposit(address dst, uint256 wad) ``` Emitted when Ether is deposited to get wrapper tokens. -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`dst` | address | -|`wad` | uint256 | - ### Withdrawal + ```solidity -event Withdrawal( - address src, - uint256 wad -) +event Withdrawal(address src, uint256 wad) ``` Emitted when wrapper tokens is withdrawn as Ether. -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`src` | address | -|`wad` | uint256 | - diff --git a/docs/contracts/libraries/AddressArray.md b/docs/contracts/libraries/AddressArray.md index aae4d58b..86c0c6f0 100644 --- a/docs/contracts/libraries/AddressArray.md +++ b/docs/contracts/libraries/AddressArray.md @@ -1,180 +1,221 @@ -# AddressArray - -AddressArray +## AddressArray Implements a dynamic array of addresses using a mapping for storage efficiency, with the array length stored at index 0. -This library provides basic functionalities such as push, pop, set, and retrieval of addresses in a storage-efficient manner. +_This library provides basic functionalities such as push, pop, set, and retrieval of addresses in a storage-efficient manner._ + +### Types list +- [Data](#data) + +### Functions list +- [length(self) internal](#length) +- [at(self, i) internal](#at) +- [get(self) internal](#get) +- [get(self, input) internal](#get) +- [push(self, account) internal](#push) +- [pop(self) internal](#pop) +- [popGet(self) internal](#popget) +- [set(self, index, account) internal](#set) +- [erase(self) internal](#erase) + +### Errors list +- [IndexOutOfBounds() ](#indexoutofbounds) +- [PopFromEmptyArray() ](#popfromemptyarray) +- [OutputArrayTooSmall() ](#outputarraytoosmall) + +### Types +### Data +_Struct containing the raw mapping used to store the addresses and the array length._ -## Functions +```solidity +struct Data { + uint256[4294967296] _raw; +} +``` + +### Functions ### length + ```solidity -function length( - struct AddressArray.Data self -) internal returns (uint256) +function length(struct AddressArray.Data self) internal view returns (uint256) ``` Returns the number of addresses stored in the array. +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| self | struct AddressArray.Data | The instance of the Data struct. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`self` | struct AddressArray.Data | The instance of the Data struct. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`The`| uint256 | number of addresses. +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | uint256 | The number of addresses. | ### at + ```solidity -function at( - struct AddressArray.Data self, - uint256 i -) internal returns (address) +function at(struct AddressArray.Data self, uint256 i) internal view returns (address) ``` Retrieves the address at a specified index in the array. +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| self | struct AddressArray.Data | The instance of the Data struct. | +| i | uint256 | The index to retrieve the address from. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`self` | struct AddressArray.Data | The instance of the Data struct. -|`i` | uint256 | The index to retrieve the address from. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`The`| address | address stored at the specified index. +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | address | The address stored at the specified index. | ### get + ```solidity -function get( - struct AddressArray.Data self -) internal returns (address[] output) +function get(struct AddressArray.Data self) internal view returns (address[] output) ``` Returns all addresses in the array from storage. +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`self` | struct AddressArray.Data | The instance of the Data struct. +| Name | Type | Description | +| ---- | ---- | ----------- | +| self | struct AddressArray.Data | The instance of the Data struct. | -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`output`| address[] | Array containing all the addresses. +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +output | address[] | Array containing all the addresses. | ### get + ```solidity -function get( - struct AddressArray.Data self, - address[] input -) internal returns (address[] output) +function get(struct AddressArray.Data self, address[] input) internal view returns (address[] output) ``` Copies the addresses into the provided output array. +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`self` | struct AddressArray.Data | The instance of the Data struct. -|`input` | address[] | The array to copy the addresses into. +| Name | Type | Description | +| ---- | ---- | ----------- | +| self | struct AddressArray.Data | The instance of the Data struct. | +| input | address[] | The array to copy the addresses into. | -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`output`| address[] | The provided output array filled with addresses. +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +output | address[] | The provided output array filled with addresses. | ### push + ```solidity -function push( - struct AddressArray.Data self, - address account -) internal returns (uint256 res) +function push(struct AddressArray.Data self, address account) internal returns (uint256 res) ``` Adds an address to the end of the array. +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| self | struct AddressArray.Data | The instance of the Data struct. | +| account | address | The address to add. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`self` | struct AddressArray.Data | The instance of the Data struct. -|`account` | address | The address to add. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`res`| uint256 | The new length of the array. +| Name | Type | Description | +| ---- | ---- | ----------- | +res | uint256 | The new length of the array. | ### pop + ```solidity -function pop( - struct AddressArray.Data self -) internal +function pop(struct AddressArray.Data self) internal ``` Removes the last address from the array. +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`self` | struct AddressArray.Data | The instance of the Data struct. - +| Name | Type | Description | +| ---- | ---- | ----------- | +| self | struct AddressArray.Data | The instance of the Data struct. | ### popGet + ```solidity -function popGet( - struct AddressArray.Data self -) internal returns (address res) +function popGet(struct AddressArray.Data self) internal returns (address res) ``` Array pop back operation for storage `self` that returns popped element. +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| self | struct AddressArray.Data | The instance of the Data struct. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`self` | struct AddressArray.Data | The instance of the Data struct. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`res`| address | The address that was removed from the array. +| Name | Type | Description | +| ---- | ---- | ----------- | +res | address | The address that was removed from the array. | ### set + ```solidity -function set( - struct AddressArray.Data self, - uint256 index, - address account -) internal +function set(struct AddressArray.Data self, uint256 index, address account) internal ``` Sets the address at a specified index in the array. +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`self` | struct AddressArray.Data | The instance of the Data struct. -|`index` | uint256 | The index at which to set the address. -|`account` | address | The address to set at the specified index. - +| Name | Type | Description | +| ---- | ---- | ----------- | +| self | struct AddressArray.Data | The instance of the Data struct. | +| index | uint256 | The index at which to set the address. | +| account | address | The address to set at the specified index. | ### erase + ```solidity -function erase( - struct AddressArray.Data self -) internal +function erase(struct AddressArray.Data self) internal ``` Erase length of the array. +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| self | struct AddressArray.Data | The instance of the Data struct. | + +### Errors +### IndexOutOfBounds + +```solidity +error IndexOutOfBounds() +``` -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`self` | struct AddressArray.Data | The instance of the Data struct. +_Error thrown when attempting to access an index outside the bounds of the array._ + +### PopFromEmptyArray + +```solidity +error PopFromEmptyArray() +``` + +_Error thrown when attempting to pop an element from an empty array._ + +### OutputArrayTooSmall + +```solidity +error OutputArrayTooSmall() +``` +_Error thrown when the output array provided for getting the list of addresses is too small._ diff --git a/docs/contracts/libraries/AddressLib.md b/docs/contracts/libraries/AddressLib.md index d92f8dea..89289839 100644 --- a/docs/contracts/libraries/AddressLib.md +++ b/docs/contracts/libraries/AddressLib.md @@ -1,92 +1,94 @@ -# AddressLib +## Address +## AddressLib AddressLib Library for working with addresses encoded as uint256 values, which can include flags in the highest bits. +### Functions list +- [get(a) internal](#get) +- [getFlag(a, flag) internal](#getflag) +- [getUint32(a, offset) internal](#getuint32) +- [getUint64(a, offset) internal](#getuint64) - -## Functions +### Functions ### get + ```solidity -function get( - Address a -) internal returns (address) +function get(Address a) internal pure returns (address) ``` Returns the address representation of a uint256. +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| a | Address | The uint256 value to convert to an address. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`a` | Address | The uint256 value to convert to an address. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`The`| address | address representation of the provided uint256 value. +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | address | The address representation of the provided uint256 value. | ### getFlag + ```solidity -function getFlag( - Address a, - uint256 flag -) internal returns (bool) +function getFlag(Address a, uint256 flag) internal pure returns (bool) ``` Checks if a given flag is set for the provided address. +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| a | Address | The address to check for the flag. | +| flag | uint256 | The flag to check for in the provided address. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`a` | Address | The address to check for the flag. -|`flag` | uint256 | The flag to check for in the provided address. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`True`| bool | if the provided flag is set in the address, false otherwise. +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | bool | True if the provided flag is set in the address, false otherwise. | ### getUint32 + ```solidity -function getUint32( - Address a, - uint256 offset -) internal returns (uint32) +function getUint32(Address a, uint256 offset) internal pure returns (uint32) ``` Returns a uint32 value stored at a specific bit offset in the provided address. +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| a | Address | The address containing the uint32 value. | +| offset | uint256 | The bit offset at which the uint32 value is stored. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`a` | Address | The address containing the uint32 value. -|`offset` | uint256 | The bit offset at which the uint32 value is stored. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`The`| uint32 | uint32 value stored in the address at the specified bit offset. +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | uint32 | The uint32 value stored in the address at the specified bit offset. | ### getUint64 + ```solidity -function getUint64( - Address a, - uint256 offset -) internal returns (uint64) +function getUint64(Address a, uint256 offset) internal pure returns (uint64) ``` Returns a uint64 value stored at a specific bit offset in the provided address. +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| a | Address | The address containing the uint64 value. | +| offset | uint256 | The bit offset at which the uint64 value is stored. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`a` | Address | The address containing the uint64 value. -|`offset` | uint256 | The bit offset at which the uint64 value is stored. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`The`| uint64 | uint64 value stored in the address at the specified bit offset. +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | uint64 | The uint64 value stored in the address at the specified bit offset. | diff --git a/docs/contracts/libraries/AddressSet.md b/docs/contracts/libraries/AddressSet.md index 2f558d8e..2db5e663 100644 --- a/docs/contracts/libraries/AddressSet.md +++ b/docs/contracts/libraries/AddressSet.md @@ -1,173 +1,190 @@ -# AddressSet - -AddressSet +## AddressSet Library for managing sets of addresses, allowing operations such as add, remove, and contains. Utilizes the AddressArray library for underlying data storage. +### Types list +- [Data](#data) + +### Functions list +- [length(s) internal](#length) +- [at(s, index) internal](#at) +- [contains(s, item) internal](#contains) +- [get(s) internal](#get) +- [get(s, input) internal](#get) +- [add(s, item) internal](#add) +- [remove(s, item) internal](#remove) +- [erase(s) internal](#erase) + +### Types +### Data +_Data struct from AddressArray.Data items +and lookup mapping address => index in data array._ + +```solidity +struct Data { + struct AddressArray.Data items; + mapping(address => uint256) lookup; +} +``` -## Functions +### Functions ### length + ```solidity -function length( - struct AddressSet.Data s -) internal returns (uint256) +function length(struct AddressSet.Data s) internal view returns (uint256) ``` Determines the number of addresses in the set. +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| s | struct AddressSet.Data | The set of addresses. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`s` | struct AddressSet.Data | The set of addresses. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`The`| uint256 | number of addresses in the set. +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | uint256 | The number of addresses in the set. | ### at + ```solidity -function at( - struct AddressSet.Data s, - uint256 index -) internal returns (address) +function at(struct AddressSet.Data s, uint256 index) internal view returns (address) ``` Retrieves the address at a specified index in the set. +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`s` | struct AddressSet.Data | The set of addresses. -|`index` | uint256 | The index of the address to retrieve. +| Name | Type | Description | +| ---- | ---- | ----------- | +| s | struct AddressSet.Data | The set of addresses. | +| index | uint256 | The index of the address to retrieve. | -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`The`| address | address at the specified index. +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | address | The address at the specified index. | ### contains + ```solidity -function contains( - struct AddressSet.Data s, - address item -) internal returns (bool) +function contains(struct AddressSet.Data s, address item) internal view returns (bool) ``` Checks if the set contains the specified address. +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`s` | struct AddressSet.Data | The set of addresses. -|`item` | address | The address to check for. +| Name | Type | Description | +| ---- | ---- | ----------- | +| s | struct AddressSet.Data | The set of addresses. | +| item | address | The address to check for. | -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`True`| bool | if the set contains the address, false otherwise. +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | bool | True if the set contains the address, false otherwise. | ### get + ```solidity -function get( - struct AddressSet.Data s -) internal returns (address[]) +function get(struct AddressSet.Data s) internal view returns (address[]) ``` Returns list of addresses from storage `s`. +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| s | struct AddressSet.Data | The set of addresses. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`s` | struct AddressSet.Data | The set of addresses. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`The`| address[] | array of addresses stored in `s`. +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | address[] | The array of addresses stored in `s`. | ### get + ```solidity -function get( - struct AddressSet.Data s, - address[] input -) internal returns (address[]) +function get(struct AddressSet.Data s, address[] input) internal view returns (address[]) ``` Puts list of addresses from `s` storage into `output` array. +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| s | struct AddressSet.Data | The set of addresses. | +| input | address[] | | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`s` | struct AddressSet.Data | The set of addresses. -|`input` | address[] | +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`The`| address[] | provided output array filled with addresses. +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | address[] | The provided output array filled with addresses. | ### add + ```solidity -function add( - struct AddressSet.Data s, - address item -) internal returns (bool) +function add(struct AddressSet.Data s, address item) internal returns (bool) ``` Adds an address to the set if it is not already present. +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`s` | struct AddressSet.Data | The set of addresses. -|`item` | address | The address to add. +| Name | Type | Description | +| ---- | ---- | ----------- | +| s | struct AddressSet.Data | The set of addresses. | +| item | address | The address to add. | -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`True`| bool | if the address was added to the set, false if it was already present. +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | bool | True if the address was added to the set, false if it was already present. | ### remove + ```solidity -function remove( - struct AddressSet.Data s, - address item -) internal returns (bool) +function remove(struct AddressSet.Data s, address item) internal returns (bool) ``` Removes an address from the set if it exists. +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| s | struct AddressSet.Data | The set of addresses. | +| item | address | The address to remove. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`s` | struct AddressSet.Data | The set of addresses. -|`item` | address | The address to remove. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`True`| bool | if the address was removed from the set, false if it was not found. +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | bool | True if the address was removed from the set, false if it was not found. | ### erase + ```solidity -function erase( - struct AddressSet.Data s -) internal returns (address[] items) +function erase(struct AddressSet.Data s) internal returns (address[] items) ``` Erases set from storage `s`. +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| s | struct AddressSet.Data | The set of addresses. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`s` | struct AddressSet.Data | The set of addresses. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`items`| address[] | All removed items. +| Name | Type | Description | +| ---- | ---- | ----------- | +items | address[] | All removed items. | diff --git a/docs/contracts/libraries/BySigTraits.md b/docs/contracts/libraries/BySigTraits.md index a8289fcf..2765ba91 100644 --- a/docs/contracts/libraries/BySigTraits.md +++ b/docs/contracts/libraries/BySigTraits.md @@ -1,67 +1,61 @@ -# BySigTraits +## BySigTraits +### Types list +- [Value](#value) +- [NonceType](#noncetype) +### Functions list +- [nonceType(traits) internal](#noncetype) +- [deadline(traits) internal](#deadline) +- [isRelayerAllowed(traits, relayer) internal](#isrelayerallowed) +- [nonce(traits) internal](#nonce) +### Errors list +- [WrongNonceType() ](#wrongnoncetype) +### Types +### Value +### NonceType -## Functions -### nonceType ```solidity -function nonceType( - BySigTraits.Value traits -) internal returns (enum BySigTraits.NonceType) +enum NonceType { + Account, + Selector, + Unique +} ``` +### Functions +### nonceType -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`traits` | BySigTraits.Value | - - -### deadline ```solidity -function deadline( - BySigTraits.Value traits -) internal returns (uint256) +function nonceType(BySigTraits.Value traits) internal pure returns (enum BySigTraits.NonceType) ``` +### deadline -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`traits` | BySigTraits.Value | - - -### isRelayerAllowed ```solidity -function isRelayerAllowed( - BySigTraits.Value traits, - address relayer -) internal returns (bool) +function deadline(BySigTraits.Value traits) internal pure returns (uint256) ``` +### isRelayerAllowed -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`traits` | BySigTraits.Value | -|`relayer` | address | - +```solidity +function isRelayerAllowed(BySigTraits.Value traits, address relayer) internal pure returns (bool) +``` ### nonce + ```solidity -function nonce( - BySigTraits.Value traits -) internal returns (uint256) +function nonce(BySigTraits.Value traits) internal pure returns (uint256) ``` +### Errors +### WrongNonceType -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`traits` | BySigTraits.Value | - +```solidity +error WrongNonceType() +``` diff --git a/docs/contracts/libraries/BytesMemory.md b/docs/contracts/libraries/BytesMemory.md index fc64eb80..964ef6d4 100644 --- a/docs/contracts/libraries/BytesMemory.md +++ b/docs/contracts/libraries/BytesMemory.md @@ -1,71 +1,99 @@ -# BytesMemory - -BytesMemory +## BytesMemory A library for operating on bytes memory slices without copying. +### Types list +- [Slice](#slice) + +### Functions list +- [wrap(data) internal](#wrap) +- [slice(data, offset, size) internal](#slice) +- [unwrap(piece) internal](#unwrap) + +### Errors list +- [OutOfBounds() ](#outofbounds) + +### Types +### Slice + +_A struct representing a slice of bytes. +This points directly to memory without copying the slice._ +```solidity +struct Slice { + uint256 pointer; + uint256 length; +} +``` -## Functions +### Functions ### wrap + ```solidity -function wrap( - bytes data -) internal returns (struct BytesMemory.Slice ret) +function wrap(bytes data) internal pure returns (struct BytesMemory.Slice ret) ``` -Creates a `Slice` from a bytes array. +_Creates a `Slice` from a bytes array._ + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| data | bytes | The bytes array to create a slice from. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`data` | bytes | The bytes array to create a slice from. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`ret`| struct BytesMemory.Slice | A `Slice` struct representing the entire bytes array. +| Name | Type | Description | +| ---- | ---- | ----------- | +ret | struct BytesMemory.Slice | A `Slice` struct representing the entire bytes array. | ### slice + ```solidity -function slice( - struct BytesMemory.Slice data, - uint256 offset, - uint256 size -) internal returns (struct BytesMemory.Slice ret) +function slice(struct BytesMemory.Slice data, uint256 offset, uint256 size) internal pure returns (struct BytesMemory.Slice ret) ``` -Returns a new `Slice` representing a portion of the original. +_Returns a new `Slice` representing a portion of the original._ + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| data | struct BytesMemory.Slice | The original `Slice` to take a portion from. | +| offset | uint256 | The offset in bytes from the start of the original `Slice`. | +| size | uint256 | The size of the new `Slice` in bytes. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`data` | struct BytesMemory.Slice | The original `Slice` to take a portion from. -|`offset` | uint256 | The offset in bytes from the start of the original `Slice`. -|`size` | uint256 | The size of the new `Slice` in bytes. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`ret`| struct BytesMemory.Slice | A new `Slice` struct representing the specified portion of the original. +| Name | Type | Description | +| ---- | ---- | ----------- | +ret | struct BytesMemory.Slice | A new `Slice` struct representing the specified portion of the original. | ### unwrap + ```solidity -function unwrap( - struct BytesMemory.Slice piece -) internal returns (bytes ret) +function unwrap(struct BytesMemory.Slice piece) internal view returns (bytes ret) ``` -Converts a `Slice` back into a bytes array. The bytes array is returned without copying the data. +_Converts a `Slice` back into a bytes array. The bytes array is returned without copying the data._ + +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`piece` | struct BytesMemory.Slice | The `Slice` to convert back to a bytes array. +| Name | Type | Description | +| ---- | ---- | ----------- | +| piece | struct BytesMemory.Slice | The `Slice` to convert back to a bytes array. | -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`ret`| bytes | The bytes array represented by the `Slice`. +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +ret | bytes | The bytes array represented by the `Slice`. | + +### Errors +### OutOfBounds + +```solidity +error OutOfBounds() +``` diff --git a/docs/contracts/libraries/BytesStorage.md b/docs/contracts/libraries/BytesStorage.md index 80cf11d0..8672fa45 100644 --- a/docs/contracts/libraries/BytesStorage.md +++ b/docs/contracts/libraries/BytesStorage.md @@ -1,72 +1,100 @@ -# BytesStorage - -BytesStorage +## BytesStorage A library for operating on bytes storage slices. +### Types list +- [Slice](#slice) + +### Functions list +- [wrap(data) internal](#wrap) +- [slice(data, offset, size) internal](#slice) +- [copy(piece) internal](#copy) + +### Errors list +- [OutOfBounds() ](#outofbounds) + +### Types +### Slice + +_A struct representing a slice of bytes storage._ +```solidity +struct Slice { + uint256 slot; + uint256 offset; + uint256 length; +} +``` -## Functions +### Functions ### wrap + ```solidity -function wrap( - bytes data -) internal returns (struct BytesStorage.Slice) +function wrap(bytes data) internal view returns (struct BytesStorage.Slice) ``` -Wraps a bytes storage array into a `Slice`. For a detailed explanation, - refer to https://ethereum.stackexchange.com/questions/107282/storage-and-memory-layout-of-strings/155800#155800 +_Wraps a bytes storage array into a `Slice`. For a detailed explanation, + refer to https://ethereum.stackexchange.com/questions/107282/storage-and-memory-layout-of-strings/155800#155800_ + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| data | bytes | The bytes storage array to wrap. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`data` | bytes | The bytes storage array to wrap. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`A`| struct BytesStorage.Slice | `Slice` struct that refers to the storage location and length of `data`. +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | struct BytesStorage.Slice | A `Slice` struct that refers to the storage location and length of `data`. | ### slice + ```solidity -function slice( - struct BytesStorage.Slice data, - uint256 offset, - uint256 size -) internal returns (struct BytesStorage.Slice) +function slice(struct BytesStorage.Slice data, uint256 offset, uint256 size) internal pure returns (struct BytesStorage.Slice) ``` -Returns a new `Slice` representing a portion of the original storage slice. +_Returns a new `Slice` representing a portion of the original storage slice._ + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| data | struct BytesStorage.Slice | The original `Slice` to take a portion from. | +| offset | uint256 | The offset in bytes from the start of the original `Slice`. | +| size | uint256 | The size of the new `Slice` in bytes. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`data` | struct BytesStorage.Slice | The original `Slice` to take a portion from. -|`offset` | uint256 | The offset in bytes from the start of the original `Slice`. -|`size` | uint256 | The size of the new `Slice` in bytes. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`A`| struct BytesStorage.Slice | new `Slice` struct representing the specified portion of the original. +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | struct BytesStorage.Slice | A new `Slice` struct representing the specified portion of the original. | ### copy + ```solidity -function copy( - struct BytesStorage.Slice piece -) internal returns (bytes ret) +function copy(struct BytesStorage.Slice piece) internal view returns (bytes ret) ``` -Copies a `Slice` from storage and returns it as a new bytes array. +_Copies a `Slice` from storage and returns it as a new bytes array._ + +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`piece` | struct BytesStorage.Slice | The `Slice` to copy from storage. +| Name | Type | Description | +| ---- | ---- | ----------- | +| piece | struct BytesStorage.Slice | The `Slice` to copy from storage. | -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`ret`| bytes | The new bytes array containing the copied data. +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +ret | bytes | The new bytes array containing the copied data. | + +### Errors +### OutOfBounds + +```solidity +error OutOfBounds() +``` diff --git a/docs/contracts/libraries/ECDSA.md b/docs/contracts/libraries/ECDSA.md index b63e0585..c46dd4c7 100644 --- a/docs/contracts/libraries/ECDSA.md +++ b/docs/contracts/libraries/ECDSA.md @@ -1,331 +1,315 @@ -# ECDSA - -ECDSA signature operations +## ECDSA Provides functions for recovering addresses from signatures and verifying signatures, including support for EIP-2098 compact signatures. - - -## Functions +### Functions list +- [recover(hash, v, r, s) internal](#recover) +- [recover(hash, r, vs) internal](#recover) +- [recover(hash, signature) internal](#recover) +- [recoverOrIsValidSignature(signer, hash, signature) internal](#recoverorisvalidsignature) +- [recoverOrIsValidSignature(signer, hash, v, r, s) internal](#recoverorisvalidsignature) +- [recoverOrIsValidSignature(signer, hash, r, vs) internal](#recoverorisvalidsignature) +- [recoverOrIsValidSignature65(signer, hash, r, vs) internal](#recoverorisvalidsignature65) +- [isValidSignature(signer, hash, signature) internal](#isvalidsignature) +- [isValidSignature(signer, hash, v, r, s) internal](#isvalidsignature) +- [isValidSignature(signer, hash, r, vs) internal](#isvalidsignature) +- [isValidSignature65(signer, hash, r, vs) internal](#isvalidsignature65) +- [toEthSignedMessageHash(hash) internal](#toethsignedmessagehash) +- [toTypedDataHash(domainSeparator, structHash) internal](#totypeddatahash) + +### Functions ### recover + ```solidity -function recover( - bytes32 hash, - uint8 v, - bytes32 r, - bytes32 s -) internal returns (address signer) +function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal view returns (address signer) ``` Recovers the signer's address from the signature. -Recovers the address that has signed a hash with `(v, r, s)` signature. +_Recovers the address that has signed a hash with `(v, r, s)` signature._ + +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`hash` | bytes32 | The keccak256 hash of the data signed. -|`v` | uint8 | The recovery byte of the signature. -|`r` | bytes32 | The first 32 bytes of the signature. -|`s` | bytes32 | The second 32 bytes of the signature. +| Name | Type | Description | +| ---- | ---- | ----------- | +| hash | bytes32 | The keccak256 hash of the data signed. | +| v | uint8 | The recovery byte of the signature. | +| r | bytes32 | The first 32 bytes of the signature. | +| s | bytes32 | The second 32 bytes of the signature. | -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`signer`| address | The address of the signer. +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +signer | address | The address of the signer. | ### recover + ```solidity -function recover( - bytes32 hash, - bytes32 r, - bytes32 vs -) internal returns (address signer) +function recover(bytes32 hash, bytes32 r, bytes32 vs) internal view returns (address signer) ``` Recovers the signer's address from the signature using `r` and `vs` components. -Recovers the address that has signed a hash with `r` and `vs`, where `vs` combines `v` and `s`. +_Recovers the address that has signed a hash with `r` and `vs`, where `vs` combines `v` and `s`._ + +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`hash` | bytes32 | The keccak256 hash of the data signed. -|`r` | bytes32 | The first 32 bytes of the signature. -|`vs` | bytes32 | The combined `v` and `s` values of the signature. +| Name | Type | Description | +| ---- | ---- | ----------- | +| hash | bytes32 | The keccak256 hash of the data signed. | +| r | bytes32 | The first 32 bytes of the signature. | +| vs | bytes32 | The combined `v` and `s` values of the signature. | -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`signer`| address | The address of the signer. +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +signer | address | The address of the signer. | ### recover + ```solidity -function recover( - bytes32 hash, - bytes signature -) internal returns (address signer) +function recover(bytes32 hash, bytes signature) internal view returns (address signer) ``` -WARNING!!! +_WARNING!!! There is a known signature malleability issue with two representations of signatures! Even though this function is able to verify both standard 65-byte and compact 64-byte EIP-2098 signatures one should never use raw signatures for any kind of invalidation logic in their code. As the standard and compact representations are interchangeable any invalidation logic that relies on signature uniqueness will get rekt. -More info: https://github.com/OpenZeppelin/openzeppelin-contracts/security/advisories/GHSA-4h98-2769-gh6h -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`hash` | bytes32 | -|`signature` | bytes | - +More info: https://github.com/OpenZeppelin/openzeppelin-contracts/security/advisories/GHSA-4h98-2769-gh6h_ ### recoverOrIsValidSignature + ```solidity -function recoverOrIsValidSignature( - address signer, - bytes32 hash, - bytes signature -) internal returns (bool success) +function recoverOrIsValidSignature(address signer, bytes32 hash, bytes signature) internal view returns (bool success) ``` Verifies the signature for a hash, either by recovering the signer or using EIP-1271's `isValidSignature` function. -Attempts to recover the signer's address from the signature; if the address is non-zero, checks if it's valid according to EIP-1271. +_Attempts to recover the signer's address from the signature; if the address is non-zero, checks if it's valid according to EIP-1271._ + +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`signer` | address | The address to validate the signature against. -|`hash` | bytes32 | The hash of the signed data. -|`signature` | bytes | The signature to verify. +| Name | Type | Description | +| ---- | ---- | ----------- | +| signer | address | The address to validate the signature against. | +| hash | bytes32 | The hash of the signed data. | +| signature | bytes | The signature to verify. | -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`success`| bool | True if the signature is verified, false otherwise. +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +success | bool | True if the signature is verified, false otherwise. | ### recoverOrIsValidSignature + ```solidity -function recoverOrIsValidSignature( - address signer, - bytes32 hash, - uint8 v, - bytes32 r, - bytes32 s -) internal returns (bool success) +function recoverOrIsValidSignature(address signer, bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal view returns (bool success) ``` Verifies the signature for a hash, either by recovering the signer or using EIP-1271's `isValidSignature` function. -Attempts to recover the signer's address from the signature; if the address is non-zero, checks if it's valid according to EIP-1271. +_Attempts to recover the signer's address from the signature; if the address is non-zero, checks if it's valid according to EIP-1271._ -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`signer` | address | The address to validate the signature against. -|`hash` | bytes32 | The hash of the signed data. -|`v` | uint8 | The recovery byte of the signature. -|`r` | bytes32 | The first 32 bytes of the signature. -|`s` | bytes32 | The second 32 bytes of the signature. +#### Parameters -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`success`| bool | True if the signature is verified, false otherwise. +| Name | Type | Description | +| ---- | ---- | ----------- | +| signer | address | The address to validate the signature against. | +| hash | bytes32 | The hash of the signed data. | +| v | uint8 | The recovery byte of the signature. | +| r | bytes32 | The first 32 bytes of the signature. | +| s | bytes32 | The second 32 bytes of the signature. | + +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +success | bool | True if the signature is verified, false otherwise. | ### recoverOrIsValidSignature + ```solidity -function recoverOrIsValidSignature( - address signer, - bytes32 hash, - bytes32 r, - bytes32 vs -) internal returns (bool success) +function recoverOrIsValidSignature(address signer, bytes32 hash, bytes32 r, bytes32 vs) internal view returns (bool success) ``` Verifies the signature for a hash, either by recovering the signer or using EIP-1271's `isValidSignature` function. -Attempts to recover the signer's address from the signature; if the address is non-zero, checks if it's valid according to EIP-1271. +_Attempts to recover the signer's address from the signature; if the address is non-zero, checks if it's valid according to EIP-1271._ + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| signer | address | The address to validate the signature against. | +| hash | bytes32 | The hash of the signed data. | +| r | bytes32 | The first 32 bytes of the signature. | +| vs | bytes32 | The combined `v` and `s` values of the signature. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`signer` | address | The address to validate the signature against. -|`hash` | bytes32 | The hash of the signed data. -|`r` | bytes32 | The first 32 bytes of the signature. -|`vs` | bytes32 | The combined `v` and `s` values of the signature. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`success`| bool | True if the signature is verified, false otherwise. +| Name | Type | Description | +| ---- | ---- | ----------- | +success | bool | True if the signature is verified, false otherwise. | ### recoverOrIsValidSignature65 + ```solidity -function recoverOrIsValidSignature65( - address signer, - bytes32 hash, - bytes32 r, - bytes32 vs -) internal returns (bool success) +function recoverOrIsValidSignature65(address signer, bytes32 hash, bytes32 r, bytes32 vs) internal view returns (bool success) ``` Verifies the signature for a given hash, attempting to recover the signer's address or validates it using EIP-1271 for 65-byte signatures. -Attempts to recover the signer's address from the signature. If the address is a contract, checks if the signature is valid according to EIP-1271. +_Attempts to recover the signer's address from the signature. If the address is a contract, checks if the signature is valid according to EIP-1271._ + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| signer | address | The expected signer's address. | +| hash | bytes32 | The keccak256 hash of the signed data. | +| r | bytes32 | The first 32 bytes of the signature. | +| vs | bytes32 | The last 32 bytes of the signature, with the last byte being the recovery id. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`signer` | address | The expected signer's address. -|`hash` | bytes32 | The keccak256 hash of the signed data. -|`r` | bytes32 | The first 32 bytes of the signature. -|`vs` | bytes32 | The last 32 bytes of the signature, with the last byte being the recovery id. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`success`| bool | True if the signature is valid, false otherwise. +| Name | Type | Description | +| ---- | ---- | ----------- | +success | bool | True if the signature is valid, false otherwise. | ### isValidSignature + ```solidity -function isValidSignature( - address signer, - bytes32 hash, - bytes signature -) internal returns (bool success) +function isValidSignature(address signer, bytes32 hash, bytes signature) internal view returns (bool success) ``` Validates a signature for a hash using EIP-1271, if `signer` is a contract. -Makes a static call to `signer` with `isValidSignature` function selector from EIP-1271. +_Makes a static call to `signer` with `isValidSignature` function selector from EIP-1271._ + +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`signer` | address | The address of the signer to validate against, which could be an EOA or a contract. -|`hash` | bytes32 | The hash of the signed data. -|`signature` | bytes | The signature to validate. +| Name | Type | Description | +| ---- | ---- | ----------- | +| signer | address | The address of the signer to validate against, which could be an EOA or a contract. | +| hash | bytes32 | The hash of the signed data. | +| signature | bytes | The signature to validate. | -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`success`| bool | True if the signature is valid according to EIP-1271, false otherwise. +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +success | bool | True if the signature is valid according to EIP-1271, false otherwise. | ### isValidSignature + ```solidity -function isValidSignature( - address signer, - bytes32 hash, - uint8 v, - bytes32 r, - bytes32 s -) internal returns (bool success) +function isValidSignature(address signer, bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal view returns (bool success) ``` Validates a signature for a hash using EIP-1271, if `signer` is a contract. -Makes a static call to `signer` with `isValidSignature` function selector from EIP-1271. +_Makes a static call to `signer` with `isValidSignature` function selector from EIP-1271._ + +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`signer` | address | The address of the signer to validate against, which could be an EOA or a contract. -|`hash` | bytes32 | The hash of the signed data. -|`v` | uint8 | The recovery byte of the signature. -|`r` | bytes32 | The first 32 bytes of the signature. -|`s` | bytes32 | The second 32 bytes of the signature. +| Name | Type | Description | +| ---- | ---- | ----------- | +| signer | address | The address of the signer to validate against, which could be an EOA or a contract. | +| hash | bytes32 | The hash of the signed data. | +| v | uint8 | The recovery byte of the signature. | +| r | bytes32 | The first 32 bytes of the signature. | +| s | bytes32 | The second 32 bytes of the signature. | -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`success`| bool | True if the signature is valid according to EIP-1271, false otherwise. +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +success | bool | True if the signature is valid according to EIP-1271, false otherwise. | ### isValidSignature + ```solidity -function isValidSignature( - address signer, - bytes32 hash, - bytes32 r, - bytes32 vs -) internal returns (bool success) +function isValidSignature(address signer, bytes32 hash, bytes32 r, bytes32 vs) internal view returns (bool success) ``` Validates a signature for a hash using EIP-1271, if `signer` is a contract. -Makes a static call to `signer` with `isValidSignature` function selector from EIP-1271. +_Makes a static call to `signer` with `isValidSignature` function selector from EIP-1271._ -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`signer` | address | The address of the signer to validate against, which could be an EOA or a contract. -|`hash` | bytes32 | The hash of the signed data. -|`r` | bytes32 | The first 32 bytes of the signature. -|`vs` | bytes32 | The last 32 bytes of the signature, with the last byte being the recovery id. +#### Parameters -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`success`| bool | True if the signature is valid according to EIP-1271, false otherwise. +| Name | Type | Description | +| ---- | ---- | ----------- | +| signer | address | The address of the signer to validate against, which could be an EOA or a contract. | +| hash | bytes32 | The hash of the signed data. | +| r | bytes32 | The first 32 bytes of the signature. | +| vs | bytes32 | The last 32 bytes of the signature, with the last byte being the recovery id. | + +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +success | bool | True if the signature is valid according to EIP-1271, false otherwise. | ### isValidSignature65 + ```solidity -function isValidSignature65( - address signer, - bytes32 hash, - bytes32 r, - bytes32 vs -) internal returns (bool success) +function isValidSignature65(address signer, bytes32 hash, bytes32 r, bytes32 vs) internal view returns (bool success) ``` Verifies if a 65-byte signature is valid for a given hash, according to EIP-1271. +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`signer` | address | The address of the signer to validate against, which could be an EOA or a contract. -|`hash` | bytes32 | The hash of the signed data. -|`r` | bytes32 | The first 32 bytes of the signature. -|`vs` | bytes32 | The combined `v` (recovery id) and `s` component of the signature, packed into the last 32 bytes. +| Name | Type | Description | +| ---- | ---- | ----------- | +| signer | address | The address of the signer to validate against, which could be an EOA or a contract. | +| hash | bytes32 | The hash of the signed data. | +| r | bytes32 | The first 32 bytes of the signature. | +| vs | bytes32 | The combined `v` (recovery id) and `s` component of the signature, packed into the last 32 bytes. | -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`success`| bool | True if the signature is valid according to EIP-1271, false otherwise. +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +success | bool | True if the signature is valid according to EIP-1271, false otherwise. | ### toEthSignedMessageHash + ```solidity -function toEthSignedMessageHash( - bytes32 hash -) internal returns (bytes32 res) +function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 res) ``` Generates a hash compatible with Ethereum's signed message format. -Prepends the hash with Ethereum's message prefix before hashing it. +_Prepends the hash with Ethereum's message prefix before hashing it._ -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`hash` | bytes32 | The hash of the data to sign. +#### Parameters -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`res`| bytes32 | The Ethereum signed message hash. +| Name | Type | Description | +| ---- | ---- | ----------- | +| hash | bytes32 | The hash of the data to sign. | + +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +res | bytes32 | The Ethereum signed message hash. | ### toTypedDataHash + ```solidity -function toTypedDataHash( - bytes32 domainSeparator, - bytes32 structHash -) internal returns (bytes32 res) +function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 res) ``` Generates an EIP-712 compliant hash. -Encodes the domain separator and the struct hash according to EIP-712. +_Encodes the domain separator and the struct hash according to EIP-712._ + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| domainSeparator | bytes32 | The EIP-712 domain separator. | +| structHash | bytes32 | The EIP-712 struct hash. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`domainSeparator` | bytes32 | The EIP-712 domain separator. -|`structHash` | bytes32 | The EIP-712 struct hash. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`res`| bytes32 | The EIP-712 compliant hash. +| Name | Type | Description | +| ---- | ---- | ----------- | +res | bytes32 | The EIP-712 compliant hash. | diff --git a/docs/contracts/libraries/RevertReasonForwarder.md b/docs/contracts/libraries/RevertReasonForwarder.md index 46d7991d..002bc3a0 100644 --- a/docs/contracts/libraries/RevertReasonForwarder.md +++ b/docs/contracts/libraries/RevertReasonForwarder.md @@ -1,35 +1,34 @@ -# RevertReasonForwarder - -RevertReasonForwarder +## RevertReasonForwarder Provides utilities for forwarding and retrieving revert reasons from failed external calls. +### Functions list +- [reRevert() internal](#rerevert) +- [reReason() internal](#rereason) - -## Functions +### Functions ### reRevert + ```solidity -function reRevert( -) internal +function reRevert() internal pure ``` -Forwards the revert reason from the latest external call. -This method allows propagating the revert reason of a failed external call to the caller. - +_Forwards the revert reason from the latest external call. +This method allows propagating the revert reason of a failed external call to the caller._ ### reReason + ```solidity -function reReason( -) internal returns (bytes reason) +function reReason() internal pure returns (bytes reason) ``` -Retrieves the revert reason from the latest external call. -This method enables capturing the revert reason of a failed external call for inspection or processing. +_Retrieves the revert reason from the latest external call. +This method enables capturing the revert reason of a failed external call for inspection or processing._ +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`reason`| bytes | The latest external call revert reason. +| Name | Type | Description | +| ---- | ---- | ----------- | +reason | bytes | The latest external call revert reason. | diff --git a/docs/contracts/libraries/RevertReasonParser.md b/docs/contracts/libraries/RevertReasonParser.md index c69cc0a0..0da577d6 100644 --- a/docs/contracts/libraries/RevertReasonParser.md +++ b/docs/contracts/libraries/RevertReasonParser.md @@ -1,7 +1,5 @@ -# RevertReasonParser - -RevertReasonParser +## RevertReasonParser Library that allows to parse unsuccessful arbitrary calls revert reasons. See https://solidity.readthedocs.io/en/latest/control-structures.html#revert for details. @@ -10,29 +8,39 @@ if structured reverts appear in the future. All unsuccessful parsings get encoded as Unknown(data) string +### Functions list +- [parse(data, prefix) internal](#parse) +### Errors list +- [InvalidRevertReason() ](#invalidrevertreason) -## Functions +### Functions ### parse + ```solidity -function parse( - bytes data, - string prefix -) internal returns (string) +function parse(bytes data, string prefix) internal pure returns (string) ``` -Parses revert reason from failed calls, returning it with a `prefix`. -Handles standard `Error(string)` and `Panic(uint256)` formats, defaulting to `Unknown(data)` for unrecognized patterns. +_Parses revert reason from failed calls, returning it with a `prefix`. +Handles standard `Error(string)` and `Panic(uint256)` formats, defaulting to `Unknown(data)` for unrecognized patterns._ + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| data | bytes | The revert data to parse. | +| prefix | string | String to add before the parsed reason for context. | +#### Return Values -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`data` | bytes | The revert data to parse. -|`prefix` | string | String to add before the parsed reason for context. +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | string | The formatted revert reason. | -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`The`| string | formatted revert reason. +### Errors +### InvalidRevertReason + +```solidity +error InvalidRevertReason() +``` diff --git a/docs/contracts/libraries/SafeERC20.md b/docs/contracts/libraries/SafeERC20.md index d9564e09..73bb0c83 100644 --- a/docs/contracts/libraries/SafeERC20.md +++ b/docs/contracts/libraries/SafeERC20.md @@ -1,7 +1,5 @@ -# SafeERC20 - -Implements efficient safe methods for ERC20 interface. +## SafeERC20 Compared to the standard ERC20, this implementation offers several enhancements: 1. more gas-efficient, providing significant savings in transaction costs. @@ -9,276 +7,265 @@ Compared to the standard ERC20, this implementation offers several enhancements: 3. forceApprove functionality 4. support for WETH deposit and withdraw - - -## Functions +### Functions list +- [safeBalanceOf(token, account) internal](#safebalanceof) +- [safeTransferFromUniversal(token, from, to, amount, permit2) internal](#safetransferfromuniversal) +- [safeTransferFrom(token, from, to, amount) internal](#safetransferfrom) +- [safeTransferFromPermit2(token, from, to, amount) internal](#safetransferfrompermit2) +- [safeTransfer(token, to, value) internal](#safetransfer) +- [forceApprove(token, spender, value) internal](#forceapprove) +- [safeIncreaseAllowance(token, spender, value) internal](#safeincreaseallowance) +- [safeDecreaseAllowance(token, spender, value) internal](#safedecreaseallowance) +- [safePermit(token, permit) internal](#safepermit) +- [safePermit(token, owner, spender, permit) internal](#safepermit) +- [tryPermit(token, permit) internal](#trypermit) +- [tryPermit(token, owner, spender, permit) internal](#trypermit) +- [safeDeposit(weth, amount) internal](#safedeposit) +- [safeWithdraw(weth, amount) internal](#safewithdraw) +- [safeWithdrawTo(weth, amount, to) internal](#safewithdrawto) + +### Errors list +- [SafeTransferFailed() ](#safetransferfailed) +- [SafeTransferFromFailed() ](#safetransferfromfailed) +- [ForceApproveFailed() ](#forceapprovefailed) +- [SafeIncreaseAllowanceFailed() ](#safeincreaseallowancefailed) +- [SafeDecreaseAllowanceFailed() ](#safedecreaseallowancefailed) +- [SafePermitBadLength() ](#safepermitbadlength) +- [Permit2TransferAmountTooHigh() ](#permit2transferamounttoohigh) + +### Functions ### safeBalanceOf + ```solidity -function safeBalanceOf( - contract IERC20 token, - address account -) internal returns (uint256 tokenBalance) +function safeBalanceOf(contract IERC20 token, address account) internal view returns (uint256 tokenBalance) ``` Fetches the balance of a specific ERC20 token held by an account. Consumes less gas then regular `ERC20.balanceOf`. -Note that the implementation does not perform dirty bits cleaning, so it is the -responsibility of the caller to make sure that the higher 96 bits of the `account` parameter are clean. +_Note that the implementation does not perform dirty bits cleaning, so it is the +responsibility of the caller to make sure that the higher 96 bits of the `account` parameter are clean._ -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`token` | contract IERC20 | The IERC20 token contract for which the balance will be fetched. -|`account` | address | The address of the account whose token balance will be fetched. +#### Parameters -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`tokenBalance`| uint256 | The balance of the specified ERC20 token held by the account. +| Name | Type | Description | +| ---- | ---- | ----------- | +| token | contract IERC20 | The IERC20 token contract for which the balance will be fetched. | +| account | address | The address of the account whose token balance will be fetched. | + +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +tokenBalance | uint256 | The balance of the specified ERC20 token held by the account. | ### safeTransferFromUniversal + ```solidity -function safeTransferFromUniversal( - contract IERC20 token, - address from, - address to, - uint256 amount, - bool permit2 -) internal +function safeTransferFromUniversal(contract IERC20 token, address from, address to, uint256 amount, bool permit2) internal ``` Attempts to safely transfer tokens from one address to another. -If permit2 is true, uses the Permit2 standard; otherwise uses the standard ERC20 transferFrom. +_If permit2 is true, uses the Permit2 standard; otherwise uses the standard ERC20 transferFrom. Either requires `true` in return data, or requires target to be smart-contract and empty return data. Note that the implementation does not perform dirty bits cleaning, so it is the responsibility of -the caller to make sure that the higher 96 bits of the `from` and `to` parameters are clean. +the caller to make sure that the higher 96 bits of the `from` and `to` parameters are clean._ -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`token` | contract IERC20 | The IERC20 token contract from which the tokens will be transferred. -|`from` | address | The address from which the tokens will be transferred. -|`to` | address | The address to which the tokens will be transferred. -|`amount` | uint256 | The amount of tokens to transfer. -|`permit2` | bool | If true, uses the Permit2 standard for the transfer; otherwise uses the standard ERC20 transferFrom. +#### Parameters +| Name | Type | Description | +| ---- | ---- | ----------- | +| token | contract IERC20 | The IERC20 token contract from which the tokens will be transferred. | +| from | address | The address from which the tokens will be transferred. | +| to | address | The address to which the tokens will be transferred. | +| amount | uint256 | The amount of tokens to transfer. | +| permit2 | bool | If true, uses the Permit2 standard for the transfer; otherwise uses the standard ERC20 transferFrom. | ### safeTransferFrom + ```solidity -function safeTransferFrom( - contract IERC20 token, - address from, - address to, - uint256 amount -) internal +function safeTransferFrom(contract IERC20 token, address from, address to, uint256 amount) internal ``` Attempts to safely transfer tokens from one address to another using the ERC20 standard. -Either requires `true` in return data, or requires target to be smart-contract and empty return data. +_Either requires `true` in return data, or requires target to be smart-contract and empty return data. Note that the implementation does not perform dirty bits cleaning, so it is the responsibility of -the caller to make sure that the higher 96 bits of the `from` and `to` parameters are clean. +the caller to make sure that the higher 96 bits of the `from` and `to` parameters are clean._ -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`token` | contract IERC20 | The IERC20 token contract from which the tokens will be transferred. -|`from` | address | The address from which the tokens will be transferred. -|`to` | address | The address to which the tokens will be transferred. -|`amount` | uint256 | The amount of tokens to transfer. +#### Parameters +| Name | Type | Description | +| ---- | ---- | ----------- | +| token | contract IERC20 | The IERC20 token contract from which the tokens will be transferred. | +| from | address | The address from which the tokens will be transferred. | +| to | address | The address to which the tokens will be transferred. | +| amount | uint256 | The amount of tokens to transfer. | ### safeTransferFromPermit2 + ```solidity -function safeTransferFromPermit2( - contract IERC20 token, - address from, - address to, - uint256 amount -) internal +function safeTransferFromPermit2(contract IERC20 token, address from, address to, uint256 amount) internal ``` Attempts to safely transfer tokens from one address to another using the Permit2 standard. -Either requires `true` in return data, or requires target to be smart-contract and empty return data. +_Either requires `true` in return data, or requires target to be smart-contract and empty return data. Note that the implementation does not perform dirty bits cleaning, so it is the responsibility of -the caller to make sure that the higher 96 bits of the `from` and `to` parameters are clean. +the caller to make sure that the higher 96 bits of the `from` and `to` parameters are clean._ -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`token` | contract IERC20 | The IERC20 token contract from which the tokens will be transferred. -|`from` | address | The address from which the tokens will be transferred. -|`to` | address | The address to which the tokens will be transferred. -|`amount` | uint256 | The amount of tokens to transfer. +#### Parameters +| Name | Type | Description | +| ---- | ---- | ----------- | +| token | contract IERC20 | The IERC20 token contract from which the tokens will be transferred. | +| from | address | The address from which the tokens will be transferred. | +| to | address | The address to which the tokens will be transferred. | +| amount | uint256 | The amount of tokens to transfer. | ### safeTransfer + ```solidity -function safeTransfer( - contract IERC20 token, - address to, - uint256 value -) internal +function safeTransfer(contract IERC20 token, address to, uint256 value) internal ``` Attempts to safely transfer tokens to another address. -Either requires `true` in return data, or requires target to be smart-contract and empty return data. +_Either requires `true` in return data, or requires target to be smart-contract and empty return data. Note that the implementation does not perform dirty bits cleaning, so it is the responsibility of -the caller to make sure that the higher 96 bits of the `to` parameter are clean. +the caller to make sure that the higher 96 bits of the `to` parameter are clean._ -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`token` | contract IERC20 | The IERC20 token contract from which the tokens will be transferred. -|`to` | address | The address to which the tokens will be transferred. -|`value` | uint256 | The amount of tokens to transfer. +#### Parameters +| Name | Type | Description | +| ---- | ---- | ----------- | +| token | contract IERC20 | The IERC20 token contract from which the tokens will be transferred. | +| to | address | The address to which the tokens will be transferred. | +| value | uint256 | The amount of tokens to transfer. | ### forceApprove + ```solidity -function forceApprove( - contract IERC20 token, - address spender, - uint256 value -) internal +function forceApprove(contract IERC20 token, address spender, uint256 value) internal ``` Attempts to approve a spender to spend a certain amount of tokens. -If `approve(from, to, amount)` fails, it tries to set the allowance to zero, and retries the `approve` call. +_If `approve(from, to, amount)` fails, it tries to set the allowance to zero, and retries the `approve` call. Note that the implementation does not perform dirty bits cleaning, so it is the responsibility of -the caller to make sure that the higher 96 bits of the `spender` parameter are clean. +the caller to make sure that the higher 96 bits of the `spender` parameter are clean._ -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`token` | contract IERC20 | The IERC20 token contract on which the call will be made. -|`spender` | address | The address which will spend the funds. -|`value` | uint256 | The amount of tokens to be spent. +#### Parameters +| Name | Type | Description | +| ---- | ---- | ----------- | +| token | contract IERC20 | The IERC20 token contract on which the call will be made. | +| spender | address | The address which will spend the funds. | +| value | uint256 | The amount of tokens to be spent. | ### safeIncreaseAllowance + ```solidity -function safeIncreaseAllowance( - contract IERC20 token, - address spender, - uint256 value -) internal +function safeIncreaseAllowance(contract IERC20 token, address spender, uint256 value) internal ``` Safely increases the allowance of a spender. -Increases with safe math check. Checks if the increased allowance will overflow, if yes, then it reverts the transaction. +_Increases with safe math check. Checks if the increased allowance will overflow, if yes, then it reverts the transaction. Then uses `forceApprove` to increase the allowance. Note that the implementation does not perform dirty bits cleaning, so it is the responsibility of -the caller to make sure that the higher 96 bits of the `spender` parameter are clean. +the caller to make sure that the higher 96 bits of the `spender` parameter are clean._ -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`token` | contract IERC20 | The IERC20 token contract on which the call will be made. -|`spender` | address | The address which will spend the funds. -|`value` | uint256 | The amount of tokens to increase the allowance by. +#### Parameters +| Name | Type | Description | +| ---- | ---- | ----------- | +| token | contract IERC20 | The IERC20 token contract on which the call will be made. | +| spender | address | The address which will spend the funds. | +| value | uint256 | The amount of tokens to increase the allowance by. | ### safeDecreaseAllowance + ```solidity -function safeDecreaseAllowance( - contract IERC20 token, - address spender, - uint256 value -) internal +function safeDecreaseAllowance(contract IERC20 token, address spender, uint256 value) internal ``` Safely decreases the allowance of a spender. -Decreases with safe math check. Checks if the decreased allowance will underflow, if yes, then it reverts the transaction. +_Decreases with safe math check. Checks if the decreased allowance will underflow, if yes, then it reverts the transaction. Then uses `forceApprove` to increase the allowance. Note that the implementation does not perform dirty bits cleaning, so it is the responsibility of -the caller to make sure that the higher 96 bits of the `spender` parameter are clean. +the caller to make sure that the higher 96 bits of the `spender` parameter are clean._ -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`token` | contract IERC20 | The IERC20 token contract on which the call will be made. -|`spender` | address | The address which will spend the funds. -|`value` | uint256 | The amount of tokens to decrease the allowance by. +#### Parameters +| Name | Type | Description | +| ---- | ---- | ----------- | +| token | contract IERC20 | The IERC20 token contract on which the call will be made. | +| spender | address | The address which will spend the funds. | +| value | uint256 | The amount of tokens to decrease the allowance by. | ### safePermit + ```solidity -function safePermit( - contract IERC20 token, - bytes permit -) internal +function safePermit(contract IERC20 token, bytes permit) internal ``` Attempts to execute the `permit` function on the provided token with the sender and contract as parameters. Permit type is determined automatically based on permit calldata (IERC20Permit, IDaiLikePermit, and IPermit2). -Wraps `tryPermit` function and forwards revert reason if permit fails. +_Wraps `tryPermit` function and forwards revert reason if permit fails._ -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`token` | contract IERC20 | The IERC20 token to execute the permit function on. -|`permit` | bytes | The permit data to be used in the function call. +#### Parameters +| Name | Type | Description | +| ---- | ---- | ----------- | +| token | contract IERC20 | The IERC20 token to execute the permit function on. | +| permit | bytes | The permit data to be used in the function call. | ### safePermit + ```solidity -function safePermit( - contract IERC20 token, - address owner, - address spender, - bytes permit -) internal +function safePermit(contract IERC20 token, address owner, address spender, bytes permit) internal ``` Attempts to execute the `permit` function on the provided token with custom owner and spender parameters. Permit type is determined automatically based on permit calldata (IERC20Permit, IDaiLikePermit, and IPermit2). -Wraps `tryPermit` function and forwards revert reason if permit fails. +_Wraps `tryPermit` function and forwards revert reason if permit fails. Note that the implementation does not perform dirty bits cleaning, so it is the responsibility of -the caller to make sure that the higher 96 bits of the `owner` and `spender` parameters are clean. +the caller to make sure that the higher 96 bits of the `owner` and `spender` parameters are clean._ -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`token` | contract IERC20 | The IERC20 token to execute the permit function on. -|`owner` | address | The owner of the tokens for which the permit is made. -|`spender` | address | The spender allowed to spend the tokens by the permit. -|`permit` | bytes | The permit data to be used in the function call. +#### Parameters +| Name | Type | Description | +| ---- | ---- | ----------- | +| token | contract IERC20 | The IERC20 token to execute the permit function on. | +| owner | address | The owner of the tokens for which the permit is made. | +| spender | address | The spender allowed to spend the tokens by the permit. | +| permit | bytes | The permit data to be used in the function call. | ### tryPermit + ```solidity -function tryPermit( - contract IERC20 token, - bytes permit -) internal returns (bool success) +function tryPermit(contract IERC20 token, bytes permit) internal returns (bool success) ``` Attempts to execute the `permit` function on the provided token with the sender and contract as parameters. -Invokes `tryPermit` with sender as owner and contract as spender. +_Invokes `tryPermit` with sender as owner and contract as spender._ + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| token | contract IERC20 | The IERC20 token to execute the permit function on. | +| permit | bytes | The permit data to be used in the function call. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`token` | contract IERC20 | The IERC20 token to execute the permit function on. -|`permit` | bytes | The permit data to be used in the function call. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`success`| bool | Returns true if the permit function was successfully executed, false otherwise. +| Name | Type | Description | +| ---- | ---- | ----------- | +success | bool | Returns true if the permit function was successfully executed, false otherwise. | ### tryPermit + ```solidity -function tryPermit( - contract IERC20 token, - address owner, - address spender, - bytes permit -) internal returns (bool success) +function tryPermit(contract IERC20 token, address owner, address spender, bytes permit) internal returns (bool success) ``` The function attempts to call the permit function on a given ERC20 token. -The function is designed to support a variety of permit functions, namely: IERC20Permit, IDaiLikePermit, and IPermit2. +_The function is designed to support a variety of permit functions, namely: IERC20Permit, IDaiLikePermit, and IPermit2. It accommodates both Compact and Full formats of these permit types. Please note, it is expected that the `expiration` parameter for the compact Permit2 and the `deadline` parameter for the compact Permit are to be incremented by one before invoking this function. This approach is motivated by @@ -286,73 +273,109 @@ gas efficiency considerations; as the unlimited expiration period is likely to b zeros are cheaper to pass in terms of gas cost. Thus, callers should increment the expiration or deadline by one before invocation for optimized performance. Note that the implementation does not perform dirty bits cleaning, so it is the responsibility of -the caller to make sure that the higher 96 bits of the `owner` and `spender` parameters are clean. +the caller to make sure that the higher 96 bits of the `owner` and `spender` parameters are clean._ + +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`token` | contract IERC20 | The address of the ERC20 token on which to call the permit function. -|`owner` | address | The owner of the tokens. This address should have signed the off-chain permit. -|`spender` | address | The address which will be approved for transfer of tokens. -|`permit` | bytes | The off-chain permit data, containing different fields depending on the type of permit function. +| Name | Type | Description | +| ---- | ---- | ----------- | +| token | contract IERC20 | The address of the ERC20 token on which to call the permit function. | +| owner | address | The owner of the tokens. This address should have signed the off-chain permit. | +| spender | address | The address which will be approved for transfer of tokens. | +| permit | bytes | The off-chain permit data, containing different fields depending on the type of permit function. | -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`success`| bool | A boolean indicating whether the permit call was successful. +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +success | bool | A boolean indicating whether the permit call was successful. | ### safeDeposit + ```solidity -function safeDeposit( - contract IWETH weth, - uint256 amount -) internal +function safeDeposit(contract IWETH weth, uint256 amount) internal ``` Safely deposits a specified amount of Ether into the IWETH contract. Consumes less gas then regular `IWETH.deposit`. +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`weth` | contract IWETH | The IWETH token contract. -|`amount` | uint256 | The amount of Ether to deposit into the IWETH contract. - +| Name | Type | Description | +| ---- | ---- | ----------- | +| weth | contract IWETH | The IWETH token contract. | +| amount | uint256 | The amount of Ether to deposit into the IWETH contract. | ### safeWithdraw + ```solidity -function safeWithdraw( - contract IWETH weth, - uint256 amount -) internal +function safeWithdraw(contract IWETH weth, uint256 amount) internal ``` Safely withdraws a specified amount of wrapped Ether from the IWETH contract. Consumes less gas then regular `IWETH.withdraw`. -Uses inline assembly to interact with the IWETH contract. +_Uses inline assembly to interact with the IWETH contract._ -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`weth` | contract IWETH | The IWETH token contract. -|`amount` | uint256 | The amount of wrapped Ether to withdraw from the IWETH contract. +#### Parameters +| Name | Type | Description | +| ---- | ---- | ----------- | +| weth | contract IWETH | The IWETH token contract. | +| amount | uint256 | The amount of wrapped Ether to withdraw from the IWETH contract. | ### safeWithdrawTo + ```solidity -function safeWithdrawTo( - contract IWETH weth, - uint256 amount, - address to -) internal +function safeWithdrawTo(contract IWETH weth, uint256 amount, address to) internal ``` Safely withdraws a specified amount of wrapped Ether from the IWETH contract to a specified recipient. Consumes less gas then regular `IWETH.withdraw`. +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`weth` | contract IWETH | The IWETH token contract. -|`amount` | uint256 | The amount of wrapped Ether to withdraw from the IWETH contract. -|`to` | address | The recipient of the withdrawn Ether. +| Name | Type | Description | +| ---- | ---- | ----------- | +| weth | contract IWETH | The IWETH token contract. | +| amount | uint256 | The amount of wrapped Ether to withdraw from the IWETH contract. | +| to | address | The recipient of the withdrawn Ether. | +### Errors +### SafeTransferFailed + +```solidity +error SafeTransferFailed() +``` + +### SafeTransferFromFailed + +```solidity +error SafeTransferFromFailed() +``` + +### ForceApproveFailed + +```solidity +error ForceApproveFailed() +``` + +### SafeIncreaseAllowanceFailed + +```solidity +error SafeIncreaseAllowanceFailed() +``` + +### SafeDecreaseAllowanceFailed + +```solidity +error SafeDecreaseAllowanceFailed() +``` + +### SafePermitBadLength + +```solidity +error SafePermitBadLength() +``` + +### Permit2TransferAmountTooHigh + +```solidity +error Permit2TransferAmountTooHigh() +``` diff --git a/docs/contracts/libraries/StringUtil.md b/docs/contracts/libraries/StringUtil.md index a89bffb3..cd378a34 100644 --- a/docs/contracts/libraries/StringUtil.md +++ b/docs/contracts/libraries/StringUtil.md @@ -1,69 +1,71 @@ -# StringUtil +## StringUtil -StringUtil +_Library with gas-efficient string operations._ +### Functions list +- [toHex(value) internal](#tohex) +- [toHex(value) internal](#tohex) +- [toHex(data) internal](#tohex) -Library with gas-efficient string operations. - - -## Functions +### Functions ### toHex + ```solidity -function toHex( - uint256 value -) internal returns (string) +function toHex(uint256 value) internal pure returns (string) ``` Converts a uint256 value to its hexadecimal string representation. +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`value` | uint256 | The uint256 value to convert. +| Name | Type | Description | +| ---- | ---- | ----------- | +| value | uint256 | The uint256 value to convert. | -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`The`| string | hexadecimal string representation of the input value. +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | string | The hexadecimal string representation of the input value. | ### toHex + ```solidity -function toHex( - address value -) internal returns (string) +function toHex(address value) internal pure returns (string) ``` Converts an address to its hexadecimal string representation. +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`value` | address | The address to convert. +| Name | Type | Description | +| ---- | ---- | ----------- | +| value | address | The address to convert. | -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`The`| string | hexadecimal string representation of the input address. +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | string | The hexadecimal string representation of the input address. | ### toHex + ```solidity -function toHex( - bytes data -) internal returns (string result) +function toHex(bytes data) internal pure returns (string result) ``` -Converts arbitrary bytes to their hexadecimal string representation. +_Converts arbitrary bytes to their hexadecimal string representation. This is an assembly adaptation of highly optimized toHex16 code by Mikhail Vladimirov. -Reference: https://stackoverflow.com/a/69266989 +Reference: https://stackoverflow.com/a/69266989_ + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| data | bytes | The bytes to be converted to hexadecimal string. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`data` | bytes | The bytes to be converted to hexadecimal string. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`result`| string | The hexadecimal string representation of the input bytes. +| Name | Type | Description | +| ---- | ---- | ----------- | +result | string | The hexadecimal string representation of the input bytes. | diff --git a/docs/contracts/libraries/UniERC20.md b/docs/contracts/libraries/UniERC20.md index 1fefd8a6..d4c728fb 100644 --- a/docs/contracts/libraries/UniERC20.md +++ b/docs/contracts/libraries/UniERC20.md @@ -1,151 +1,194 @@ -# UniERC20 - -UniERC20 - - -Library to abstract the handling of ETH and ERC20 tokens, enabling unified interaction with both. It allows usage of ETH as ERC20. -Utilizes SafeERC20 for ERC20 interactions and provides additional utility functions. - - -## Functions +## UniERC20 + +_Library to abstract the handling of ETH and ERC20 tokens, enabling unified interaction with both. It allows usage of ETH as ERC20. +Utilizes SafeERC20 for ERC20 interactions and provides additional utility functions._ + +### Functions list +- [isETH(token) internal](#iseth) +- [uniBalanceOf(token, account) internal](#unibalanceof) +- [uniTransfer(token, to, amount) internal](#unitransfer) +- [uniTransferFrom(token, from, to, amount) internal](#unitransferfrom) +- [uniSymbol(token) internal](#unisymbol) +- [uniName(token) internal](#uniname) +- [uniApprove(token, to, amount) internal](#uniapprove) + +### Errors list +- [InsufficientBalance() ](#insufficientbalance) +- [ApproveCalledOnETH() ](#approvecalledoneth) +- [NotEnoughValue() ](#notenoughvalue) +- [FromIsNotSender() ](#fromisnotsender) +- [ToIsNotThis() ](#toisnotthis) +- [ETHTransferFailed() ](#ethtransferfailed) + +### Functions ### isETH + ```solidity -function isETH( - contract IERC20 token -) internal returns (bool) +function isETH(contract IERC20 token) internal pure returns (bool) ``` -Determines if the specified token is ETH. +_Determines if the specified token is ETH._ -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`token` | contract IERC20 | The token to check. +#### Parameters -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`bool`| bool | True if the token is ETH, false otherwise. +| Name | Type | Description | +| ---- | ---- | ----------- | +| token | contract IERC20 | The token to check. | + +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | bool | bool True if the token is ETH, false otherwise. | ### uniBalanceOf + ```solidity -function uniBalanceOf( - contract IERC20 token, - address account -) internal returns (uint256) +function uniBalanceOf(contract IERC20 token, address account) internal view returns (uint256) ``` -Retrieves the balance of the specified token for an account. +_Retrieves the balance of the specified token for an account._ + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| token | contract IERC20 | The token to query the balance of. | +| account | address | The address of the account. | -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`token` | contract IERC20 | The token to query the balance of. -|`account` | address | The address of the account. +#### Return Values -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`uint256`| uint256 | The balance of the token for the specified account. +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | uint256 | uint256 The balance of the token for the specified account. | ### uniTransfer + ```solidity -function uniTransfer( - contract IERC20 token, - address payable to, - uint256 amount -) internal +function uniTransfer(contract IERC20 token, address payable to, uint256 amount) internal ``` -Transfers a specified amount of the token to a given address. -Note: Does nothing if the amount is zero. +_Transfers a specified amount of the token to a given address. +Note: Does nothing if the amount is zero._ -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`token` | contract IERC20 | The token to transfer. -|`to` | address payable | The address to transfer the token to. -|`amount` | uint256 | The amount of the token to transfer. +#### Parameters +| Name | Type | Description | +| ---- | ---- | ----------- | +| token | contract IERC20 | The token to transfer. | +| to | address payable | The address to transfer the token to. | +| amount | uint256 | The amount of the token to transfer. | ### uniTransferFrom + ```solidity -function uniTransferFrom( - contract IERC20 token, - address payable from, - address to, - uint256 amount -) internal +function uniTransferFrom(contract IERC20 token, address payable from, address to, uint256 amount) internal ``` -Transfers a specified amount of the token from one address to another. -Note: Does nothing if the amount is zero. +_Transfers a specified amount of the token from one address to another. +Note: Does nothing if the amount is zero._ -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`token` | contract IERC20 | The token to transfer. -|`from` | address payable | The address to transfer the token from. -|`to` | address | The address to transfer the token to. -|`amount` | uint256 | The amount of the token to transfer. +#### Parameters +| Name | Type | Description | +| ---- | ---- | ----------- | +| token | contract IERC20 | The token to transfer. | +| from | address payable | The address to transfer the token from. | +| to | address | The address to transfer the token to. | +| amount | uint256 | The amount of the token to transfer. | ### uniSymbol + ```solidity -function uniSymbol( - contract IERC20 token -) internal returns (string) +function uniSymbol(contract IERC20 token) internal view returns (string) ``` -Retrieves the symbol from ERC20 metadata of the specified token. +_Retrieves the symbol from ERC20 metadata of the specified token._ -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`token` | contract IERC20 | The token to retrieve the symbol of. +#### Parameters -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`string`| string | The symbol of the token. +| Name | Type | Description | +| ---- | ---- | ----------- | +| token | contract IERC20 | The token to retrieve the symbol of. | + +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | string | string The symbol of the token. | ### uniName + ```solidity -function uniName( - contract IERC20 token -) internal returns (string) +function uniName(contract IERC20 token) internal view returns (string) ``` -Retrieves the name from ERC20 metadata of the specified token. +_Retrieves the name from ERC20 metadata of the specified token._ -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`token` | contract IERC20 | The token to retrieve the name of. +#### Parameters -#### Return Values: -| Name | Type | Description | -| :----------------------------- | :------------ | :--------------------------------------------------------------------------- | -|`string`| string | The name of the token. +| Name | Type | Description | +| ---- | ---- | ----------- | +| token | contract IERC20 | The token to retrieve the name of. | + +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +[0] | string | string The name of the token. | ### uniApprove + +```solidity +function uniApprove(contract IERC20 token, address to, uint256 amount) internal +``` + +_forceApprove the specified amount of the token to a given address. +Reverts if the token is ETH._ + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| token | contract IERC20 | The token to approve. | +| to | address | The address to approve the token to. | +| amount | uint256 | The amount of the token to approve. | + +### Errors +### InsufficientBalance + +```solidity +error InsufficientBalance() +``` + +### ApproveCalledOnETH + +```solidity +error ApproveCalledOnETH() +``` + +### NotEnoughValue + ```solidity -function uniApprove( - contract IERC20 token, - address to, - uint256 amount -) internal +error NotEnoughValue() ``` -forceApprove the specified amount of the token to a given address. -Reverts if the token is ETH. +### FromIsNotSender + +```solidity +error FromIsNotSender() +``` -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`token` | contract IERC20 | The token to approve. -|`to` | address | The address to approve the token to. -|`amount` | uint256 | The amount of the token to approve. +### ToIsNotThis +```solidity +error ToIsNotThis() +``` + +### ETHTransferFailed + +```solidity +error ETHTransferFailed() +``` diff --git a/docs/contracts/mixins/BySig.md b/docs/contracts/mixins/BySig.md index 7e791b4e..05439d8b 100644 --- a/docs/contracts/mixins/BySig.md +++ b/docs/contracts/mixins/BySig.md @@ -1,203 +1,136 @@ -# BySig +## BySig -Mixin that provides signature-based accessibility to every external method of the smart contract. +_Inherit your contract from this mixin and use `_msgSender()` instead of `msg.sender` everywhere._ +### Types list +- [SignedCall](#signedcall) -Inherit your contract from this mixin and use `_msgSender()` instead of `msg.sender` everywhere. +### Functions list +- [bySigAccountNonces(account) public](#bysigaccountnonces) +- [bySigSelectorNonces(account, selector) public](#bysigselectornonces) +- [bySigUniqueNonces(account, nonce) public](#bysiguniquenonces) +- [bySigUniqueNoncesSlot(account, nonce) public](#bysiguniquenoncesslot) +- [hashBySig(sig) public](#hashbysig) +- [bySig(signer, sig, signature) public](#bysig) +- [sponsoredCall(token, amount, data, extraData) public](#sponsoredcall) +- [_chargeSigner(signer, relayer, token, amount, extraData) internal](#_chargesigner) +- [useBySigAccountNonce(advance) public](#usebysigaccountnonce) +- [useBySigSelectorNonce(selector, advance) public](#usebysigselectornonce) +- [useBySigUniqueNonce(nonce) public](#usebysiguniquenonce) +- [_msgSender() internal](#_msgsender) -## Derives -- [EIP712](https://docs.openzeppelin.com/contracts/3.x/api/utils/cryptography#EIP712) -- [IERC5267](https://docs.openzeppelin.com/contracts/3.x/api/interfaces#IERC5267) -- [Context](https://docs.openzeppelin.com/contracts/3.x/api/utils#Context) +### Errors list +- [WrongNonce() ](#wrongnonce) +- [WrongRelayer() ](#wrongrelayer) +- [WrongSignature() ](#wrongsignature) +- [DeadlineExceeded() ](#deadlineexceeded) + +### Types +### SignedCall -## Functions -### bySigAccountNonces ```solidity -function bySigAccountNonces( - address account -) public returns (uint256) +struct SignedCall { + BySigTraits.Value traits; + bytes data; +} ``` +### Functions +### bySigAccountNonces -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`account` | address | - - -### bySigSelectorNonces ```solidity -function bySigSelectorNonces( - address account, - bytes4 selector -) public returns (uint256) +function bySigAccountNonces(address account) public view returns (uint256) ``` +### bySigSelectorNonces -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`account` | address | -|`selector` | bytes4 | - - -### bySigUniqueNonces ```solidity -function bySigUniqueNonces( - address account, - uint256 nonce -) public returns (bool) +function bySigSelectorNonces(address account, bytes4 selector) public view returns (uint256) ``` +### bySigUniqueNonces -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`account` | address | -|`nonce` | uint256 | - - -### bySigUniqueNoncesSlot ```solidity -function bySigUniqueNoncesSlot( - address account, - uint256 nonce -) public returns (uint256) +function bySigUniqueNonces(address account, uint256 nonce) public view returns (bool) ``` +### bySigUniqueNoncesSlot -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`account` | address | -|`nonce` | uint256 | - - -### hashBySig ```solidity -function hashBySig( - struct BySig.SignedCall sig -) public returns (bytes32) +function bySigUniqueNoncesSlot(address account, uint256 nonce) public view returns (uint256) ``` +### hashBySig -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`sig` | struct BySig.SignedCall | - - -### bySig ```solidity -function bySig( - address signer, - struct BySig.SignedCall sig, - bytes signature -) public returns (bytes ret) +function hashBySig(struct BySig.SignedCall sig) public view returns (bytes32) ``` +### bySig -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`signer` | address | -|`sig` | struct BySig.SignedCall | -|`signature` | bytes | - - -### sponsoredCall ```solidity -function sponsoredCall( - address token, - uint256 amount, - bytes data, - bytes extraData -) public returns (bytes ret) +function bySig(address signer, struct BySig.SignedCall sig, bytes signature) public payable returns (bytes ret) ``` +### sponsoredCall -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`token` | address | -|`amount` | uint256 | -|`data` | bytes | -|`extraData` | bytes | - - -### _chargeSigner ```solidity -function _chargeSigner( - address signer, - address relayer, - address token, - uint256 amount, - bytes extraData -) internal +function sponsoredCall(address token, uint256 amount, bytes data, bytes extraData) public payable returns (bytes ret) ``` +### _chargeSigner -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`signer` | address | -|`relayer` | address | -|`token` | address | -|`amount` | uint256 | -|`extraData` | bytes | - +```solidity +function _chargeSigner(address signer, address relayer, address token, uint256 amount, bytes extraData) internal virtual +``` ### useBySigAccountNonce + ```solidity -function useBySigAccountNonce( - uint32 advance -) public +function useBySigAccountNonce(uint32 advance) public ``` +### useBySigSelectorNonce -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`advance` | uint32 | +```solidity +function useBySigSelectorNonce(bytes4 selector, uint32 advance) public +``` +### useBySigUniqueNonce -### useBySigSelectorNonce ```solidity -function useBySigSelectorNonce( - bytes4 selector, - uint32 advance -) public +function useBySigUniqueNonce(uint256 nonce) public ``` +### _msgSender -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`selector` | bytes4 | -|`advance` | uint32 | +```solidity +function _msgSender() internal view virtual returns (address) +``` +### Errors +### WrongNonce -### useBySigUniqueNonce ```solidity -function useBySigUniqueNonce( - uint256 nonce -) public +error WrongNonce() ``` +### WrongRelayer -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`nonce` | uint256 | +```solidity +error WrongRelayer() +``` +### WrongSignature -### _msgSender ```solidity -function _msgSender( -) internal returns (address) +error WrongSignature() ``` +### DeadlineExceeded - +```solidity +error DeadlineExceeded() +``` diff --git a/docs/contracts/mixins/EthReceiver.md b/docs/contracts/mixins/EthReceiver.md index 4bf357bf..7e6fd29c 100644 --- a/docs/contracts/mixins/EthReceiver.md +++ b/docs/contracts/mixins/EthReceiver.md @@ -1,30 +1,40 @@ -# EthReceiver +## EthReceiver -EthReceiver +_Abstract contract for rejecting direct ETH transfers from EOAs. +Implements a custom error and logic to reject ETH deposits from non-contract addresses._ +### Functions list +- [receive() external](#receive) +- [_receive() internal](#_receive) -Abstract contract for rejecting direct ETH transfers from EOAs. -Implements a custom error and logic to reject ETH deposits from non-contract addresses. +### Errors list +- [EthDepositRejected() ](#ethdepositrejected) - -## Functions +### Functions ### receive + ```solidity -function receive( -) external +receive() external payable ``` -External payable function to receive ETH, automatically rejects deposits from EOAs. - +_External payable function to receive ETH, automatically rejects deposits from EOAs._ ### _receive + ```solidity -function _receive( -) internal +function _receive() internal virtual ``` -Internal function containing the logic to reject ETH deposits. -Can be overridden by derived contracts for specific behaviors while maintaining the base rejection mechanism. +_Internal function containing the logic to reject ETH deposits. +Can be overridden by derived contracts for specific behaviors while maintaining the base rejection mechanism._ + +### Errors +### EthDepositRejected + +```solidity +error EthDepositRejected() +``` +_Error thrown when an ETH deposit from an EOA is attempted._ diff --git a/docs/contracts/mixins/OnlyWethReceiver.md b/docs/contracts/mixins/OnlyWethReceiver.md index c8e0238c..b4b42571 100644 --- a/docs/contracts/mixins/OnlyWethReceiver.md +++ b/docs/contracts/mixins/OnlyWethReceiver.md @@ -1,38 +1,34 @@ -# OnlyWethReceiver +## OnlyWethReceiver -OnlyWethReceiver +_Abstract contract extending EthReceiver to accept only ETH deposits from a specified WETH contract. +This contract ensures that only wrapped ETH (WETH) can be deposited, rejecting all other direct ETH transfers._ +### Functions list +- [constructor(weth) internal](#constructor) +- [_receive() internal](#_receive) -Abstract contract extending EthReceiver to accept only ETH deposits from a specified WETH contract. -This contract ensures that only wrapped ETH (WETH) can be deposited, rejecting all other direct ETH transfers. - -## Derives -- [EthReceiver](mixins/EthReceiver.md) - -## Functions +### Functions ### constructor + ```solidity -function constructor( - address weth -) internal +constructor(address weth) internal ``` -Sets the WETH contract address during construction. +_Sets the WETH contract address during construction._ -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`weth` | address | Address of the WETH contract. +#### Parameters +| Name | Type | Description | +| ---- | ---- | ----------- | +| weth | address | Address of the WETH contract. | ### _receive + ```solidity -function _receive( -) internal +function _receive() internal virtual ``` -Overrides _receive to restrict ETH transfers solely to the WETH contract. -Reverts with EthDepositRejected if ETH is sent from any other address. - +_Overrides _receive to restrict ETH transfers solely to the WETH contract. +Reverts with EthDepositRejected if ETH is sent from any other address._ diff --git a/docs/contracts/mixins/PermitAndCall.md b/docs/contracts/mixins/PermitAndCall.md index 1fa5e0eb..c292ede9 100644 --- a/docs/contracts/mixins/PermitAndCall.md +++ b/docs/contracts/mixins/PermitAndCall.md @@ -1,28 +1,24 @@ -# PermitAndCall +## PermitAndCall -PermitAndCall +_Abstract contract to support permit and action execution in a single transaction. +Allows tokens that implement EIP-2612 permits, DAI-like permits, USDC-like permits and Permit2 to be approved and spent in a single transaction._ +### Functions list +- [permitAndCall(permit, action) external](#permitandcall) -Abstract contract to support permit and action execution in a single transaction. -Allows tokens that implement EIP-2612 permits, DAI-like permits, USDC-like permits and Permit2 to be approved and spent in a single transaction. - - -## Functions +### Functions ### permitAndCall + ```solidity -function permitAndCall( - bytes permit, - bytes action -) external +function permitAndCall(bytes permit, bytes action) external payable ``` Executes a permit for an ERC20 token and then a specified action in a single transaction. +#### Parameters -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`permit` | bytes | ERC20 token address (20 bytes) concatinated with the permit data, allowing this contract to spend the token. Format: [token address (20 bytes)][permit data] -|`action` | bytes | The data representing the action to be executed after the permit. - +| Name | Type | Description | +| ---- | ---- | ----------- | +| permit | bytes | ERC20 token address (20 bytes) concatinated with the permit data, allowing this contract to spend the token. Format: [token address (20 bytes)][permit data] | +| action | bytes | The data representing the action to be executed after the permit. | diff --git a/docs/contracts/mixins/SelfdestructEthSender.md b/docs/contracts/mixins/SelfdestructEthSender.md index bc37d7fc..c40a3208 100644 --- a/docs/contracts/mixins/SelfdestructEthSender.md +++ b/docs/contracts/mixins/SelfdestructEthSender.md @@ -1,32 +1,20 @@ -# SelfdestructEthSender +## SelfdestructEthSender +### Functions list +- [constructor() internal](#constructor) +- [stopAndTransferBalance(receiver) external](#stopandtransferbalance) - - - - -## Functions +### Functions ### constructor + ```solidity -function constructor( -) internal +constructor() internal ``` - - - ### stopAndTransferBalance + ```solidity -function stopAndTransferBalance( - address payable receiver -) external +function stopAndTransferBalance(address payable receiver) external ``` - -#### Parameters: -| Name | Type | Description | -| :--- | :--- | :------------------------------------------------------------------- | -|`receiver` | address payable | - -