* Install open zeppelin contracts
* Init foundry in governance
* Add wrapped ZRX token
* Add governance contracts testing to CI
* Set optimizer runs to default
* Upgrade to patched version of openzeppelin/contracts
* Test stakingakng / unwrapping ZRX
* Init npm package
* Lint fix, removing lib from gitignore
* Add openzeppelin contracts git submodule for foundry
* Add vanilla governor contract
* Fix reference paths to imported packages
* Temporarily switch to using a mocked version of ZRX
* Ignore foundry's lib in link checker
* Fix a conflict in gitignore between forge lib adn built lib
* Upload governance code coverage report to coveralls
* Flesh out test scenarios for wrapping/unwrapping
* Add basic ERC20 name and symbol tests
* Wire in basic timelock controller and governor test setup
* Test basic governor properties
* Add basic voting power delegation tests
* Add proposal execution happy path test
* Split ERC20Votes logic between wrapped token
and ZeroExVotes contracts
* Exclude BaseTest from coverage in coveralls
* Add protocol specific governor with produciton governance settings
* Add a dedicated instance for the treasury governor
This is currently using the default 1 token 1 vote mechanism but will be migrated
* Add test for updating governance settings
for voting delay, voting period and proposal threshold
* Create seperate timelock contract instance for treasury and protocol
* Test updating the timlock min delay
* Set timelock delay to 2 days for protocol and 1 sec for treasury
* Remove timelock from treasury governor
* Refactor _checkpointsLookup to return entire Checkpoint
instad of just number of votes
* Update the totalSupply checkpoints updating logic
* Quadratic voting power transfers and delegations
* Fix workflow yaml
* Initialise ZeroExVotes behind a ERC1967Proxy
Test it cannot be reinitialised
* Remove obsoleted console.logs from test
* Storage pack Checkpoint enum
* Remove keeping track of total balances for voting
* Switch to using the foundry artifact in test
* Fix rebase issue
* Add timelock control over the treasury governor
* Add test for wrapped token transfer
* Emit separate events for changing linear and quadratic voting power
* Add the ability to cancel a proposal
* Limit the governors' cancel function to security council only
* Eject security council after a proposal is cancelled
* Add ability for governance to set the security council
* Merge the governors test suites into one reusable set of tests
* Add an empty test function to base test contract
to remove it from coverage reports. Fudge but no other way to ignore it in report
* Security council can rollback protocol upgrades
* Upgrade to solidity 0.8.19
* Move IZeroExGovernor to src
* Abstract Security council interface into its own
* Emit events when assigning and ejecting the security council
* Use a cast to bytes4 instead of LibBytes
Co-authored-by: duncancmt <1207590+duncancmt@users.noreply.github.com>
* Writing total supply checkpoints and setup of
quorum percentage of quadratic total supply for treasure governor
* Add test for transferring tokens when delegating
* Rename IZeroExSecurityCouncil to ISecurityCouncil
* Add security council restrictions to governors
* Remove obsolete overflow check
* Improve test coverage
* Upgrade open-zeppelin contracts to 4.8.2
* Test delegation by signature
* Test non security council requests
to rollback protocol changes cannot be executed
* Better revert messages
* Test correct interfaces are supported
* Remove obsoleted funciton
* Further test delegation by signature scenario
* Split the delegation functionality tests
* Add test for initialisation of voting contract
* Add test for reading checkpoints
* Update code comments
* Fix compilation warnings
* Run smt checker
* Add checkpoint tests
* Rename parameter in moveEntireVotingPower to match the one in movePartialVotingPower
* Switch moveEntireVotingPower to a more generic moveVotingPower implementation
as in the open-zeppelin contracts
* Install foundry earlier in CI
* Switch movePartialVotingPower to the generic moveVotingPower implementation
* Write totalSupplyCheckpoints via the generic _writeCheckpoint
* Add threshold for quadratic voting power
* Remove autoinserted code by OZ
* Add openzeppelin/contracts-upgradable
* Add initializable base to Voting contract
* Fix terminogy error in natspec
* Fix code comment
* Remove obsoleted overrides and add a missing modifier to moveVotingPower
* Remove amount check
Co-authored-by: duncancmt <1207590+duncancmt@users.noreply.github.com>
* Fix a calculation error and clean tests
* Update thresholds for treasury governor
* Fix testShouldNotBeAbleToDelegateWithSignatureAfterExpiry
* Update from @duncancmt
without "memory-safe" the IR optimizer produces significantly worse code and it disables the stack limit evader
Co-authored-by: duncancmt <1207590+duncancmt@users.noreply.github.com>
* Add onlyProxy to initializer
* Fix quadratic voting weight base
* Rename voting parameter for clarity
* Make addresses immutable (#680)
* Make addresses immutable
* Fix linting issues
---------
Co-authored-by: elenadimitrova <elena@arenabg.com>
* Prevent griefing by a malicious ZeroExVotes upgrade (#681)
* Gas optimization
* Minimal change to prevent malicious ZeroExVotes from griefing
* Add demonstration of griefing upgrade
* Fix rebase issues with tests
* Fix prettier issues
* Add checks to test
---------
Co-authored-by: elenadimitrova <elena@arenabg.com>
* Rename SecurityCouncil contract
* Add timestamp to delegator balance updates
* Make quadraticThreshold `immutable` for gas efficiency
* Remove the logic for ejecting security council
* Switch balance timestamp to be a block number
* Test votes migration for adding a new vote weight mechanism (#674)
* Add Emacs files to .gitignore
* Make some functions unproected to demonstrate a migration
* Add example (broken) migration
* Add migration test for voting logic
* Try to simplify tests
* Fix compilation errors
* Fix underflow test with new logic
* Flesh out migration test for voting
* Replace cube root library
* Fix stack too deep in coverage
---------
Co-authored-by: elenadimitrova <elena@arenabg.com>
* Change test case to testFail
* Update contracts/governance/test/ZeroExVotesMigration.sol
Co-authored-by: duncancmt <1207590+duncancmt@users.noreply.github.com>
---------
Co-authored-by: duncancmt <1207590+duncancmt@users.noreply.github.com>
Co-authored-by: Duncan Townsend <git@duncancmt.com>
* Strip erc20 package of legacy nonsense and add foundry basics
* Make foundry build
* Remove obsoleted test/UntransferrableDummyERC20Token.sol contract
* Remove obsoleted ERC20 lib variant contracts
* Remove obsoleted DummyMultipleReturnERC20Token and DummyNoReturnERC20Token contracts
* Move test contract to dedicated folder
and remove obsoleted TypeScript contract wrappers
* Remove src/interfaces/IEtherToken.sol only used in
v3 staking which is being obsoleted [skip ci]
* Add foundry test for token
* Migrate ZRX token tests to foundry
* Fix paths to erc20 contracts
* Remove obsoleted references
* Pin erc20-contracts package on treasury
* Ignore foundry imports in link checker
* Run only forge tests for erc20 contracts
* Remove DummyERC20Token and its dependencies
* Merge IERC20TokenV06 and IERC20TokenV08
into range pragma to cover solidity 0.6.5 to 0.8.x
* Merge IEtherTokenV06 and IEtherTokenV08
into range pragma to cover solidity 0.6.5 to 0.8.x
* Migrate weth9 tests to foundry
* Upload code coverage for erc20 package
* Update changelog
* Fix review comments
Co-authored-by: duncancmt <1207590+duncancmt@users.noreply.github.com>
---------
Co-authored-by: duncancmt <1207590+duncancmt@users.noreply.github.com>
* Update coveralls link to point to protocol repo coverage
* Remove obsoleted ignores in .gitignore
* Run forge coverage in CI and upload results to coveralls
* Remove unused wrapper
* Remove legacy coverage setup
* Remove lcov-result-merger
* Add base-path setting to coverallsapp in CI
* Add check-md package and command
* Remove broken references to TESTING.md
* Fix broken link in contributing.md
* Fix staking docs headings
* Add checks for broken links to CI
* Add solhint and basic configuration
* Add solhint-plugin-prettier to run prettier via solhint
* Remove all solhint-disable rules in contracts
* Turn off compiler version errors
* Fix max-line-length linter errors
* Fix linting and prettier issues in contracts
* Add global lint command to run both ts and solidity linter
* add prettier-solidity + config
* run prettier
* update lockfile
* run prettier again
* Prettier missed one /:
* keep bridge adapter the same
* yarn prettier
* replace tslint with eslint + add eslintrc config
* few more missing packages for eslint
* exclude. now eslint is running (but there are errors)
* correct excludes fixes all the linter issues
* no need for max warnings
* Update package.jsons to latest tools packages
* Skip tests relying on gasPrice > 0
* Yarn.lock
* Fix linter
* Update Balance checker, new ganache gets more ETH
* Fix new Ganache insufficient assertion string
* Temporarily set QuoteRequestor to skip
* Fix headers Axios now requests with
* Draft. PoC pseudo code showing general idea for resuing SOR path creation logic and adding multihop support.
* Add actual Balancer SDK function calls.
* Update to handle buys.
* Correct taker>maker for buy.
* Draft. PoC pseudo code showing general idea for resuing SOR path creation logic and adding multihop support.
* make it build
* rebase
* add BalancerV2Batch protocol
* add BalancerV2Batch protocol
* get balancer v2 multihop working
* fix BalancerV2Batch for sells (buys still iffy)
* fix buys, appease linter and prettier
* remove unused RPC URL from balancer sdk construction
* update changelogs
* clean up comments
add event loop yield in `BalancerV2SwapInfoCache.loadTopPools()`
* add negative result check on balancerv2batch swap output
* compiler hack
* reintroduce CompilerHack
* delete unused multibridge sampler
* remove compilerhack
* reintroduce compilerhack
* try to fix CI compile errors
* plz work
* plz work
* pretty plz work
* yay it works, also address feedback
* appease linter
* deploy new FQTs
Co-authored-by: johngrantuk <johngrantuk@googlemail.com>
Co-authored-by: Lawrence Forman <me@merklejerk.com>
* feat: calculate all routes and VIP only routes in a single router call
* fix: Try to disable using fallback orders for quotes with native orders
* fix: create VIP sources set once per routing call
* chore: use private publish version of neon-router to test
* chore(lint): comment out unused fn _addOptionalFallbackAsync
* chore: update to latest private publish of neon-router
* refactor: fix router metrics beforeTimeMs naming
* feat: don't recompute isVip for ever sample of a source
* chore: update neon-router to real published version
* fix: merge conflict resolution issue
* chore: add asset-swapper changelog entry
* Add Geist on Fantom
* nvm there is not subgraph for it
* finish giest utils
* Address pr comments
* lowercase gtoken addresses
* return undefined instead of error for unsupported pairs
* another lower case
* Update fantom fillQuoteTransformer address
* more const clean up
* feat: scale oversized native orders to quote amount for fake samples
* chore: temporarily use private publish neon-router version
* fix: short circuit 1 base unit trades to avoid router error
* chore: use published version of `neon-router`
* chore: add changelog entry for asset-swapper
* feat: use Rust router estimated output amount when possible
* fix: use strings for sample ids, and increase samples in the rust router
* fix: remove unnecessary interpolation of out of range values
* fix: don't recalculate sampled dist sum in a loop
* fix: use 14 samples for rust router to work around interpolation issues
* fix: unintentional logic change
* fix: remove local dev plotting param from route fn call
* feat: make neon-router number of samples configurable
* chore: bump to newly published neon-router version
* fix: handle insufficient liquidity at all requested sources
* chore: update asset-swapper changelog
* feat: integrate Rust router with asset-swapper WIP
* fix: produce outputFees in the format the Rust router expects
* fix: correct output fee calc and only use the rust router for sells
* fix: make sure numbers sent to the rust router are integers
* hack: try to debug why rust router output is being overestimated WIP
* refactor: clean up router debugging code
* fix: don't use negative output fees for sells
* feat: try VIP sources in isolation and compare with routing all sources
* fix: adjust for FQT overhead when choosing between VIP, all sources WIP
* fix: pass gasPrice to path_optimizer for EP overhead calculations
* feat: buy support with the Rust Router WIP
* chore: WIP commit trying to get buys working
* refactor: use samples instead of fills for the Rust router
* feat: add vip handling hack to sample based routing
* fix: revert to 200 samplings for rust router when using pure samples
* refactor: remove old hacky Path based Rust code, add back feature toggle
* fix: scale both fill output and adjustedOutput my same factor as input
* feat: initial plumbing for supporting RFQ/Limit orders
* fix: incorrect bump of input amount by one base unit before routing
* fix: add fake samples for rfq/limit orders to fulfill the 3 sample req
* fix pass rfq orders in the correct format to the rust router
* chore: remove debugging logs and clean up code & comments
* fix: use published version of @0x/neon-router
* hack: scale routed amounts to account for precision loss of number/f64
* refactor: clean up code and address initial review comments
* fix: only remove trailing 0 output samples before passing to the router
* refactor: consolidate eth to output token calc into ethToOutputAmount fn
* fix: interpolate input between samples on output amount instead of price
* fix: return no path when we have no samples, add sanity asserts
* refactor: fix interpolation comment wording
* fix: remove double adjusted source route input amount
* chore: update changelog for asset-swapper