diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 550c23c..290bfc7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,13 +15,13 @@ repos: entry: forge fmt exclude: "^lib/" pass_filenames: true - - id: doc - name: Generate documentation - description: Generate docs with `forge doc` - language: system - # generates docs and unstages files if only the commit hash changed within the file, this way only when the documentation is updated, the documentation needs to be regenerated and only the changed files are pushed - entry: "script/util/doc_gen.sh" - pass_filenames: false + # - id: doc + # name: Generate documentation + # description: Generate docs with `forge doc` + # language: system + # # generates docs and unstages files if only the commit hash changed within the file, this way only when the documentation is updated, the documentation needs to be regenerated and only the changed files are pushed + # entry: "script/util/doc_gen.sh" + # pass_filenames: false - repo: https://github.com/pre-commit/mirrors-prettier rev: "v3.0.3" hooks: diff --git a/docs/autogen/.gitignore b/docs/autogen/.gitignore deleted file mode 100644 index 4e42a1b..0000000 --- a/docs/autogen/.gitignore +++ /dev/null @@ -1 +0,0 @@ -book/ \ No newline at end of file diff --git a/docs/autogen/book.css b/docs/autogen/book.css deleted file mode 100644 index b5ce903..0000000 --- a/docs/autogen/book.css +++ /dev/null @@ -1,13 +0,0 @@ -table { - margin: 0 auto; - border-collapse: collapse; - width: 100%; -} - -table td:first-child { - width: 15%; -} - -table td:nth-child(2) { - width: 25%; -} \ No newline at end of file diff --git a/docs/autogen/book.toml b/docs/autogen/book.toml deleted file mode 100644 index 468d8c9..0000000 --- a/docs/autogen/book.toml +++ /dev/null @@ -1,12 +0,0 @@ -[book] -src = "src" -title = "" - -[output.html] -no-section-label = true -additional-js = ["solidity.min.js"] -additional-css = ["book.css"] -git-repository-url = "https://github.com/Uniswap/sc-allocators" - -[output.html.fold] -enable = true diff --git a/docs/autogen/solidity.min.js b/docs/autogen/solidity.min.js deleted file mode 100644 index 1924932..0000000 --- a/docs/autogen/solidity.min.js +++ /dev/null @@ -1,74 +0,0 @@ -hljs.registerLanguage("solidity",(()=>{"use strict";function e(){try{return!0 -}catch(e){return!1}} -var a=/-?(\b0[xX]([a-fA-F0-9]_?)*[a-fA-F0-9]|(\b[1-9](_?\d)*(\.((\d_?)*\d)?)?|\.\d(_?\d)*)([eE][-+]?\d(_?\d)*)?|\b0)(?!\w|\$)/ -;e()&&(a=a.source.replace(/\\b/g,"(?{ -var a=r(e),o=l(e),c=/[A-Za-z_$][A-Za-z_$0-9.]*/,d=e.inherit(e.TITLE_MODE,{ -begin:/[A-Za-z$_][0-9A-Za-z$_]*/,lexemes:c,keywords:n}),u={className:"params", -begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,lexemes:c,keywords:n, -contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,a,o,s]},_={ -className:"operator",begin:/:=|->/};return{keywords:n,lexemes:c, -contains:[a,o,i,t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,s,_,{ -className:"function",lexemes:c,beginKeywords:"function",end:"{",excludeEnd:!0, -contains:[d,u,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,_]}]}}, -solAposStringMode:r,solQuoteStringMode:l,HEX_APOS_STRING_MODE:i, -HEX_QUOTE_STRING_MODE:t,SOL_NUMBER:s,isNegativeLookbehindAvailable:e} -;const{baseAssembly:c,solAposStringMode:d,solQuoteStringMode:u,HEX_APOS_STRING_MODE:_,HEX_QUOTE_STRING_MODE:m,SOL_NUMBER:b,isNegativeLookbehindAvailable:E}=o -;return e=>{for(var a=d(e),s=u(e),n=[],i=0;i<32;i++)n[i]=i+1 -;var t=n.map((e=>8*e)),r=[];for(i=0;i<=80;i++)r[i]=i -;var l=n.map((e=>"bytes"+e)).join(" ")+" ",o=t.map((e=>"uint"+e)).join(" ")+" ",g=t.map((e=>"int"+e)).join(" ")+" ",M=[].concat.apply([],t.map((e=>r.map((a=>e+"x"+a))))),p={ -keyword:"var bool string int uint "+g+o+"byte bytes "+l+"fixed ufixed "+M.map((e=>"fixed"+e)).join(" ")+" "+M.map((e=>"ufixed"+e)).join(" ")+" enum struct mapping address new delete if else for while continue break return throw emit try catch revert unchecked _ function modifier event constructor fallback receive error virtual override constant immutable anonymous indexed storage memory calldata external public internal payable pure view private returns import from as using pragma contract interface library is abstract type assembly", -literal:"true false wei gwei szabo finney ether seconds minutes hours days weeks years", -built_in:"self this super selfdestruct suicide now msg block tx abi blockhash gasleft assert require Error Panic sha3 sha256 keccak256 ripemd160 ecrecover addmod mulmod log0 log1 log2 log3 log4" -},O={className:"operator",begin:/[+\-!~*\/%<>&^|=]/ -},C=/[A-Za-z_$][A-Za-z_$0-9]*/,N={className:"params",begin:/\(/,end:/\)/, -excludeBegin:!0,excludeEnd:!0,lexemes:C,keywords:p, -contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,a,s,b,"self"]},f={ -begin:/\.\s*/,end:/[^A-Za-z0-9$_\.]/,excludeBegin:!0,excludeEnd:!0,keywords:{ -built_in:"gas value selector address length push pop send transfer call callcode delegatecall staticcall balance code codehash wrap unwrap name creationCode runtimeCode interfaceId min max" -},relevance:2},y=e.inherit(e.TITLE_MODE,{begin:/[A-Za-z$_][0-9A-Za-z$_]*/, -lexemes:C,keywords:p}),w={className:"built_in", -begin:(E()?"(? :warning: This is an early-stage contract under active development; it has not yet been properly tested, reviewed, or audited. - -#### Table of Contents - -- [Setup](#setup) -- [Allocators](#allocators) -- [Deployment](#deployment) -- [Docs](#docs) -- [Contributing](#contributing) - -## Setup - -Follow these steps to set up your local environment: - -- [Install foundry](https://book.getfoundry.sh/getting-started/installation) -- Install dependencies: `forge install` -- Build contracts: `forge build` -- Test contracts: `forge test` - -If you intend to develop on this repo, follow the steps outlined in [CONTRIBUTING.md](CONTRIBUTING.md#install). - -## Allocators - -The allocators are designed to be used with the [The Compact](https://github.com/uniswap/the-compact). Their purpose is to ensure that locked tokens are available to claim for fillers within the promised expiration time. This repository contains multiple allocators, each with different features: - -- [ServerAllocator](src/allocators/ServerAllocator.sol): The ServerAllocator stands as an on chain verification contract for a server based allocator. It is ready for the callbacks of the [The Compact](https://github.com/uniswap/the-compact) during a claim and verifies the allocator signatures have been signed by an authorized address. It does not keep track of any locked down tokens, but instead relies on the server to do so. -- [SimpleAllocator](src/allocators/SimpleAllocator.sol): A simple, fully decentralized allocator that allows for a single claim per token. This means the contract will lock down all tokens of a sponsor for an id for a single claim, so it is not possible to start multiple claims for the same sponsor and id at the same time. The contract does though keep track of the amount of locked tokens and so it will faithfully attest for a transfer of those, even during an ongoing claim. The contract is a good starting point when learning about allocators and it is kept very simple on purpose to learn about the concept of an allocator or use this contract as a template. To be used in production, the contract would require the ability to work with witness data, since a real cross chain swap will always require a witness besides the Compact. An example implementation of a witness allocator can be found [here](src/allocators/SimpleWitnessAllocator.sol). -- [SimpleWitnessAllocator](src/allocators/SimpleWitnessAllocator.sol): This contract enhances the [SimpleAllocator](src/allocators/SimpleAllocator.sol) with the ability of processing witness data besides the Compact. This makes it a much more production ready allocator. -- [SimpleERC7683Allocator](src/allocators/SimpleERC7683Allocator.sol): This contract enhances the [SimpleAllocator](src/allocators/SimpleAllocator.sol) and making it compatible with the [ERC7683](https://eips.ethereum.org/EIPS/eip-7683) standard. The Allocator therefor also becomes a [IOriginSettler](src/interfaces/ERC7683/IOriginSettler.sol) and converts a OnchainCrossChainOrder to a `Compact`/`BatchCompact` and a `Claim` / `Mendate` as required by the tribunal on the target chain. - -## Deployment - -This repo utilizes versioned deployments. For more information on how to use forge scripts within the repo, check [here](CONTRIBUTING.md#deployment). - -Smart contracts are deployed or upgraded using the following command: - -```shell -forge script script/Deploy.s.sol --broadcast --rpc-url --verify -``` - -## Docs - -The documentation and architecture diagrams for the contracts within this repo can be found [here](docs/). -Detailed documentation generated from the NatSpec documentation of the contracts can be found [here](docs/autogen/src/src/). -When exploring the contracts within this repository, it is recommended to start with the interfaces first and then move on to the implementation as outlined [here](CONTRIBUTING.md#natspec--comments) - -## Contributing - -If you want to contribute to this project, please check [CONTRIBUTING.md](CONTRIBUTING.md) first. diff --git a/docs/autogen/src/SUMMARY.md b/docs/autogen/src/SUMMARY.md deleted file mode 100644 index 5c4f8ff..0000000 --- a/docs/autogen/src/SUMMARY.md +++ /dev/null @@ -1,22 +0,0 @@ -# Summary -- [Home](README.md) -# src - - [❱ allocators](src/allocators/README.md) - - [❱ types](src/allocators/types/README.md) - - [Claim](src/allocators/types/TribunalStructs.sol/struct.Claim.md) - - [Mandate](src/allocators/types/TribunalStructs.sol/struct.Mandate.md) - - [ERC7683Allocator](src/allocators/ERC7683Allocator.sol/contract.ERC7683Allocator.md) - - [ServerAllocator](src/allocators/ServerAllocator.sol/contract.ServerAllocator.md) - - [SimpleAllocator](src/allocators/SimpleAllocator.sol/contract.SimpleAllocator.md) - - [SimpleWitnessAllocator](src/allocators/SimpleWitnessAllocator.sol/contract.SimpleWitnessAllocator.md) - - [❱ interfaces](src/interfaces/README.md) - - [❱ ERC7683](src/interfaces/ERC7683/README.md) - - [IOriginSettler](src/interfaces/ERC7683/IOriginSettler.sol/interface.IOriginSettler.md) - - [IAllocator](src/interfaces/IAllocator.sol/interface.IAllocator.md) - - [IERC7683Allocator](src/interfaces/IERC7683Allocator.sol/interface.IERC7683Allocator.md) - - [IServerAllocator](src/interfaces/IServerAllocator.sol/interface.IServerAllocator.md) - - [ISimpleAllocator](src/interfaces/ISimpleAllocator.sol/interface.ISimpleAllocator.md) - - [ISimpleWitnessAllocator](src/interfaces/ISimpleWitnessAllocator.sol/interface.ISimpleWitnessAllocator.md) - - [❱ test](src/test/README.md) - - [ERC20Mock](src/test/ERC20Mock.sol/contract.ERC20Mock.md) - - [TheCompactMock](src/test/TheCompactMock.sol/contract.TheCompactMock.md) diff --git a/docs/autogen/src/src/README.md b/docs/autogen/src/src/README.md deleted file mode 100644 index f8a3b7c..0000000 --- a/docs/autogen/src/src/README.md +++ /dev/null @@ -1,6 +0,0 @@ - - -# Contents -- [allocators](/src/allocators) -- [interfaces](/src/interfaces) -- [test](/src/test) diff --git a/docs/autogen/src/src/interfaces/README.md b/docs/autogen/src/src/interfaces/README.md deleted file mode 100644 index a2fabca..0000000 --- a/docs/autogen/src/src/interfaces/README.md +++ /dev/null @@ -1,9 +0,0 @@ - - -# Contents -- [ERC7683](/src/interfaces/ERC7683) -- [IAllocator](IAllocator.sol/interface.IAllocator.md) -- [IERC7683Allocator](IERC7683Allocator.sol/interface.IERC7683Allocator.md) -- [IServerAllocator](IServerAllocator.sol/interface.IServerAllocator.md) -- [ISimpleAllocator](ISimpleAllocator.sol/interface.ISimpleAllocator.md) -- [ISimpleWitnessAllocator](ISimpleWitnessAllocator.sol/interface.ISimpleWitnessAllocator.md)