diff --git a/README.md b/README.md index 9c9529a..3b4f8eb 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,19 @@ scopelint spec This command will use the names of the contract's unit tests to generate a human readable spec. It will list each contract, its constituent functions, and the human readable description of functionality each unit test aims to assert. +### Audits + +The UniStaker, V3FactoryOwner, and DelegationSurrogate contracts have been extensively audited. The reports for these audits can be found in the [/audits](/audits/) directory. + +### Deployments + +Production deployments of these contracts are available at the following addresses on Ethereum mainnet: + +|Contract|Address| +|--------|-------| +|UniStaker|[0xE3071e87a7E6dD19A911Dbf1127BA9dD67Aa6fc8](https://etherscan.io/address/0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8#code)| +|V3FactoryOwner|[0x2e27332b25Ce245F6628377bc83573A001313C58](https://etherscan.io/address/0x2e27332b25ce245f6628377bc83573a001313c58)| + ## License The code in this repository is licensed under the [GNU Affero General Public License](LICENSE) unless otherwise indicated. diff --git a/audits/2024_02_UniStaker_ToB_Report.pdf b/audits/2024_02_UniStaker_ToB_Report.pdf new file mode 100644 index 0000000..5859a98 Binary files /dev/null and b/audits/2024_02_UniStaker_ToB_Report.pdf differ diff --git a/audits/2024_03_UniStaker_Code4rena Contest.md b/audits/2024_03_UniStaker_Code4rena Contest.md new file mode 100644 index 0000000..34455be --- /dev/null +++ b/audits/2024_03_UniStaker_Code4rena Contest.md @@ -0,0 +1,1241 @@ +--- +sponsor: "Uniswap Foundation" +slug: "2024-02-uniswap-foundation" +date: "2024-04-11" +title: "UniStaker Infrastructure" +findings: "https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues" +contest: 336 +--- + +# Overview + +## About C4 + +Code4rena (C4) is an open organization consisting of security researchers, auditors, developers, and individuals with domain expertise in smart contracts. + +A C4 audit is an event in which community participants, referred to as Wardens, review, audit, or analyze smart contract logic in exchange for a bounty provided by sponsoring projects. + +During the audit outlined in this document, C4 conducted an analysis of the UniStaker Infrastructure smart contract system written in Solidity. The audit took place between February 23 — March 5, 2024. + +## Wardens + +54 Wardens contributed reports to UniStaker Infrastructure: + + 1. [CodeWasp](https://code4rena.com/@CodeWasp) ([slylandro\_star](https://code4rena.com/@slylandro_star), [kuprum](https://code4rena.com/@kuprum), [audithare](https://code4rena.com/@audithare) and [spaghetticode\_sentinel](https://code4rena.com/@spaghetticode_sentinel)) + 2. [Al-Qa-qa](https://code4rena.com/@Al-Qa-qa) + 3. [DadeKuma](https://code4rena.com/@DadeKuma) + 4. [Trust](https://code4rena.com/@Trust) + 5. [0xlemon](https://code4rena.com/@0xlemon) + 6. [Shield](https://code4rena.com/@Shield) ([Viraz](https://code4rena.com/@Viraz), [0xA5DF](https://code4rena.com/@0xA5DF), [Dravee](https://code4rena.com/@Dravee) and [Udsen](https://code4rena.com/@Udsen)) + 7. [lsaudit](https://code4rena.com/@lsaudit) + 8. [Breeje](https://code4rena.com/@Breeje) + 9. [osmanozdemir1](https://code4rena.com/@osmanozdemir1) + 10. [SpicyMeatball](https://code4rena.com/@SpicyMeatball) + 11. [peanuts](https://code4rena.com/@peanuts) + 12. [Aamir](https://code4rena.com/@Aamir) + 13. [ZanyBonzy](https://code4rena.com/@ZanyBonzy) + 14. [AlexCzm](https://code4rena.com/@AlexCzm) + 15. [0xdice91](https://code4rena.com/@0xdice91) + 16. [gesha17](https://code4rena.com/@gesha17) + 17. [marchev](https://code4rena.com/@marchev) + 18. [kutugu](https://code4rena.com/@kutugu) + 19. [haxatron](https://code4rena.com/@haxatron) + 20. [cheatc0d3](https://code4rena.com/@cheatc0d3) + 21. [visualbits](https://code4rena.com/@visualbits) + 22. [radev\_sw](https://code4rena.com/@radev_sw) + 23. [imare](https://code4rena.com/@imare) + 24. [nnez](https://code4rena.com/@nnez) + 25. [PetarTolev](https://code4rena.com/@PetarTolev) + 26. [BAHOZ](https://code4rena.com/@BAHOZ) + 27. [Bauchibred](https://code4rena.com/@Bauchibred) + 28. [jesjupyter](https://code4rena.com/@jesjupyter) + 29. [twicek](https://code4rena.com/@twicek) + 30. [Fassi\_Security](https://code4rena.com/@Fassi_Security) ([bronze\_pickaxe](https://code4rena.com/@bronze_pickaxe) and [mxuse](https://code4rena.com/@mxuse)) + 31. [merlinboii](https://code4rena.com/@merlinboii) + 32. [roguereggiant](https://code4rena.com/@roguereggiant) + 33. [hunter\_w3b](https://code4rena.com/@hunter_w3b) + 34. [kaveyjoe](https://code4rena.com/@kaveyjoe) + 35. [McToady](https://code4rena.com/@McToady) + 36. [Sathish9098](https://code4rena.com/@Sathish9098) + 37. [0xepley](https://code4rena.com/@0xepley) + 38. [fouzantanveer](https://code4rena.com/@fouzantanveer) + 39. [hassanshakeel13](https://code4rena.com/@hassanshakeel13) + 40. [MSK](https://code4rena.com/@MSK) + 41. [LinKenji](https://code4rena.com/@LinKenji) + 42. [SAQ](https://code4rena.com/@SAQ) + 43. [Myd](https://code4rena.com/@Myd) + 44. [ihtishamsudo](https://code4rena.com/@ihtishamsudo) + 45. [emerald7017](https://code4rena.com/@emerald7017) + 46. [aariiif](https://code4rena.com/@aariiif) + 47. [cudo](https://code4rena.com/@cudo) + +This audit was judged by [0xTheC0der](https://code4rena.com/@0xTheC0der). + +Final report assembled by [thebrittfactor](https://twitter.com/brittfactorC4). + +# Summary + +The C4 analysis yielded an aggregated total of 0 unique vulnerabilities. + +Additionally, C4 analysis included 31 reports detailing issues with a risk rating of LOW severity or non-critical. + +All of the issues presented here are linked back to their original finding. + +# Scope + +The code under review can be found within the [C4 UniStaker Infrastructure repository](https://github.com/code-423n4/2024-02-uniswap-foundation), and is composed of 7 smart contracts written in the Solidity programming language and includes 557 lines of Solidity code. + +In addition to the known issues identified by the project team, a Code4rena bot race was conducted at the start of the audit. The winning bot, **LightChaser** from warden ChaseTheLight, generated the [Automated Findings report](https://github.com/code-423n4/2024-02-uniswap-foundation/blob/main/bot-report.md) and all findings therein were classified as out of scope. + +# Severity Criteria + +C4 assesses the severity of disclosed vulnerabilities based on three primary risk categories: high, medium, and low/non-critical. + +High-level considerations for vulnerabilities span the following key areas when conducting assessments: + +- Malicious Input Handling +- Escalation of privileges +- Arithmetic +- Gas use + +For more information regarding the severity criteria referenced throughout the submission review process, please refer to the documentation provided on [the C4 website](https://code4rena.com), specifically our section on [Severity Categorization](https://docs.code4rena.com/awarding/judging-criteria/severity-categorization). + +# Low Risk and Non-Critical Issues + +For this audit, 31 reports were submitted by wardens detailing low risk and non-critical issues. The [report highlighted below](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/299) by **CodeWasp** received the top score from the judge. + +*The following wardens also submitted reports: [DadeKuma](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/380), [Trust](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/331), [0xlemon](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/255), [Shield](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/169), [lsaudit](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/168), [Breeje](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/107), [Al-Qa-qa](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/90), [osmanozdemir1](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/45), [SpicyMeatball](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/8), [AlexCzm](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/415), [peanuts](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/414), [0xdice91](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/413), [gesha17](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/410), [Aamir](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/409), [marchev](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/379), [kutugu](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/372), [haxatron](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/368), [cheatc0d3](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/355), [visualbits](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/345), [radev\_sw](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/237), [imare](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/230), [nnez](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/201), [ZanyBonzy](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/151), [PetarTolev](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/141), [BAHOZ](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/130), [Bauchibred](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/115), [jesjupyter](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/99), [twicek](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/73), [Fassi\_Security](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/67), and [merlinboii](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/59).* + +## [01] Adapting UniStaker test infrastructure to UNI token + +Current testing infrastructure for UniStaker includes fuzz and integration tests which employ mocks for the governance token, in particular [test/mocks/MockERC20Votes.sol](https://github.com/code-423n4/2024-02-uniswap-foundation/blob/5a2761c8277541a24bc551fbd624413b384bea94/test/mocks/MockERC20Votes.sol). The sponsors have confirmed in the Discord audit channel though that exclusively the [currently deployed UNI token](https://etherscan.io/token/0x1f9840a85d5af5bf1d1762f925bdaddc4201f984#code) will be used as the governance token. In light of that information, it should be noted that `MockERC20Votes.sol` is a very crude approximation of the functionality contained in `Uni.sol`. In particular, the latter: + +- Allows token holders to delegate their voting power directly, via the `delegate()` method. +- Employs a non-trivial accounting scheme for delegated votes, indexed according to block numbers. +- Is written using Solidity 0.5.16 compiler, and moreover, restricts many of its underlying datatypes to `uint96` / `uint32`. + +Moreover, the current UniStaker testing infrastructure doesn't try to test for the correct votes accounting at all, although it's a crucial aspect of integrating `UniStaker` with the currently deployed `UNI` token. Taking this into account, we've undertaken the steps to integrate `UNI` token into the `UniStaker` testing, of which activity we report below. In particular, we: + +- Ported `Uni.sol` from Solidity 0.5.16 to Solidity 0.8.23. +- Adjusted the tests in `UniStaker.t.sol` such that they pass when used with `Uni.sol` instead of `MockERC20Votes.sol`. +- Added some assertions to `UniStaker.t.sol` to track for voting power in tests. +- Wrote a handler around `Uni.sol`, `Uni.handler.sol`, which allows to call for its most important user-facing methods from Foundry fuzz/invariant tester. +- Performed necessary adaptations to `UniStaker.handler.sol`, to integrate `UNI` and avoid failing tests due to a low-level foundry function. +- Extended `UniStaker.invariants.t.sol` with an additional invariant, `invariant_Total_stake_plus_direct_delegations_equals_current_votes`, which captures the relation between the voting power delegated directly through users and via UniStaker surrogates. +- Extended the helper library `AddressSet.sol`, to be able to track external user delegations. +- Made necessary changes to `foundry.toml` to make the project compile, and run a reasonable amount of fuzz/invariant tests. + +While these activities have not allowed us to catch any critical vulnerabilities, they did allow us to identify and fix many implicit assumptions in the testing infrastructure that made it incompatible with the real `UNI` token, and not the mock. We also have been able to identify and fix a few false positives, i.e. the tests that were failing due to the deficiencies in the tests themselves. We hope that our efforts will help the UniSwap developers in seamlessly integrating their new staking contracts with the currently deployed ones. + +All of the added/modified files are available in [this gist](https://gist.github.com/kuprumion/b7b0e03ea52ff925d0f9a9a4dcd7116f). + +## [02] A port of `Uni.sol` from Solidity 0.5.16 to Solidity 0.8.23 + +This is the simplest of undertaken activities, which amounted in fixing a couple of incompatibilities between the compiler versions, disabling some checks which were not compatible with the current test suite (like minting restrictions), and adding the `DOMAIN_SEPARATOR()` function required by tests. The changes between the [deployed UNI token](https://etherscan.io/token/0x1f9840a85d5af5bf1d1762f925bdaddc4201f984#code) and the adaptation are summarized in the diff below: + +```diff +--- test/mocks/Uni.sol.orig 2024-03-04 13:51:22.540178698 +0100 ++++ test/mocks/Uni.sol 2024-03-04 14:22:43.058757812 +0100 +@@ -1,4 +1,8 @@ +-pragma solidity ^0.5.16; ++// Adaptation of the UNI code from https://etherscan.io/token/0x1f9840a85d5af5bf1d1762f925bdaddc4201f984#code ++// To make the tests pass. For the original version see "Uni.sol.orig" ++pragma solidity 0.8.23; + pragma experimental ABIEncoderV2; + ++import {IERC20Delegates} from "src/interfaces/IERC20Delegates.sol"; ++ + // From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol +@@ -188,3 +192,3 @@ + +-contract Uni { ++contract Uni is IERC20Delegates { + /// @notice EIP-20 token name for this token +@@ -293,4 +297,4 @@ + function mint(address dst, uint rawAmount) external { +- require(msg.sender == minter, "Uni::mint: only the minter can mint"); +- require(block.timestamp >= mintingAllowedAfter, "Uni::mint: minting not allowed yet"); ++ // require(msg.sender == minter, "Uni::mint: only the minter can mint"); ++ // require(block.timestamp >= mintingAllowedAfter, "Uni::mint: minting not allowed yet"); + require(dst != address(0), "Uni::mint: cannot transfer to the zero address"); +@@ -302,3 +306,3 @@ + uint96 amount = safe96(rawAmount, "Uni::mint: amount exceeds 96 bits"); +- require(amount <= SafeMath.div(SafeMath.mul(totalSupply, mintCap), 100), "Uni::mint: exceeded mint cap"); ++ // require(amount <= SafeMath.div(SafeMath.mul(totalSupply, mintCap), 100), "Uni::mint: exceeded mint cap"); + totalSupply = safe96(SafeMath.add(totalSupply, amount), "Uni::mint: totalSupply exceeds 96 bits"); +@@ -333,4 +337,4 @@ + uint96 amount; +- if (rawAmount == uint(-1)) { +- amount = uint96(-1); ++ if (rawAmount == type(uint).max) { ++ amount = type(uint96).max; + } else { +@@ -345,2 +349,6 @@ + ++ function DOMAIN_SEPARATOR() external view virtual returns (bytes32) { ++ return keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this))); ++ } ++ + /** +@@ -357,4 +365,4 @@ + uint96 amount; +- if (rawAmount == uint(-1)) { +- amount = uint96(-1); ++ if (rawAmount == type(uint).max) { ++ amount = type(uint96).max; + } else { +@@ -369,3 +377,3 @@ + require(signatory == owner, "Uni::permit: unauthorized"); +- require(now <= deadline, "Uni::permit: signature expired"); ++ require(block.timestamp <= deadline, "Uni::permit: signature expired"); + +@@ -409,3 +417,3 @@ + +- if (spender != src && spenderAllowance != uint96(-1)) { ++ if (spender != src && spenderAllowance != type(uint96).max) { + uint96 newAllowance = sub96(spenderAllowance, amount, "Uni::transferFrom: transfer amount exceeds spender allowance"); +@@ -444,3 +452,3 @@ + require(nonce == nonces[signatory]++, "Uni::delegateBySig: invalid nonce"); +- require(now <= expiry, "Uni::delegateBySig: signature expired"); ++ require(block.timestamp <= expiry, "Uni::delegateBySig: signature expired"); + return _delegate(signatory, delegatee); +@@ -572,3 +580,3 @@ + +- function getChainId() internal pure returns (uint) { ++ function getChainId() internal view returns (uint) { + uint256 chainId; +``` + +## [03] Adjustment of the tests in `UniStaker.t.sol` to use `Uni.sol` instead of `MockERC20Votes.sol` + +We don't list here the whole diff, only the most important parts of it; also omitting duplicate changes in multiple places. + +### Preamble and set up: replace `ERC20VotesMock` with `Uni`** + +```diff +diff --git a/test/UniStaker.t.sol b/test/UniStaker.t.sol +index 89124f8..22e0534 100644 +--- a/test/UniStaker.t.sol ++++ b/test/UniStaker.t.sol +@@ -9,2 +9,3 @@ import {ERC20Fake} from "test/fakes/ERC20Fake.sol"; + import {PercentAssertions} from "test/helpers/PercentAssertions.sol"; ++import {Uni} from "test/mocks/Uni.sol"; + +@@ -12,3 +13,3 @@ contract UniStakerTest is Test, PercentAssertions { + ERC20Fake rewardToken; +- ERC20VotesMock govToken; ++ Uni govToken; + address admin; +@@ -38,4 +39,6 @@ contract UniStakerTest is Test, PercentAssertions { + +- govToken = new ERC20VotesMock(); ++ admin = makeAddr("admin"); ++ govToken = new Uni(admin, admin, 2000); + vm.label(address(govToken), "Governance Token"); ++ _jumpAhead(1234); + +@@ -44,4 +47,2 @@ contract UniStakerTest is Test, PercentAssertions { + +- admin = makeAddr("admin"); +- + uniStaker = new UniStakerHarness(rewardToken, govToken, admin); +@@ -61,3 +62,3 @@ contract UniStakerTest is Test, PercentAssertions { + function _boundMintAmount(uint256 _amount) internal pure returns (uint256) { +- return bound(_amount, 0, 100_000_000_000e18); ++ return bound(_amount, 0, 100_000_000_000e12); // reduced for tests to pass with UNI + } +@@ -66,2 +67,4 @@ contract UniStakerTest is Test, PercentAssertions { + vm.assume(_to != address(0)); ++ vm.assume(_to != admin); // needed to avoid using admin's address in tests ++ vm.prank(admin); + govToken.mint(_to, _amount); +``` + +### Reduce the maximum constants used to be compatible with `uint96` used in `Uni` + +```diff +@@ -74,3 +77,3 @@ contract UniStakerTest is Test, PercentAssertions { + { +- _boundedStakeAmount = bound(_stakeAmount, 0.1e18, 25_000_000e18); ++ _boundedStakeAmount = bound(_stakeAmount, 0.1e18, 25_000_000e12); // reduced for tests to pass with UNI + } +@@ -194,3 +197,3 @@ contract Stake is UniStakerTest { + ) public { +- _amount = bound(_amount, 1, type(uint224).max); ++ _amount = bound(_amount, 1, type(uint88).max); + _mintGovToken(_depositor, _amount); +@@ -721,3 +733,3 @@ contract PermitAndStake is UniStakerTest { + uint256 _deadline, +- uint256 _currentNonce ++ uint248 _currentNonce + ) public { +@@ -2371,3 +2384,3 @@ contract Withdraw is UniStakerTest { + (_amount, _depositId) = _boundMintAndStake(_depositor, _amount, _delegatee); +- _amountOver = bound(_amountOver, 1, type(uint128).max); ++ _amountOver = bound(_amountOver, 1, type(uint88).max); +``` + +### Miscellaneous changes + +```diff +@@ -793,3 +805,3 @@ contract PermitAndStake is UniStakerTest { + vm.expectRevert( +- abi.encodeWithSelector(ERC20Permit.ERC2612InvalidSigner.selector, _depositor, _notDepositor) ++ "Uni::permit: unauthorized" + ); +@@ -4670,5 +4682,5 @@ contract _FetchOrDeploySurrogate is UniStakerRewardsTest { + +- assertEq(logs[1].topics[0], keccak256("SurrogateDeployed(address,address)")); +- assertEq(logs[1].topics[1], bytes32(uint256(uint160(_delegatee)))); +- assertEq(logs[1].topics[2], bytes32(uint256(uint160(address(_surrogate))))); ++ assertEq(logs[2].topics[0], keccak256("SurrogateDeployed(address,address)")); ++ assertEq(logs[2].topics[1], bytes32(uint256(uint160(_delegatee)))); ++ assertEq(logs[2].topics[2], bytes32(uint256(uint160(address(_surrogate))))); + } +``` + +## [04] Additional assertions to track voting power changes in `Uni` + +As already explained above, voting power is a very important aspect of `UNI` token, which, on the one hand, is influenced by the introduction of `UniStaker` (via surrogate delegations), and on the other hand voting power changes are not tracked at all in the current test suite. We have added corresponding assertions to a few of the current tests; the rest of the test suite needs to be examined, and assertions added as well; we leave this to UniSwap developers. + +An example of one of the modified tests is below: + +```diff +@@ -189,15 +191,16 @@ contract Constructor is UniStakerTest { + contract Stake is UniStakerTest { + function testFuzz_DeploysAndTransfersTokensToANewSurrogateWhenAnAccountStakes( + address _depositor, + uint256 _amount, + address _delegatee + ) public { +- _amount = bound(_amount, 1, type(uint224).max); ++ _amount = bound(_amount, 1, type(uint88).max); + _mintGovToken(_depositor, _amount); + _stake(_depositor, _amount, _delegatee); + + DelegationSurrogate _surrogate = uniStaker.surrogates(_delegatee); + + assertEq(govToken.balanceOf(address(_surrogate)), _amount); + assertEq(govToken.delegates(address(_surrogate)), _delegatee); + assertEq(govToken.balanceOf(_depositor), 0); ++ assertEq(govToken.getCurrentVotes(_delegatee), _amount); + } + ``` + +## [05] Add `Uni.handler.sol`, the wrapper around `Uni`, allowing to call its functions from fuzz/invariant tests + +Similar to the already present [test/helpers/UniStaker.handler.sol](https://github.com/code-423n4/2024-02-uniswap-foundation/blob/5a2761c8277541a24bc551fbd624413b384bea94/test/helpers/UniStaker.handler.sol), we have implemented the lightweight `test/helpers/Uni.handler.sol`, which allows to call most crucial for testing user-facing functions of `UNI`. + +```solidity +// SPDX-License-Identifier: GPL-3.0-or-later +pragma solidity ^0.8.13; + +import {CommonBase} from "forge-std/Base.sol"; +import {StdCheats} from "forge-std/StdCheats.sol"; +import {StdUtils} from "forge-std/StdUtils.sol"; +import {AddressSet, LibAddressSet} from "../helpers/AddressSet.sol"; +import {Uni} from "test/mocks/Uni.sol"; + +contract UniHandler is CommonBase, StdCheats, StdUtils { + using LibAddressSet for AddressSet; + + Uni public uni; + + // delegator -> delegatee + mapping(address => address) private _delegatee; + + // delegatee -> delegators + mapping(address => AddressSet) private _delegators; + + constructor(Uni _uni) { + uni= _uni; + } + + function approve(address spender, uint _amount) external returns (bool) + { + _amount = bound(_amount, 0, type(uint96).max); + vm.startPrank(msg.sender); + uni.approve(spender, _amount); + vm.stopPrank(); + return true; + } + + // Track delegations performed by the users directly via the UNI token + function transfer(address dst, uint _amount) external returns (bool) + { + // bound to the max available amount + vm.startPrank(msg.sender); + uint256 balance = uni.balanceOf(msg.sender); + _amount = bound(_amount, 0, balance); + uni.transfer(dst, _amount); + vm.stopPrank(); + return true; + } + + // Track delegations performed by users directly via the UNI token + function delegate(address delegatee) public + { + address prev_delegatee = _delegatee[msg.sender]; + _delegators[prev_delegatee].remove(msg.sender); + _delegators[delegatee].add(msg.sender); + _delegatee[msg.sender] = delegatee; + + vm.startPrank(msg.sender); + uni.delegate(delegatee); + vm.stopPrank(); + } + + // Advance the specified number of blocks. + // Needed to trigger UNI's block-numbers-based votes accounting + function roll(uint16 advance) public + { + vm.roll(block.number + advance); + } + + function addDelegator(uint256 acc, address delegator) external view returns (uint256) { + return acc + uni.balanceOf(delegator); + } + + function sumDelegatorVotes(address delegatee) + public view + returns (uint256) + { + return _delegators[delegatee].reduce(0, this.addDelegator); + } +} +``` + +## [06] Necessary adaptations to `UniStaker.handler.sol` + +We had to perform necessary adaptations to `UniStaker.handler.sol`, to integrate `UNI` and avoid failing tests due to the usage of a low-level foundry function; the changes are outlined below: + +```diff +diff --git a/test/helpers/UniStaker.handler.sol b/test/helpers/UniStaker.handler.sol +index f8fe335..9622571 100644 +--- a/test/helpers/UniStaker.handler.sol ++++ b/test/helpers/UniStaker.handler.sol +@@ -10,2 +10,3 @@ import {UniStaker} from "src/UniStaker.sol"; + import {IERC20} from "openzeppelin/token/ERC20/IERC20.sol"; ++import {Uni} from "test/mocks/Uni.sol"; +- IERC20 public stakeToken; ++ Uni public stakeToken; + IERC20 public rewardToken; +@@ -50,3 +51,3 @@ contract UniStakerHandler is CommonBase, StdCheats, StdUtils { + uniStaker = _uniStaker; +- stakeToken = IERC20(address(_uniStaker.STAKE_TOKEN())); ++ stakeToken = Uni(address(_uniStaker.STAKE_TOKEN())); + rewardToken = IERC20(address(_uniStaker.REWARD_TOKEN())); +@@ -57,3 +58,5 @@ contract UniStakerHandler is CommonBase, StdCheats, StdUtils { + vm.assume(_to != address(0)); +- deal(address(stakeToken), _to, _amount, true); ++ vm.prank(admin); ++ stakeToken.mint(_to, _amount); ++ vm.stopPrank(); + } +@@ -98,2 +101,4 @@ contract UniStakerHandler is CommonBase, StdCheats, StdUtils { + { ++ vm.assume(_delegatee != address(0)); ++ vm.assume(_beneficiary != address(0)); + _createDepositor(); +@@ -185,4 +190,4 @@ contract UniStakerHandler is CommonBase, StdCheats, StdUtils { + +- function reduceDepositors(uint256 acc, function(uint256,address) external returns (uint256) func) +- public ++ function reduceDepositors(uint256 acc, function(uint256,address) external view returns (uint256) func) ++ public view + returns (uint256) +@@ -194,4 +199,4 @@ contract UniStakerHandler is CommonBase, StdCheats, StdUtils { + uint256 acc, +- function(uint256,address) external returns (uint256) func +- ) public returns (uint256) { ++ function(uint256,address) external view returns (uint256) func ++ ) public view returns (uint256) { + return _beneficiaries.reduce(acc, func); +@@ -199,4 +204,4 @@ contract UniStakerHandler is CommonBase, StdCheats, StdUtils { + +- function reduceDelegates(uint256 acc, function(uint256,address) external returns (uint256) func) +- public ++ function reduceDelegates(uint256 acc, function(uint256,address) external view returns (uint256) func) ++ public view + returns (uint256) +``` + +In particular, the usage of the low-level Foundry's `deal` function, which modifies in place the storage of an ERC20 contract, is incompatible with `UNI`'s vote accounting mechanism and leads to underflows in vote computations with the error thrown `Uni::_moveVotes: vote amount underflows`. + +## [07] Extensions to `UniStaker.invariants.t.sol` to track an additional invariant, `invariant_Total_stake_plus_direct_delegations_equals_current_votes` + +We have extended `UniStaker.invariants.t.sol` with an additional invariant that asserts that on all changes, either via `UniStaker` or via direct user delegations via `UNI`, the total stake via `UniStaker` summed up with direct delegations, gives the total voting power for all delegates. The changes are outlined below: + +
+ +```diff +diff --git a/test/UniStaker.invariants.t.sol b/test/UniStaker.invariants.t.sol +index 4c80ce1..5148548 100644 +--- a/test/UniStaker.invariants.t.sol ++++ b/test/UniStaker.invariants.t.sol +@@ -8,3 +8,4 @@ import {UniStaker} from "src/UniStaker.sol"; + import {UniStakerHandler} from "test/helpers/UniStaker.handler.sol"; +-import {ERC20VotesMock} from "test/mocks/MockERC20Votes.sol"; ++import {Uni} from "test/mocks/Uni.sol"; ++import {UniHandler} from "test/helpers/Uni.handler.sol"; + import {ERC20Fake} from "test/fakes/ERC20Fake.sol"; +@@ -15,4 +16,23 @@ contract UniStakerInvariants is Test { + ERC20Fake rewardToken; +- ERC20VotesMock govToken; ++ Uni govToken; ++ UniHandler uniHandler; + address rewardsNotifier; ++ address admin; ++ address alice; ++ address bob; ++ address carol; ++ address dave; ++ address eve; ++ address frank; ++ ++ function _jumpAhead(uint256 _seconds) public { ++ vm.warp(block.timestamp + _seconds); ++ } ++ ++ function _mintGovToken(address _to, uint256 _amount) internal { ++ vm.assume(_to != address(0)); ++ vm.prank(admin); ++ govToken.mint(_to, _amount); ++ vm.stopPrank(); ++ } + +@@ -22,4 +42,22 @@ contract UniStakerInvariants is Test { + +- govToken = new ERC20VotesMock(); +- vm.label(address(govToken), "Governance Token"); ++ _jumpAhead(1234); ++ admin = makeAddr("admin"); ++ alice = makeAddr("alice"); ++ bob = makeAddr("bob"); ++ carol = makeAddr("carol"); ++ dave = makeAddr("dave"); ++ eve = makeAddr("eve"); ++ frank = makeAddr("frank"); ++ ++ govToken = new Uni(admin, admin, 2000); ++ vm.label(address(govToken), "Uni Token"); ++ _jumpAhead(1234); ++ ++ _mintGovToken(admin, 1e27); ++ _mintGovToken(alice, 1e27); ++ _mintGovToken(bob, 1e27); ++ _mintGovToken(carol, 1e27); ++ _mintGovToken(dave, 1e27); ++ _mintGovToken(eve, 1e27); ++ _mintGovToken(frank, 1e27); + +@@ -42,2 +80,19 @@ contract UniStakerInvariants is Test { + targetContract(address(handler)); ++ ++ uniHandler = new UniHandler(govToken); ++ bytes4[] memory uniSelectors = new bytes4[](4); ++ uniSelectors[0] = UniHandler.transfer.selector; ++ uniSelectors[1] = UniHandler.approve.selector; ++ uniSelectors[2] = UniHandler.delegate.selector; ++ uniSelectors[3] = UniHandler.roll.selector; ++ ++ targetSelector(FuzzSelector({addr: address(uniHandler), selectors: uniSelectors})); ++ ++ targetContract(address(uniHandler)); ++ targetSender(alice); ++ targetSender(bob); ++ targetSender(carol); ++ targetSender(dave); ++ targetSender(eve); ++ targetSender(frank); + } +@@ -84,2 +139,23 @@ contract UniStakerInvariants is Test { + ++ function invariant_Total_stake_plus_direct_delegations_equals_current_votes() public { ++ assertEq(uniStaker.totalStaked() + handler.reduceDelegates(0, this.accumulateDirectDelegateVotes), ++ handler.reduceDelegates(0, this.accumulateCurrentDelegateVotes)); ++ } ++ ++ function accumulateDirectDelegateVotes(uint256 votes, address delegate) ++ external ++ view ++ returns (uint256) ++ { ++ return votes + uniHandler.sumDelegatorVotes(delegate); ++ } ++ ++ function accumulateCurrentDelegateVotes(uint256 votes, address delegate) ++ external ++ view ++ returns (uint256) ++ { ++ return votes + govToken.getCurrentVotes(delegate); ++ } ++ + // Used to see distribution of non-reverting calls +``` + +
+ +## [08] Necessary changes to `AddressSet.sol` + +In order to be able to track external user delegations, we had to adapt slightly the helper library `AddressSet.sol`: + +```diff +diff --git a/test/helpers/AddressSet.sol b/test/helpers/AddressSet.sol +index 83327a7..323ed2c 100644 +--- a/test/helpers/AddressSet.sol ++++ b/test/helpers/AddressSet.sol +@@ -17,6 +17,20 @@ library LibAddressSet { + } + } + ++ function remove(AddressSet storage s, address addr) internal { ++ if (s.saved[addr]) { ++ uint256 len = s.addrs.length; ++ for(uint256 i = 0; i < len; ++i) { ++ if(s.addrs[i] == addr) { ++ s.addrs[i] = s.addrs[len-1]; ++ break; ++ } ++ } ++ s.addrs.pop(); ++ s.saved[addr] = false; ++ } ++ } ++ + function contains(AddressSet storage s, address addr) internal view returns (bool) { + return s.saved[addr]; + } +@@ -39,8 +53,8 @@ library LibAddressSet { + function reduce( + AddressSet storage s, + uint256 acc, +- function(uint256,address) external returns (uint256) func +- ) internal returns (uint256) { ++ function(uint256,address) external view returns (uint256) func ++ ) internal view returns (uint256) { + for (uint256 i; i < s.addrs.length; ++i) { + acc = func(acc, s.addrs[i]); + } +``` + +## [09] Necessary changes to `foundry.toml` + +We had to introduce a few changes to `foundry.toml`. On the one hand, a couple of dependencies were missing, so we've introduced them for the project to compile. On the other hand, the fuzzing/invariant test settings have been in our opinion very low, so we increased the number or the depth of the runs in order to increase the coverage. + +```diff +diff --git a/foundry.toml b/foundry.toml +index a3031f2..64d0f63 100644 +--- a/foundry.toml ++++ b/foundry.toml +@@ -2,17 +2,23 @@ + evm_version = "paris" + optimizer = true + optimizer_runs = 10_000_000 +- remappings = ["openzeppelin/=lib/openzeppelin-contracts/contracts"] ++ remappings = [ ++ "openzeppelin/=lib/openzeppelin-contracts/contracts", ++ "uniswap-periphery/=lib/v3-periphery/contracts", ++ "@uniswap/v3-core=lib/v3-core", ++ ] + solc_version = "0.8.23" + verbosity = 3 ++ fuzz = { runs = 500 } ++ invariant = { runs = 100, depth = 100 } + + [profile.ci] + fuzz = { runs = 5000 } +- invariant = { runs = 1000 } ++ invariant = { runs = 1000, depth = 100 } + + [profile.lite] + fuzz = { runs = 50 } +- invariant = { runs = 10 } ++ invariant = { runs = 10, depth = 100 } + # Speed up compilation and tests during development. + optimizer = false +``` + +Increasing the fuzz/invariant bounds allowed us in particular to observe the following failing test + +```sh +[FAIL. Reason: assertion failed; counterexample: calldata=0xc1e611e700000000000000000000000000000000000000000000000000000000000029fa00000000000000000000000000000000000000000000000000000000000004d3000000000000000000000000aa10a84ce7d9ae517a52c6d5ca153b369af99ecf0000000000000000000000000000000000000000000000000000000000002d6900000000000000000000000000000000000000000000000000000000000000970000000000000000000000000000000000000000000000000000000000000631 args=[0x00000000000000000000000000000000000029fa, 1235, 0xaA10a84CE7d9AE517a52c6d5cA153b369Af99ecF, 11625 [1.162e4], 0x0000000000000000000000000000000000000097, 0x0000000000000000000000000000000000000631]] testFuzz_DeploysAndTransfersTokenToTwoSurrogatesWhenAccountsStakesToDifferentDelegatees(address,uint256,address,uint256,address,address) (runs: 370, μ: 803661, ~: 816488) +Logs: + Bound Result 1235 + Bound Result 11625 + Error: a == b not satisfied [uint] + Left: 1000000000000000000000000000 + Right: 0 +``` + +The reason for the test failure was that due to an increased number of alternatives tried, Foundry's fuzz testing engine picked admin's address to mint to, and thus [this assertion](https://github.com/code-423n4/2024-02-uniswap-foundation/blob/5a2761c8277541a24bc551fbd624413b384bea94/test/UniStaker.t.sol#L414) failed as a result. We have repaired the failing test by disallowing to mint governance tokens to admin's address. + +## [10] Applying the changes to the UniStaker testing infrastructure, and running the tests + +To correctly set up the environment and apply the modifications, do the following: + +- `git clone https://github.com/code-423n4/2024-02-uniswap-foundation.git` +- `cd 2024-02-uniswap-foundation` +- `forge install uniswap/v3-core` +- `forge install uniswap/v3-periphery` +- Download [this gist](https://gist.github.com/kuprumion/b7b0e03ea52ff925d0f9a9a4dcd7116f), and unpack it e.g. into `../uni`; +- Place the files as follows inside the repo: + - `cp ../uni/foundry.toml ./` + - `cp ../uni/Uni.sol ./test/mocks/` + - `cp ../uni/Uni.handler.sol ./test/helpers/` + - `cp ../uni/UniStaker.handler.sol ./test/helpers/` + - `cp ../uni/AddressSet.sol ./test/helpers/` + - `cp ../uni/UniStaker.t.sol ./test/` + - `cp ../uni/UniStaker.invariants.t.sol ./test/` + +Then, execute the tests (excluding the integration tests) via this command: + +```sh +forge test --nmp '*integration*' +``` + +To execute and examine the working of the newly introduced invariant, we recommend to focus on it and execute it in verbose mode: + +```sh +forge test -vvvv --nmp '*integration*' --match-test invariant_Total_stake_plus_direct_delegations_equals_current_votes +``` + +## [[11] Small stakes reward griefing due to rounding, and actions by anyone with nothing at stake](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/388) + +*Note: At the judge’s request [here](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/299#issuecomment-1997457762), this downgraded issue from the same warden has been included in this report for completeness.* + +https://github.com/code-423n4/2024-02-uniswap-foundation/blob/491c7f63e5799d95a181be4a978b2f074dc219a5/src/UniStaker.sol#L256-L261
+https://github.com/code-423n4/2024-02-uniswap-foundation/blob/491c7f63e5799d95a181be4a978b2f074dc219a5/src/UniStaker.sol#L292-L303
+https://github.com/code-423n4/2024-02-uniswap-foundation/blob/491c7f63e5799d95a181be4a978b2f074dc219a5/src/UniStaker.sol#L315-L334
+https://github.com/code-423n4/2024-02-uniswap-foundation/blob/491c7f63e5799d95a181be4a978b2f074dc219a5/src/UniStaker.sol#L342-L346
+https://github.com/code-423n4/2024-02-uniswap-foundation/blob/491c7f63e5799d95a181be4a978b2f074dc219a5/src/UniStaker.sol#L360-L373
+https://github.com/code-423n4/2024-02-uniswap-foundation/blob/491c7f63e5799d95a181be4a978b2f074dc219a5/src/UniStaker.sol#L382-L402
+https://github.com/code-423n4/2024-02-uniswap-foundation/blob/491c7f63e5799d95a181be4a978b2f074dc219a5/src/UniStaker.sol#L453-L457
+https://github.com/code-423n4/2024-02-uniswap-foundation/blob/491c7f63e5799d95a181be4a978b2f074dc219a5/src/UniStaker.sol#L466-L492
+https://github.com/code-423n4/2024-02-uniswap-foundation/blob/491c7f63e5799d95a181be4a978b2f074dc219a5/src/UniStaker.sol#L499-L503
+https://github.com/code-423n4/2024-02-uniswap-foundation/blob/491c7f63e5799d95a181be4a978b2f074dc219a5/src/UniStaker.sol#L512-L532 + +### Impact + +Whenever any operation with the given user as a beneficiary is performed, this user's rewards are checkpointed via function [`_checkpointReward()`](https://github.com/code-423n4/2024-02-uniswap-foundation/blob/491c7f63e5799d95a181be4a978b2f074dc219a5/src/UniStaker.sol#L764-L767), which calculates the reward checkpoint by a call to function [`unclaimedReward()`](https://github.com/code-423n4/2024-02-uniswap-foundation/blob/491c7f63e5799d95a181be4a978b2f074dc219a5/src/UniStaker.sol#L241-L247): + +```solidity + function unclaimedReward(address _beneficiary) public view returns (uint256) { + return unclaimedRewardCheckpoint[_beneficiary] + + ( + earningPower[_beneficiary] + * (rewardPerTokenAccumulated() - beneficiaryRewardPerTokenCheckpoint[_beneficiary]) + ) / SCALE_FACTOR; + } +``` + +The problem with the above function is that it allows for rounding errors, in that it divides by the large `SCALE_FACTOR = 1e36`, which is intended exactly to prevent rounding errors (but in another place). More specifically, the rounding errors happen when: + +- The user stake is relatively small (thus, `earningPower[_beneficiary]` is small). +- The reward amount is relatively small. +- A small period of time has passed since the previous checkpoint (thus, the second factor becomes small as well). + +The last aspect is controllable by any external user (an attacker), which may have zero stake in the system, and still designate the grieved user as a beneficiary, and the attacker can also do it as frequently as needed (e.g. every block). The vulnerable functions are almost all externally callable functions: + +- `stake()`, `permitAndStake`, `stakeOnBehalf()`: allow to deposit a zero stake, and to designate arbitrary user as a beneficiary. +- `stakeMore()`, `permitAndStakeMore()`, `stakeMoreOnBehalf()`: allow to extend an existing stake with an additional zero amount, while checkpointing the same beneficiary. +- `alterBeneficiary()`, `alterBeneficiaryOnBehalf()`: allow to change deposit beneficiary to an arbitrary user, while checkpointing two users simultaneously (the old and the new beneficiary). +- `withdraw()`, `withdrawOnBehalf()`: allow to withdraw a zero amount, also from a zero stake. + +Any of those functions can be called by an attacker who doesn't need to stake anything (nothing at stake). As a result, the attacked user will be eligible to disproportionately smaller rewards than other users that staked the same amounts, over the same period of time. + +### Proof of Concept + +The test below demonstrates the exploit; to be placed in [test/UniStaker.t.sol](https://github.com/code-423n4/2024-02-uniswap-foundation/blob/491c7f63e5799d95a181be4a978b2f074dc219a5/test/UniStaker.t.sol#L2709). All amounts are within the bounds as provided by the functions `_boundToRealisticStake()` and `_boundToRealisticReward()`. Instead of `stakeMore()`, an attacker could employ any of the vulnerable functions listed above. + +```diff +diff --git a/test/UniStaker.t.sol b/test/UniStaker.t.sol +index 89124f8..9a01043 100644 +--- a/test/UniStaker.t.sol ++++ b/test/UniStaker.t.sol +@@ -2708,2 +2708,50 @@ contract UniStakerRewardsTest is UniStakerTest { + contract NotifyRewardAmount is UniStakerRewardsTest { ++ function test_SmallStakesRewardGriefing() public { ++ address _user1 = address(1); ++ address _user2 = address(2); ++ address _user3 = address(3); ++ address _delegatee = address(4); ++ address _attacker = address(5); ++ ++ // Mint necessary amounts ++ uint256 _smallDepositAmount = 0.1e18; // from _boundToRealisticStake ++ uint256 _largeDepositAmount = 25_000_000e18; // from _boundToRealisticStake ++ _mintGovToken(_user1, _smallDepositAmount); ++ _mintGovToken(_user2, _smallDepositAmount); ++ _mintGovToken(_user3, _largeDepositAmount); ++ ++ // Notify of the rewards ++ uint256 _rewardAmount = 1e14; // from _boundToRealisticReward ++ rewardToken.mint(rewardNotifier, _rewardAmount); ++ vm.startPrank(rewardNotifier); ++ rewardToken.transfer(address(uniStaker), _rewardAmount); ++ uniStaker.notifyRewardAmount(_rewardAmount); ++ vm.stopPrank(); ++ ++ // Users stake for themselves ++ _stake(_user1, _smallDepositAmount, _delegatee); ++ _stake(_user2, _smallDepositAmount, _delegatee); ++ _stake(_user3, _largeDepositAmount, _delegatee); ++ ++ // _attacker has zero funds ++ assertEq(govToken.balanceOf(_attacker), 0); ++ ++ // The attack: every block _attacker deposits 0 stake ++ // and assigns _user1 as beneficiary, ++ // thus leading to frequent updates of the reward checkpoint for _user1 ++ // with the rounding errors accumulating ++ UniStaker.DepositIdentifier _depositId = _stake(_attacker, 0, _delegatee, _user1); ++ for(uint i = 0; i < 1000; ++i) { ++ _jumpAhead(10); // a conservative 10 seconds between blocks ++ vm.startPrank(_attacker); ++ uniStaker.stakeMore(_depositId, 0); ++ vm.stopPrank(); ++ } ++ ++ console2.log("Unclaimed reward for _user1: ", uniStaker.unclaimedReward(_user1)); ++ console2.log("Unclaimed reward for _user2: ", uniStaker.unclaimedReward(_user2)); ++ // This assertion fails: _user1 can now claim substantially less rewards than _user2 ++ assertLteWithinOnePercent(uniStaker.unclaimedReward(_user1), uniStaker.unclaimedReward(_user2)); ++ } ++ + function testFuzz_UpdatesTheRewardRate(uint256 _amount) public { +``` + +Run the test using `forge test -vvvv --nmp '*integration*' --match-test test_SmallStakesRewardGriefing`. +Notice that exploit succeeds if the test fails; the failing test prints then the following output, showing that `_user1` may claim only `1000` in rewards, contrary to `_user2`, who staked the same amount but may claim `1543` in rewards. + +```sh + ├─ [0] VM::startPrank(0x0000000000000000000000000000000000000005) + │ └─ ← () + ├─ [14341] UniStaker::stakeMore(3, 0) + │ ├─ [4113] Governance Token::transferFrom(0x0000000000000000000000000000000000000005, DelegationSurrogate: [0x4f81992FCe2E1846dD528eC0102e6eE1f61ed3e2], 0) + │ │ ├─ emit Transfer(from: 0x0000000000000000000000000000000000000005, to: DelegationSurrogate: [0x4f81992FCe2E1846dD528eC0102e6eE1f61ed3e2], value: 0) + │ │ └─ ← true + │ ├─ emit StakeDeposited(owner: 0x0000000000000000000000000000000000000005, depositId: 3, amount: 0, depositBalance: 0) + │ └─ ← () + ├─ [0] VM::stopPrank() + │ └─ ← () + ├─ [2293] UniStaker::unclaimedReward(0x0000000000000000000000000000000000000001) [staticcall] + │ └─ ← 1000 + ├─ [0] console::log("Unclaimed reward for _user1: ", 1000) [staticcall] + │ └─ ← () + ├─ [2293] UniStaker::unclaimedReward(0x0000000000000000000000000000000000000002) [staticcall] + │ └─ ← 1543 + ├─ [0] console::log("Unclaimed reward for _user2: ", 1543) [staticcall] + │ └─ ← () + ├─ [2293] UniStaker::unclaimedReward(0x0000000000000000000000000000000000000001) [staticcall] + │ └─ ← 1000 + ├─ [2293] UniStaker::unclaimedReward(0x0000000000000000000000000000000000000002) [staticcall] + │ └─ ← 1543 + ├─ emit log(val: "Error: a >= 0.99 * b not satisfied") + ├─ emit log_named_uint(key: " Expected", val: 1543) + ├─ emit log_named_uint(key: " Actual", val: 1000) + ├─ emit log_named_uint(key: " minBound", val: 1527) + ├─ [0] VM::store(VM: [0x7109709ECfa91a80626fF3989D68f67F5b1DD12D], 0x6661696c65640000000000000000000000000000000000000000000000000000, 0x0000000000000000000000000000000000000000000000000000000000000001) + │ └─ ← () + └─ ← () + +Test result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 466.54s +``` + +### Tools Used + +Foundry + +### Recommended Mitigation Steps + +We recommend the following simple change to be applied to `src/Unistaker.sol`, which avoids division by `SCALE_FACTOR` when storing checkpoints internally, and instead divides by it only when the rewards are claimed: + +```diff +diff --git a/src/UniStaker.sol b/src/UniStaker.sol +index babdc1a..237b833 100644 +--- a/src/UniStaker.sol ++++ b/src/UniStaker.sol +@@ -239,9 +239,9 @@ contract UniStaker is INotifiableRewardReceiver, Multicall, EIP712, Nonces { + /// until it is reset to zero once the beneficiary account claims their unearned rewards. + /// @return Live value of the unclaimed rewards earned by a given beneficiary account. + function unclaimedReward(address _beneficiary) public view returns (uint256) { +- return unclaimedRewardCheckpoint[_beneficiary] +- + ( +- earningPower[_beneficiary] ++ return ( ++ unclaimedRewardCheckpoint[_beneficiary] ++ + earningPower[_beneficiary] + * (rewardPerTokenAccumulated() - beneficiaryRewardPerTokenCheckpoint[_beneficiary]) + ) / SCALE_FACTOR; + } +@@ -746,7 +746,7 @@ contract UniStaker is INotifiableRewardReceiver, Multicall, EIP712, Nonces { + unclaimedRewardCheckpoint[_beneficiary] = 0; + emit RewardClaimed(_beneficiary, _reward); + +- SafeERC20.safeTransfer(REWARD_TOKEN, _beneficiary, _reward); ++ SafeERC20.safeTransfer(REWARD_TOKEN, _beneficiary, _reward / SCALE_FACTOR); + } + + /// @notice Checkpoints the global reward per token accumulator. +@@ -762,7 +762,11 @@ contract UniStaker is INotifiableRewardReceiver, Multicall, EIP712, Nonces { + /// accumulator has been checkpointed. It assumes the global `rewardPerTokenCheckpoint` is up to + /// date. + function _checkpointReward(address _beneficiary) internal { +- unclaimedRewardCheckpoint[_beneficiary] = unclaimedReward(_beneficiary); ++ unclaimedRewardCheckpoint[_beneficiary] += ( ++ earningPower[_beneficiary] ++ * (rewardPerTokenAccumulated() - beneficiaryRewardPerTokenCheckpoint[_beneficiary]) ++ ); ++ + beneficiaryRewardPerTokenCheckpoint[_beneficiary] = rewardPerTokenAccumulatedCheckpoint; + } +``` + +This change alleviates the problem completely. Now, the output from the previously failing test reads: + +```sh + ├─ [0] VM::startPrank(0x0000000000000000000000000000000000000005) + │ └─ ← () + ├─ [14185] UniStaker::stakeMore(3, 0) + │ ├─ [4113] Governance Token::transferFrom(0x0000000000000000000000000000000000000005, DelegationSurrogate: [0x4f81992FCe2E1846dD528eC0102e6eE1f61ed3e2], 0) + │ │ ├─ emit Transfer(from: 0x0000000000000000000000000000000000000005, to: DelegationSurrogate: [0x4f81992FCe2E1846dD528eC0102e6eE1f61ed3e2], value: 0) + │ │ └─ ← true + │ ├─ emit StakeDeposited(owner: 0x0000000000000000000000000000000000000005, depositId: 3, amount: 0, depositBalance: 0) + │ └─ ← () + ├─ [0] VM::stopPrank() + │ └─ ← () + ├─ [2293] UniStaker::unclaimedReward(0x0000000000000000000000000000000000000001) [staticcall] + │ └─ ← 1543 + ├─ [0] console::log("Unclaimed reward for _user1: ", 1543) [staticcall] + │ └─ ← () + ├─ [2293] UniStaker::unclaimedReward(0x0000000000000000000000000000000000000002) [staticcall] + │ └─ ← 1543 + ├─ [0] console::log("Unclaimed reward for _user2: ", 1543) [staticcall] + │ └─ ← () + ├─ [2293] UniStaker::unclaimedReward(0x0000000000000000000000000000000000000001) [staticcall] + │ └─ ← 1543 + ├─ [2293] UniStaker::unclaimedReward(0x0000000000000000000000000000000000000002) [staticcall] + │ └─ ← 1543 + └─ ← () + +Test result: ok. 1 passed; 0 failed; 0 skipped; finished in 247.92ms +``` + +Besides that, we recommend to apply minimal input validation to all vulnerable functions listed above: allow to stake only above some minimal amount (no zero stakes), disallow to alter beneficiary to the same address, disallow withdrawing zero amounts, etc. While in itself such actions may seem harmless, leaving functions that accept insensible inputs in the system, in combination with other potential problems, may open the way to exploits. + +### Assessed type + +Math + +**[wildmolasses (Uniswap) acknowledged and commented](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/299#issuecomment-1992314009):** + > Some decent callouts here; although nothing was found, we appreciate the rigor. I think we would like to mark high quality, thanks warden! + +**[0xTheC0der (judge) commented](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/299#issuecomment-1997621087):** + > The majority of initial H/M findings which were downgraded to QA exceed the present QA reports in value provided, and none of the present QA reports stand out enough in terms of valid and valuable Low findings to be selected for report. As a consequence, the current report was selected due to its high quality, diligence and value provided to the sponsor. + +*** + +# Audit Analysis + +For this audit, 20 analysis reports were submitted by wardens. An analysis report examines the codebase as a whole, providing observations and advice on such topics as architecture, mechanism, or approach. The [report highlighted below](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/312) by **roguereggiant** received the top score from the judge. + +*The following wardens also submitted reports: [hunter\_w3b](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/341), [kaveyjoe](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/110), [McToady](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/58), [peanuts](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/399), [Sathish9098](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/389), [0xepley](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/347), [Aamir](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/322), [fouzantanveer](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/320), [hassanshakeel13](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/310), [MSK](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/307), [LinKenji](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/298), [SAQ](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/285), [Myd](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/279), [ihtishamsudo](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/278), [emerald7017](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/266), [aariiif](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/252), [ZanyBonzy](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/153), [cudo](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/139), and [Al-Qa-qa](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/100).* + + +## Project Overview + +UniStaker is a mechanism designed to facilitate the collection and distribution of protocol fees generated by the Uniswap V3 pools through UNI token staking. This setup allows Uniswap Governance to enable and manage these protocol fees effectively. By integrating contracts from this repository, Uniswap Governance could maintain the authority to set protocol fees for Uniswap V3 Pools without directly handling the fee assets. Instead, the fees generated are distributed in a trustless manner to UNI holders who opt to stake their tokens. The unique aspect of this system is that rewards for stakers are not in the form of fee tokens directly but in a predefined token established at the deployment of these contracts. The accumulated fees from each pool are periodically auctioned to entities willing to exchange them for the specified token, thereby facilitating the distribution of rewards to stakers. + +The operational framework of UniStaker is built around two core contracts: V3FactoryOwner.sol and UniStaker.sol. The V3FactoryOwner contract functions as the new owner of the Uniswap V3 Factory, allowing governance to transfer factory ownership to this contract while retaining control over fee settings through a governance mechanism. On the other hand, the UniStaker contract is responsible for the distribution of staking rewards, employing a mechanism that allows rewards to drip over a fixed period, similar to the Synthetix StakingRewards.sol model. This contract enables UNI stakers to maintain their governance rights, designate beneficiaries for their rewards, and manage their stakes on a per-deposit basis, introducing efficiencies in terms of precision, gas usage, and code clarity. Additionally, UniStaker is designed to accommodate rewards from various sources, with the potential for future expansion beyond Uniswap V3 protocol fees, under the administration of Uniswap Governance. + +| File Name | Description | +| -- | -- | +| UniStaker.sol | The code defines a smart contract, UniStaker, responsible for managing the distribution of staking rewards in the form of ERC20 tokens to participants who deposit a specific governance token. It allows for flexible management of staking positions, enabling users to delegate voting power, specify reward beneficiaries, and alter these designations while participating in a reward distribution mechanism inspired by Synthetix's model. | +| V3FactoryOwner.sol | The code defines V3FactoryOwner, a contract serving as the owner of the Uniswap v3 factory, allowing an admin (expected to be Uniswap Governance) to manage fee settings on pools and the factory itself. It enables a public function for collecting protocol fees from pools in exchange for a specified token, aiming to create a competitive market for fee collection. | +| DelegationSurrogate.sol | DelegationSurrogate is a streamlined contract designed to hold governance tokens on behalf of users while delegating their voting power to a specified delegatee. This approach enables individual token holders to maintain their governance rights by using a separate surrogate for each delegatee, even when their tokens are pooled together under a single contract. | + +## Architecture Diagram + +The architecture diagram below illustrates the interaction between various components of the system, focusing on governance token delegation and staking rewards distribution. This system allows governance token holders to stake their tokens, delegate their voting power, and earn rewards, all while maintaining their governance rights. + +*Note: to view the provided image, please see the original submission [here](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/312).* + +### Architecture Overview + +1. **Token Holders** represent individuals or entities that own governance tokens. They have the option to stake these tokens in a staking contract to earn rewards and participate in governance by delegating their voting power. + +2. **Staking Contract** is the central hub where token holders stake their governance tokens to earn rewards. It interacts with other system components to manage staked tokens and distribute rewards. + +3. **DelegationSurrogate** is deployed by the staking contract for each delegatee. Its purpose is to hold staked governance tokens and delegate voting power to a specified delegatee, allowing token holders to maintain their governance rights even when their tokens are pooled together. + +4. **Rewards Distribution Mechanism** is responsible for distributing rewards to token holders based on the amount of tokens they have staked and other criteria defined by the system. + +5. **Delegatee** is an individual or entity to which the DelegationSurrogate delegates voting power. This allows them to vote in governance proposals on behalf of the token holders who have staked their tokens. + +6. **Uniswap V3 Factory** is part of the broader ecosystem, where the staking contract might interact with Uniswap V3 to manage liquidity pools, set fees, or perform other actions related to the governance of Uniswap V3 pools. + +7. **Uniswap V3 Pools** are liquidity pools managed by the Uniswap V3 Factory, which can be influenced by governance decisions made by the staking contract, delegatees, or directly by token holders. + +## Sequence Diagram + +This architecture enables a decentralized and democratic governance system where token holders can earn rewards while participating in the governance of the protocol or ecosystem they are invested in. It balances the need for efficient governance token management with the desire to empower individual token holders. +Below is a sequence diagram illustrating the interactions within the system, focusing on the process of staking tokens, delegating voting power, and distributing rewards. + +*Note: to view the provided image, please see the original submission [here](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/312).* + +### Sequence Diagram Overview + +1. **Token Holder** initiates the process by staking their governance tokens in the **Staking Contract**. + +2. For each stake, the **Staking Contract** either deploys a new **Delegation Surrogate** or selects an existing one, based on the designated **Delegatee**. + +3. The **Delegation Surrogate** then delegates the voting power of the staked tokens to the specified **Delegatee**, ensuring that token holders retain their governance rights. + +4. Parallelly or subsequently, the **Staking Contract** communicates with the **Rewards Distribution Mechanism** to calculate the rewards for each token holder based on the staked tokens and other criteria. + +5. The **Rewards Distribution Mechanism** distributes the calculated rewards back to the **Token Holder**. + +6. Optionally, the **Token Holder** might directly delegate their voting power to a **Delegatee**, bypassing the staking mechanism for governance participation. + +7. Optionally, the **Staking Contract** might interact with the **Uniswap V3 Factory** for liquidity pool management or other governance actions. The **Uniswap V3 Factory** updates the **Staking Contract** with any changes to pool status or information. + +This sequence outlines the flow of actions from staking tokens to receiving rewards while ensuring governance participation through delegation. + +## Overview of Functions in the UniStaker Smart Contract + +*Note: to view the provided image, please see the original submission [here](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/312).* + +### Admin and Reward Notifier Management + +- **`setAdmin`**: Updates the admin of the contract. Only the current admin can perform this action. +- **`setRewardNotifier`**: Enables or disables a reward notifier address, allowing or disallowing it from notifying the contract about new rewards. This action is also restricted to the admin. + +### Staking Operations + +- **`stake`**: Allows a user to stake tokens into a new deposit, automatically delegating voting power and setting themselves as the reward beneficiary. +- **`stakeMore`**: Enables adding more tokens to an existing stake, maintaining the current delegatee and beneficiary settings. +- **`permitAndStake`**: Similar to `stake`, but includes an ERC-20 permit for token approval, reducing transaction steps. +- **`stakeOnBehalf`**: Allows staking on behalf of another user, with their permission, enabling the staker to specify delegatee and beneficiary. +- **`stakeMoreOnBehalf`**: Adds more tokens to an existing deposit on behalf of another user, with their permission. + +### Delegation and Beneficiary Management + +- **`alterDelegatee`**: Changes the delegatee for a specific deposit, allowing the stake's voting power to be redirected. +- **`alterDelegateeOnBehalf`**: Similar to `alterDelegatee`, but performed on behalf of the deposit owner with their permission. +- **`alterBeneficiary`**: Changes the beneficiary who earns rewards from a specific deposit. +- **`alterBeneficiaryOnBehalf`**: Allows changing the beneficiary on behalf of the deposit owner, with their permission. + +### Withdrawal and Reward Claiming + +- **`withdraw`**: Withdraws staked tokens from a deposit, reducing the stake and potentially affecting reward earnings. +- **`withdrawOnBehalf`**: Performs a withdrawal on behalf of the deposit owner, with their permission. +- **`claimReward`**: Allows a beneficiary to claim their earned rewards. +- **`claimRewardOnBehalf`**: Claims rewards on behalf of a beneficiary, with their permission. + +### Reward Notification + +- **`notifyRewardAmount`**: Called by authorized reward notifiers to inform the contract about new rewards being added. It adjusts the reward rate and duration accordingly. + +### Internal Helper Functions + +- **`_fetchOrDeploySurrogate`**: Deploys or retrieves a Delegation Surrogate contract for a specified delegatee. +- **`_stakeTokenSafeTransferFrom`**: Safely transfers staked tokens from one address to another. +- **`_useDepositId`**: Generates a unique identifier for a new deposit. +- **`_stake`**: Core logic for staking operations, handling token transfers, and setting deposit parameters. +- **`_stakeMore`**: Adds tokens to an existing stake, updating the total staked amount and rewards. +- **`_alterDelegatee`**: Updates the delegatee for a deposit, managing the delegation of voting power. +- **`_alterBeneficiary`**: Changes the beneficiary for a deposit, affecting who earns the rewards. +- **`_withdraw`**: Handles the withdrawal of staked tokens from a deposit. +- **`_claimReward`**: Processes reward claims, transferring earned rewards to beneficiaries. +- **`_checkpointGlobalReward`**: Updates the global reward rate and distribution end time based on new rewards. +- **`_checkpointReward`**: Updates the reward calculation for a specific beneficiary. +- **`_setAdmin`**: Sets the admin address internally. +- **`_revertIfNotAdmin`**: Checks if the caller is the admin and reverts if not. +- **`_revertIfNotDepositOwner`**: Ensures the caller owns the deposit they are trying to modify. +- **`_revertIfAddressZero`**: Checks for zero addresses in critical parameters. +- **`_revertIfSignatureIsNotValidNow`**: Validates EIP-712 signatures for actions performed on behalf of others. + +This contract facilitates complex staking, delegation, and rewards management operations, integrating with ERC-20 tokens and leveraging DeFi conventions for governance and reward distribution. + +## UniStaker Smart Contract Functionalities Overview + +### Main Functionalities + +- **Stake Tokens**: Allows users to deposit governance tokens into the contract to participate in staking. Users can choose to delegate their voting power to a specific delegatee and designate a beneficiary for their rewards. +- **Withdraw Tokens**: Permits stakers to withdraw their deposited tokens from the contract. This action ceases their participation in reward distribution. +- **Claim Rewards**: Enables beneficiaries to claim their accrued rewards. The rewards are calculated based on the proportion of the user's stake relative to the total staked amount and the duration for which the tokens were staked. + +### Delegation and Beneficiary Management + +- **Delegate Voting Power**: Through the creation or selection of a Delegation Surrogate, stakers can delegate the voting power of their staked tokens to a chosen delegatee, allowing them to participate in governance decisions. +- **Alter Delegatee**: Stakers have the flexibility to change the delegatee to whom their voting power is assigned. +- **Designate or Change Beneficiary**: Stakers can specify or change the beneficiary address that will receive the staking rewards for their deposit. + +### Reward Notification and Distribution + +- **Notify Reward Amount**: Authorized entities can notify the contract about new rewards that have been added to the pool. This resets the reward distribution duration and updates the rate at which rewards are distributed. + +### Administration and Permissions + +- **Set Admin**: Designates a new admin for the contract. Only the current admin can perform this action. +- **Enable/Disable Reward Notifier**: Allows the admin to authorize or revoke the permission of addresses to notify the contract of new rewards. + +### Utility and Maintenance + +- **Fetch or Deploy Surrogate**: Internally handles the deployment of a new Delegation Surrogate contract or selects an existing one for a specific delegatee. +- **Safe Transfer Operations**: Ensures the safe transfer of tokens to and from the contract, adhering to the ERC20 standard's security practices. +- **Checkpoints and Accumulators**: Manages checkpoints for global reward distribution and individual beneficiary reward accumulation to ensure accurate and fair reward calculations. + +### Security and Validation + +- **Unauthorized Access Handling**: The contract includes several checks to prevent unauthorized actions, such as altering delegatees or beneficiaries, withdrawing tokens, and managing admin functions. +- **Signature Validation**: Supports operations on behalf of users through EIP-712 compliant signatures, ensuring that actions such as staking, withdrawing, and claiming rewards are securely authorized. + +### Events + +- **Emitted Events**: The contract emits events for significant actions, including deposits, withdrawals, changes in delegatees or beneficiaries, reward claims, and administrative changes. These events facilitate transparency and allow tracking of contract activities. + +This smart contract introduces a comprehensive system for staking governance tokens, managing voting power delegation, and distributing rewards. It emphasizes user autonomy by allowing stakers to retain their governance rights through delegation and to designate beneficiaries for their rewards. The contract's security measures, including checks for unauthorized access and signature validation, ensure the integrity of its operations. + +*Note: to view the provided image, please see the original submission [here](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/312).* + +This sequence diagram outlines the interactions between a user, the UniStaker contract, ERC20 tokens, the Delegation Surrogate, and a reward notifier within the UniStaker system. It demonstrates the flow of stake deposits, stake modifications, withdrawals, reward claims, and reward notifications, emphasizing the contract's role in managing staked tokens, delegating voting power, and distributing rewards. + +## V3FactoryOwner Smart Contract Functionalities Overview + +### Contract Purpose and Overview + +The V3FactoryOwner contract acts as the owner of the Uniswap V3 factory, enabling privileged control over factory and pool settings, including fee management. It also allows the collection of protocol fees from pools through a public function, facilitating an arbitrage opportunity by trading a designated token amount for pool fees. + +*Note: to view the provided image, please see the original submission [here](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/312).* + +### Key Functionalities + +**Administrative Control** + +- **Set Admin**: Assigns a new admin to the contract, transferring the ability to perform privileged actions. Only the current admin can execute this change. +- **Set Payout Amount**: Updates the amount of the payout token required for claiming fees from a pool. This function is reserved for the admin. + +**Fee Management** + +- **Enable Fee Amount**: Allows the admin to enable new fee tiers within the Uniswap V3 factory, specifying the fee amount and associated tick spacing. +- **Set Fee Protocol**: Grants the admin the ability to set protocol fee percentages for individual Uniswap V3 pools, adjusting the split between liquidity providers and the protocol. + +**Fee Claiming** + +- **Claim Fees**: Open to any caller, this function enables the collection of accumulated protocol fees from a specified Uniswap V3 pool. The caller must pay a predetermined amount of a designated payout token, which is then forwarded to a specified reward receiver. + +**Constructor and Initialization** + +Upon deployment, the constructor initializes the contract by setting: +- The admin address, who will have exclusive rights to perform certain actions within the contract. +- The Uniswap V3 Factory contract instance, which this contract will own and manage. +- The payout token, used as payment for claiming pool fees. +- The initial payout amount, specifying how much of the payout token must be paid to claim pool fees. +- The reward receiver contract, which will be notified and receive the payout token when pool fees are claimed. + +**Events** + +- **`FeesClaimed`**: Emitted when protocol fees are claimed from a pool, indicating the pool address, caller, recipient of the fees, and the amounts of token0 and token1 claimed. +- **`AdminSet`**: Signals the assignment of a new admin for the contract. +- **`PayoutAmountSet`**: Announces changes to the payout amount required for claiming pool fees. + +**Error Handling** + +- **Unauthorized**: Indicates an attempt to perform an action reserved for the admin by an unauthorized address. +- **Invalid Address**: Used when an operation involves an address parameter that must not be the zero address, such as setting a new admin. +- **Invalid Payout Amount**: Triggered when attempting to set a zero payout amount, which is not allowed. +- **Insufficient Fees Collected**: Occurs if the actual fees collected from a pool are less than the amount requested by the caller. + +**Security and Permission Checks** + +- **`_revertIfNotAdmin`**: A modifier-like internal function that ensures only the admin can perform certain actions, reinforcing the contract's security by restricting sensitive operations. + +### Summary + +The V3FactoryOwner contract is a critical component for managing Uniswap V3 factory settings, including fee structures and protocol fee collection. Its design focuses on providing administrative control over key parameters while enabling an innovative mechanism for protocol fee collection. Through its public claim fees function, it incentivizes external parties to participate in protocol fee collection, creating a competitive market dynamic. This sequence diagram shows the over all flow of the functionality: + +*Note: to view the provided image, please see the original submission [here](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/312).* + +## DelegationSurrogate Smart Contract Functionalities Detailed Overview + +### Contract Purpose + +The `DelegationSurrogate` contract is designed to facilitate governance participation for token holders whose tokens are pooled. It addresses the challenge of maintaining individual governance rights in a pooled environment by allowing the delegation of voting power from pooled tokens to a specified delegatee. + +*Note: to view the provided image, please see the original submission [here](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/312).* + +### Key Functionalities + +**Constructor and Initial Setup** + +Upon deployment, the constructor performs crucial initializations to set up the contract's core functionality: + +- **Token Delegation**: The constructor takes two arguments: a governance token (`_token`) and a delegatee (`_delegatee`). It immediately delegates the voting power of any governance tokens that will be held by this contract to the specified delegatee. This delegation is crucial for ensuring that the voting power associated with pooled tokens is not lost and can be exercised according to the preferences of the token holders. +- **Token Approval for Reclaiming**: In addition to delegating voting power, the constructor sets up an approval, allowing the deployer of the contract (most likely a staking pool or another contract pooling governance tokens) to reclaim the tokens without requiring further permissions. This is done by approving the maximum possible amount of tokens (`type(uint256).max`), ensuring that the deployer can manage the tokens as needed without additional transaction overhead. + +**Operational Context** + +- **Maintaining Governance Rights**: The contract serves to ensure that token holders who contribute their tokens to a pool still have their preferences represented in governance decisions. By delegating the voting power of pooled tokens to chosen delegatees, it ensures that the governance influence of individual token holders is preserved. +- **Simplifying Token Management**: By approving the contract deployer to manage the tokens, the `DelegationSurrogate` simplifies the administrative aspect of token pooling. This setup allows for the efficient handling of tokens, enabling their movement without requiring individual approval transactions for each action. + +**Security and Permissions** + +- **Immutable Delegation and Approval**: The actions taken by the constructor - delegating voting power and setting token approval - are performed at the time of contract deployment and cannot be altered afterward. This design choice simplifies the contract's operation and enhances its security by reducing the surface area for potential malicious actions or mistakes after deployment. + +**Use Cases** + +- **Staking Pools and Governance**: The `DelegationSurrogate` is particularly useful in the context of staking pools or other mechanisms where governance tokens are pooled. It allows these structures to maintain the governance participation rights of their contributors, ensuring that the aggregation of tokens does not dilute individual governance influence. +- **Token Management Efficiency**: For contracts that manage pooled governance tokens on behalf of users, the `DelegationSurrogate` offers an efficient way to handle these tokens, particularly for operations like reallocating tokens back to users or moving them based on the pool's needs. + +### Summary + +The `DelegationSurrogate` contract is a streamlined solution designed to preserve the governance rights of token holders within pooled environments. Through its straightforward mechanism of delegating voting power and setting up token approvals at deployment, it ensures that governance participation remains effective and that token management remains efficient. + +*Note: to view the provided image, please see the original submission [here](https://github.com/code-423n4/2024-02-uniswap-foundation-findings/issues/312).* + +## Centralization Risks + +**Admin Control and Privileged Actions**: A significant centralization risk arises from the extensive control and privileged actions that an admin can perform, such as updating admin addresses, setting payout amounts, enabling or disabling reward notifiers, and other administrative functions. This centralized control could lead to potential misuse or abuse if the admin keys are compromised or if the admin acts maliciously. + +**DelegationSurrogate and Voting Power**: The use of `DelegationSurrogate` to delegate voting power centralizes the governance influence in the hands of a few, potentially skewing governance decisions. Although it aims to empower token holders, the actual implementation could lead to centralization of voting power, especially if surrogate contracts are managed or influenced by a small group. + +## Systematic Risks + +**Dependency on External Contracts and Interfaces**: The system's reliance on external contracts and interfaces like `IUniswapV3PoolOwnerActions`, `IUniswapV3FactoryOwnerActions`, and `IERC20` introduces systematic risks. Changes or vulnerabilities in these external contracts could adversely affect the functionality and security of the system. + +**Reward Distribution Mechanism**: The reward distribution mechanism, based on the notification of new rewards and the calculation of distributed rewards, introduces a risk of manipulation or errors in reward calculations. This could lead to loss of funds or unfair distribution of rewards, impacting the integrity of the staking and reward system. + +## Architectural Risks + +**Upgradability and Flexibility**: The contracts' architecture does not explicitly address upgradability or the ability to adapt to future requirements or fixes. This rigidity could lead to challenges in responding to discovered vulnerabilities, evolving governance models, or integrating with new protocols and standards. + +**Inter-contract Communication**: The architecture involves multiple contracts interacting with each other, such as the delegation of voting power through `DelegationSurrogate` and the management of rewards in `UniStaker`. This interdependency increases the complexity and the risk of unintended consequences due to errors in communication or execution logic between contracts. + +## Complexity Risks + +**Contract Complexity and Interactions**: The contracts exhibit a high degree of complexity, particularly in the management of staking, delegation, and rewards distribution. This complexity increases the risk of bugs or vulnerabilities remaining undetected despite testing and audits. + +**Understanding and Participation Barrier**: The complexity of contract interactions and the governance model may pose a barrier to understanding for potential users and participants. This could lead to lower participation in governance or staking, affecting the decentralization and security of the system. + +In summary, while the system introduces innovative mechanisms for staking, delegation, and rewards distribution, it also presents centralization, systematic, architectural, and complexity risks that should be carefully managed and mitigated through rigorous security practices, audits, and potentially introducing more decentralized governance mechanisms over time. + +### Conclusion + +The UniStaker system presents an innovative approach to staking, voting delegation, and rewards distribution within the DeFi ecosystem. While it offers significant benefits in terms of governance participation and incentive mechanisms, it also carries risks related to centralization, system dependencies, architectural rigidity, and operational complexity. Addressing these concerns through continuous audits, enhancing decentralization, and simplifying user interactions will be crucial for. + +### Time spent + +28 hours + +*** + +# Disclosures + +C4 is an open organization governed by participants in the community. + +C4 audits incentivize the discovery of exploits, vulnerabilities, and bugs in smart contracts. Security researchers are rewarded at an increasing rate for finding higher-risk issues. Audit submissions are judged by a knowledgeable security researcher and solidity developer and disclosed to sponsoring developers. C4 does not conduct formal verification regarding the provided code but instead provides final verification. + +C4 does not provide any guarantee or warranty regarding the security of this project. All smart contract software should be used at the sole risk and responsibility of users. \ No newline at end of file diff --git a/audits/2024_04_UniStaker_Cantina_Report.pdf b/audits/2024_04_UniStaker_Cantina_Report.pdf new file mode 100644 index 0000000..2cbed06 Binary files /dev/null and b/audits/2024_04_UniStaker_Cantina_Report.pdf differ diff --git a/broadcast/Deploy.s.sol/1/run-1716563645.json b/broadcast/Deploy.s.sol/1/run-1716563645.json new file mode 100644 index 0000000..042d5d5 --- /dev/null +++ b/broadcast/Deploy.s.sol/1/run-1716563645.json @@ -0,0 +1,252 @@ +{ + "transactions": [ + { + "hash": "0xb40c76d24316a801610e08a8ac917b3cdd17478fc189a71a1919c47056686019", + "transactionType": "CREATE", + "contractName": "UniStaker", + "contractAddress": "0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8", + "function": null, + "arguments": [ + "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984", + "0x71218d9e40CaC8F7C76A9ABA2De7e6aAE4E9c736" + ], + "transaction": { + "from": "0x71218d9e40cac8f7c76a9aba2de7e6aae4e9c736", + "gas": "0x4349e0", + "value": "0x0", + "input": "0x6101a06040523480156200001257600080fd5b506040516200415438038062004154833981016040819052620000359162000279565b60408051808201825260098152682ab734a9ba30b5b2b960b91b602080830191909152825180840190935260018352603160f81b90830152906200007b8260006200014c565b610120526200008c8160016200014c565b61014052815160208084019190912060e052815190820120610100524660a0526200011a60e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60805250503060c0526001600160a01b0383811661016052821661018052620001438162000185565b505050620004b6565b60006020835110156200016c576200016483620001ec565b90506200017f565b8162000179848262000374565b5060ff90505b92915050565b620001908162000238565b6004546040516001600160a01b038084169216907fbf265e8326285a2747e33e54d5945f7111f2b5edb826eb8c08d4677779b3ff9790600090a3600480546001600160a01b0319166001600160a01b0392909216919091179055565b600080829050601f8151111562000223578260405163305a27a960e01b81526004016200021a919062000440565b60405180910390fd5b8051620002308262000491565b179392505050565b6001600160a01b038116620002605760405163602c43ef60e11b815260040160405180910390fd5b50565b6001600160a01b03811681146200026057600080fd5b6000806000606084860312156200028f57600080fd5b83516200029c8162000263565b6020850151909350620002af8162000263565b6040850151909250620002c28162000263565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620002f857607f821691505b6020821081036200031957634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200036f576000816000526020600020601f850160051c810160208610156200034a5750805b601f850160051c820191505b818110156200036b5782815560010162000356565b5050505b505050565b81516001600160401b03811115620003905762000390620002cd565b620003a881620003a18454620002e3565b846200031f565b602080601f831160018114620003e05760008415620003c75750858301515b600019600386901b1c1916600185901b1785556200036b565b600085815260208120601f198616915b828110156200041157888601518255948401946001909101908401620003f0565b5085821015620004305787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006020808352835180602085015260005b81811015620004705785810183015185820160400152820162000452565b506000604082860101526040601f19601f8301168501019250505092915050565b80516020808301519190811015620003195760001960209190910360031b1b16919050565b60805160a05160c05160e0516101005161012051610140516101605161018051613c0362000551600039600081816103c601528181610bcf01528181611286015281816125e001526126da01526000818161069301528181610eb90152611a1a015260006122ac0152600061227d015260006127ec015260006127c40152600061271c01526000612747015260006127720152613c036000f3fe60806040523480156200001157600080fd5b5060043610620003615760003560e01c806389ee09f011620001c9578063b88a802f1162000101578063e69f949511620000a3578063e70f9445116200007a578063e70f944514620008e6578063edafe2c8146200091d578063f851a440146200094057600080fd5b8063e69f9495146200087f578063e6a612c31462000896578063e6dec27014620008ad57600080fd5b8063c6f6173b11620000d8578063c6f6173b1462000854578063ce4b5bbe146200085e578063ddda8a11146200087557600080fd5b8063b88a802f146200081d578063c3be99781462000827578063c3c16e4e146200084a57600080fd5b8063a677a37b116200016b578063ae0d27b61162000142578063ae0d27b61462000743578063b02c43d0146200074d578063b1fadf80146200080657600080fd5b8063a677a37b14620006e3578063a841ee281462000706578063ac9650d8146200071d57600080fd5b806399248ea711620001a057806399248ea7146200068d5780639a9b116514620006b55780639e544fff14620006cc57600080fd5b806389ee09f014620006375780638cf0f587146200065f57806398f2b576146200067657600080fd5b80635a57b46f116200029d57806376c5d758116200023f578063817b1cd21162000216578063817b1cd214620005f757806384b0196e146200060157806386312a81146200062057600080fd5b806376c5d758146200056e57806377d7a92114620005965780637ecebe0014620005be57600080fd5b806361dc0549116200027457806361dc054914620005365780636bad5e041462000540578063704b6c02146200055757600080fd5b80635a57b46f14620004f85780635ade228a14620005145780635ba8fcfe146200051f57600080fd5b80632be3a2c2116200030757806337e9f64a11620002de57806337e9f64a14620004af57806339aab4b014620004b95780633c6b16ab14620004e157600080fd5b80632be3a2c2146200043c5780632d7ef361146200045f57806331cb4bea146200048757600080fd5b80631c39b672116200033c5780631c39b67214620003c0578063228e1f3d146200040e578063255a4f73146200042557600080fd5b8063073a2ae9146200036657806314a7bcaf146200037f57806316463c5b14620003a9575b600080fd5b6200037d6200037736600462003062565b62000961565b005b620003966200039036600462003173565b6200098d565b6040519081526020015b60405180910390f35b6200037d620003ba366004620031ed565b62000a73565b620003e87f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001620003a0565b620003966200041f36600462003279565b62000b66565b6200037d6200043636600462003302565b62000c56565b620003966200044d3660046200333e565b60076020526000908152604090205481565b620003967fd5e4d3028bb2c1dddfe7c51559a12df9cdd4bf3c0579f14d78e276a15e87ea4f81565b620003967f420c9ec84cf25c36dead54f6e6827a954e8e601dea0a7d82594581c54138773281565b62000396600a5481565b620003967f300c1a75d358323d4ec7b212cd1e88afbd0250186b09c957b383ee5e6ad897f581565b6200037d620004f23660046200335c565b62000cea565b6200037d33600090815260026020526040902080546001019055565b6200039662278d0081565b6200037d6200053036600462003376565b62000fd2565b62000396600b5481565b6200037d62000551366004620033a1565b620010b0565b6200037d620005683660046200333e565b620010d7565b620003967f277b94e6cefe6a0f880d649624078c4df18c5639ffab0db19ad83a5c59b67a9681565b620003967f6bac54099c7bf34385b0fcc7cec4b62c6138950310516bf6d92b106726e80b6881565b62000396620005cf3660046200333e565b73ffffffffffffffffffffffffffffffffffffffff1660009081526002602052604090205490565b6200039660055481565b6200060b620010ec565b604051620003a0979695949392919062003439565b6200037d6200063136600462003376565b62001152565b620003967f02b86dfac8c39cc498eeafc5b86f375784c18fd83dfdc4e3620b4f0ec1042c9481565b620003966200067036600462003501565b620011e6565b62000396620006873660046200354b565b620011f6565b620003e87f000000000000000000000000000000000000000000000000000000000000000081565b6200037d620006c63660046200357a565b62001206565b62000396620006dd3660046200333e565b62001309565b62000396620006f43660046200333e565b600f6020526000908152604090205481565b6200037d62000717366004620033a1565b62001338565b620007346200072e366004620035d7565b6200135f565b604051620003a0919062003651565b620003966200145a565b620007ba6200075e3660046200335c565b6008602052600090815260409020805460018201546002909201546bffffffffffffffffffffffff82169273ffffffffffffffffffffffffffffffffffffffff6c01000000000000000000000000909304831692908116911684565b604080516bffffffffffffffffffffffff909516855273ffffffffffffffffffffffffffffffffffffffff938416602086015291831691840191909152166060820152608001620003a0565b6200037d62000817366004620031ed565b620014b9565b620003966200154d565b62000396620008383660046200333e565b60066020526000908152604090205481565b62000396600c5481565b62000396600d5481565b620003966ec097ce7bc90715b34b9f100000000081565b620003966200155a565b6200039662000890366004620036d7565b62001572565b6200037d620008a736600462003062565b6200165f565b620003e8620008be3660046200333e565b60096020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b6200090c620008f73660046200333e565b60106020526000908152604090205460ff1681565b6040519015158152602001620003a0565b620003966200092e3660046200333e565b600e6020526000908152604090205481565b600454620003e89073ffffffffffffffffffffffffffffffffffffffff1681565b60008281526008602052604090206200097b813362001686565b620009888184846200172d565b505050565b60006200099a8362001820565b62000a5e8462000a577f420c9ec84cf25c36dead54f6e6827a954e8e601dea0a7d82594581c54138773287620009fa8973ffffffffffffffffffffffffffffffffffffffff16600090815260026020526040902080546001810190915590565b8860405160200162000a3b949392919093845273ffffffffffffffffffffffffffffffffffffffff9290921660208401526040830152606082015260800190565b604051602081830303815290604052805190602001206200185b565b84620018a6565b62000a6984620018f5565b90505b9392505050565b600085815260086020526040902062000a8d818562001686565b62000a988362001820565b62000b518462000a577f277b94e6cefe6a0f880d649624078c4df18c5639ffab0db19ad83a5c59b67a9689898962000afa8b73ffffffffffffffffffffffffffffffffffffffff16600090815260026020526040902080546001810190915590565b6040805160208101969096528501939093526bffffffffffffffffffffffff909116606084015273ffffffffffffffffffffffffffffffffffffffff16608083015260a082015260c0810187905260e00162000a3b565b62000b5e81878762001a41565b505050505050565b6040517fd505accf0000000000000000000000000000000000000000000000000000000081523360048201523060248201526bffffffffffffffffffffffff881660448201526064810185905260ff8416608482015260a4810183905260c481018290526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063d505accf9060e401600060405180830381600087803b15801562000c2957600080fd5b505af192505050801562000c3b575060015b5062000c4a3389898962001c43565b98975050505050505050565b62000c6062001f1d565b73ffffffffffffffffffffffffffffffffffffffff821660008181526010602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182527fb33ca1dabfb28a2e1bd06b332c396b1a3d538278691341a5503bbad53f919197910160405180910390a25050565b3360009081526010602052604090205460ff1662000d61576040517f93bf15a50000000000000000000000000000000000000000000000000000000081527f6e6f74206e6f746966696572000000000000000000000000000000000000000060048201523360248201526044015b60405180910390fd5b62000d6b6200145a565b600d55600a54421062000dac5762278d0062000d976ec097ce7bc90715b34b9f1000000000836200379a565b62000da39190620037b4565b600c5562000e0b565b600042600a5462000dbe9190620037f0565b600c5462000dcd91906200379a565b905062278d0062000dee6ec097ce7bc90715b34b9f1000000000846200379a565b62000dfa908362003806565b62000e069190620037b4565b600c55505b62000e1a62278d004262003806565b600a5542600b55600c5462000e40906ec097ce7bc90715b34b9f100000000090620037b4565b60000362000e7a576040517f2fe5e38f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526ec097ce7bc90715b34b9f1000000000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa15801562000f16573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000f3c91906200381c565b62000f4891906200379a565b62278d00600c5462000f5b91906200379a565b111562000f94576040517fee554ac900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080518281523360208201527f48f411442545d43fc993afadc0fd408cf0d1c606f3d10d1de7b05c994463ed97910160405180910390a150565b50565b600085815260086020526040902062000fec818562001686565b62000ff78362001820565b620010a38462000a577f300c1a75d358323d4ec7b212cd1e88afbd0250186b09c957b383ee5e6ad897f5898989620010598b73ffffffffffffffffffffffffffffffffffffffff16600090815260026020526040902080546001810190915590565b60408051602081019690965285019390935273ffffffffffffffffffffffffffffffffffffffff918216606085015216608083015260a082015260c0810187905260e00162000a3b565b62000b5e8187876200172d565b6000828152600860205260409020620010ca813362001686565b6200098881848462001f9a565b620010e162001f1d565b62000fcf81620021dc565b6000606080600080600060606200110262002275565b6200110c620022a4565b604080516000808252602082019092527f0f000000000000000000000000000000000000000000000000000000000000009b939a50919850469750309650945092509050565b60008581526008602052604090206200116c818562001686565b620011778362001820565b620011d98462000a577fd5e4d3028bb2c1dddfe7c51559a12df9cdd4bf3c0579f14d78e276a15e87ea4f898989620010598b73ffffffffffffffffffffffffffffffffffffffff16600090815260026020526040902080546001810190915590565b62000b5e818787620022d3565b600062000a693385858562001c43565b600062000a6c3384843362001c43565b600086815260086020526040902062001220813362001686565b6040517fd505accf0000000000000000000000000000000000000000000000000000000081523360048201523060248201526bffffffffffffffffffffffff871660448201526064810186905260ff8516608482015260a4810184905260c481018390527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063d505accf9060e401600060405180830381600087803b158015620012e057600080fd5b505af1925050508015620012f2575060015b506200130081888862001f9a565b50505050505050565b60006ec097ce7bc90715b34b9f1000000000620013268362002439565b620013329190620037b4565b92915050565b600082815260086020526040902062001352813362001686565b6200098881848462001a41565b60608167ffffffffffffffff8111156200137d576200137d62003091565b604051908082528060200260200182016040528015620013b257816020015b60608152602001906001900390816200139c5790505b50905060005b8281101562001453576200142a30858584818110620013db57620013db62003836565b9050602002810190620013ef919062003865565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250620024d992505050565b8282815181106200143f576200143f62003836565b6020908102919091010152600101620013b8565b5092915050565b60006005546000036200146e5750600d5490565b600554600b546200147e6200155a565b6200148a9190620037f0565b600c546200149991906200379a565b620014a59190620037b4565b600d54620014b4919062003806565b905090565b6000858152600860205260409020620014d3818562001686565b620014de8362001820565b620015408462000a577f6bac54099c7bf34385b0fcc7cec4b62c6138950310516bf6d92b106726e80b6889898962000afa8b73ffffffffffffffffffffffffffffffffffffffff16600090815260026020526040902080546001810190915590565b62000b5e81878762001f9a565b6000620014b433620018f5565b600042600a54116200156d5750600a5490565b504290565b60006200157f8362001820565b620016468462000a577f02b86dfac8c39cc498eeafc5b86f375784c18fd83dfdc4e3620b4f0ec1042c948a8a8a8a620015e28c73ffffffffffffffffffffffffffffffffffffffff16600090815260026020526040902080546001810190915590565b6040805160208101979097526bffffffffffffffffffffffff9095169486019490945273ffffffffffffffffffffffffffffffffffffffff928316606086015290821660808501521660a083015260c082015260e081018790526101000162000a3b565b620016548488888862001c43565b979650505050505050565b600082815260086020526040902062001679813362001686565b62000988818484620022d3565b815473ffffffffffffffffffffffffffffffffffffffff8281166c01000000000000000000000000909204161462001729576040517f93bf15a50000000000000000000000000000000000000000000000000000000081527f6e6f74206f776e65720000000000000000000000000000000000000000000000600482015273ffffffffffffffffffffffffffffffffffffffff8216602482015260440162000d58565b5050565b620017388162002562565b600183015473ffffffffffffffffffffffffffffffffffffffff908116600081815260096020908152604091829020548251938452858516918401919091529092169184917f4ac5bca5b979462f72ac2586d359f46427c09a49b337dcbd3ca9975140101694910160405180910390a26001840180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790556000620017f783620025b0565b85549091506200181990839083906bffffffffffffffffffffffff16620026d4565b5050505050565b8042111562000fcf576040517f537c993600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000620013326200186b62002702565b836040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b6000620018b58484846200283d565b905080620018ef576040517fb0d4837c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b600062001901620028c2565b6200190c82620028de565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600f60205260408120546200194e906ec097ce7bc90715b34b9f100000000090620037b4565b905080600003620019625750600092915050565b6200197d6ec097ce7bc90715b34b9f1000000000826200379a565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600f6020526040902054620019af9190620037f0565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600f6020526040908190209290925590517f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f72419062001a0c9084815260200190565b60405180910390a2620013327f0000000000000000000000000000000000000000000000000000000000000000848362002924565b62001a4b620028c2565b600283015462001a719073ffffffffffffffffffffffffffffffffffffffff16620028de565b82548190849060009062001a959084906bffffffffffffffffffffffff16620038d4565b92506101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550806bffffffffffffffffffffffff166005600082825462001ae59190620037f0565b909155505082546c01000000000000000000000000900473ffffffffffffffffffffffffffffffffffffffff16600090815260066020526040812080546bffffffffffffffffffffffff8416929062001b40908490620037f0565b9091555050600283015473ffffffffffffffffffffffffffffffffffffffff16600090815260076020526040812080546bffffffffffffffffffffffff8416929062001b8e908490620037f0565b9091555050600183015473ffffffffffffffffffffffffffffffffffffffff908116600090815260096020526040902054845462001bf192918216916c01000000000000000000000000909104166bffffffffffffffffffffffff8416620026d4565b8254604080516bffffffffffffffffffffffff8085168252909216602083015283917fcda86d0ec3f513f43f5512de1982307d90747e4da0550585ca8744cbc7d8619f910160405180910390a2505050565b600062001c508362002562565b62001c5b8262002562565b62001c65620028c2565b62001c7082620028de565b600062001c7d84620025b0565b905062001c89620029a7565b9150846bffffffffffffffffffffffff166005600082825462001cad919062003806565b909155505073ffffffffffffffffffffffffffffffffffffffff8616600090815260066020526040812080546bffffffffffffffffffffffff8816929062001cf790849062003806565b909155505073ffffffffffffffffffffffffffffffffffffffff8316600090815260076020526040812080546bffffffffffffffffffffffff8816929062001d4190849062003806565b9091555050604080516080810182526bffffffffffffffffffffffff80881680835273ffffffffffffffffffffffffffffffffffffffff808b1660208086019182528a83168688019081528a84166060880190815260008b81526008909352979091209551915183166c01000000000000000000000000029190941617845591516001840180549184167fffffffffffffffffffffffff0000000000000000000000000000000000000000928316179055935160029093018054939092169290931691909117905562001e189087908390620026d4565b6040805173ffffffffffffffffffffffffffffffffffffffff881681526bffffffffffffffffffffffff87166020820181905281830152905183917feb6032fe8d7a2f7003e5b33948bdc807f994be970351cd021a033784812c8baa919081900360600190a260405173ffffffffffffffffffffffffffffffffffffffff84169060009084907fe1fcac5fc7d2f61f04d109cb8169e6163bdf912d84879a78652bb7b93573cc7c908390a4604080516000815273ffffffffffffffffffffffffffffffffffffffff8616602082015283917f4ac5bca5b979462f72ac2586d359f46427c09a49b337dcbd3ca9975140101694910160405180910390a250949350505050565b60045473ffffffffffffffffffffffffffffffffffffffff16331462001f98576040517f93bf15a50000000000000000000000000000000000000000000000000000000081527f6e6f742061646d696e0000000000000000000000000000000000000000000000600482015233602482015260440162000d58565b565b62001fa4620028c2565b600283015462001fca9073ffffffffffffffffffffffffffffffffffffffff16620028de565b600183015473ffffffffffffffffffffffffffffffffffffffff9081166000908152600960205260408120546005805491909316926bffffffffffffffffffffffff85169290916200201e90849062003806565b909155505083546c01000000000000000000000000900473ffffffffffffffffffffffffffffffffffffffff16600090815260066020526040812080546bffffffffffffffffffffffff851692906200207990849062003806565b9091555050600284015473ffffffffffffffffffffffffffffffffffffffff16600090815260076020526040812080546bffffffffffffffffffffffff85169290620020c790849062003806565b9091555050835482908590600090620020f09084906bffffffffffffffffffffffff16620038fc565b92506101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055506200215d84600001600c9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682846bffffffffffffffffffffffff16620026d4565b8354604080516c01000000000000000000000000830473ffffffffffffffffffffffffffffffffffffffff1681526bffffffffffffffffffffffff80861660208301529092169082015283907feb6032fe8d7a2f7003e5b33948bdc807f994be970351cd021a033784812c8baa9060600160405180910390a250505050565b620021e78162002562565b60045460405173ffffffffffffffffffffffffffffffffffffffff8084169216907fbf265e8326285a2747e33e54d5945f7111f2b5edb826eb8c08d4677779b3ff9790600090a3600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6060620014b47f00000000000000000000000000000000000000000000000000000000000000006000620029bd565b6060620014b47f00000000000000000000000000000000000000000000000000000000000000006001620029bd565b620022de8162002562565b620022e8620028c2565b60028301546200230e9073ffffffffffffffffffffffffffffffffffffffff16620028de565b8254600284015473ffffffffffffffffffffffffffffffffffffffff16600090815260076020526040812080546bffffffffffffffffffffffff909316929091906200235c908490620037f0565b909155506200236d905081620028de565b600283015460405173ffffffffffffffffffffffffffffffffffffffff80841692169084907fe1fcac5fc7d2f61f04d109cb8169e6163bdf912d84879a78652bb7b93573cc7c90600090a46002830180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091558354600091825260076020526040822080546bffffffffffffffffffffffff9092169290916200242f90849062003806565b9091555050505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600e6020526040812054620024696200145a565b620024759190620037f0565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260076020526040902054620024a791906200379a565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600f602052604090205462001332919062003806565b60606000808473ffffffffffffffffffffffffffffffffffffffff168460405162002505919062003924565b600060405180830381855af49150503d806000811462002542576040519150601f19603f3d011682016040523d82523d6000602084013e62002547565b606091505b50915091506200255985838362002a75565b95945050505050565b73ffffffffffffffffffffffffffffffffffffffff811662000fcf576040517fc05887de00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8082166000908152600960205260409020541680620026cf577f0000000000000000000000000000000000000000000000000000000000000000826040516200260e906200302f565b73ffffffffffffffffffffffffffffffffffffffff928316815291166020820152604001604051809103906000f0801580156200264f573d6000803e3d6000fd5b5073ffffffffffffffffffffffffffffffffffffffff83811660008181526009602052604080822080547fffffffffffffffffffffffff000000000000000000000000000000000000000016948616948517905551939450919290917f53ff145c5d53f9465a0d97719aeab68428f349b2cf0b009e9dd75b94b315d7be91a35b919050565b620009887f000000000000000000000000000000000000000000000000000000000000000084848462002b0c565b60003073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161480156200276957507f000000000000000000000000000000000000000000000000000000000000000046145b156200279457507f000000000000000000000000000000000000000000000000000000000000000090565b620014b4604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60008060006200284e858562002b54565b50909250905060008160038111156200286b576200286b62003942565b148015620028a457508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b80620028b85750620028b886868662002ba5565b9695505050505050565b620028cc6200145a565b600d55620028d96200155a565b600b55565b620028e98162002439565b73ffffffffffffffffffffffffffffffffffffffff9091166000908152600f6020908152604080832093909355600d54600e90915291902055565b60405173ffffffffffffffffffffffffffffffffffffffff8381166024830152604482018390526200098891859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505062002cfc565b600354620029b781600162003806565b60035590565b606060ff8314620029db57620029d38362002d99565b905062001332565b818054620029e99062003971565b80601f016020809104026020016040519081016040528092919081815260200182805462002a179062003971565b801562002a685780601f1062002a3c5761010080835404028352916020019162002a68565b820191906000526020600020905b81548152906001019060200180831162002a4a57829003601f168201915b5050505050905062001332565b60608262002a8e5762002a888262002dda565b62000a6c565b815115801562002ab3575073ffffffffffffffffffffffffffffffffffffffff84163b155b1562002b04576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240162000d58565b508062000a6c565b60405173ffffffffffffffffffffffffffffffffffffffff8481166024830152838116604483015260648201839052620018ef9186918216906323b872dd906084016200295f565b6000806000835160410362002b925760208401516040850151606086015160001a62002b838882858562002e1d565b95509550955050505062002b9e565b50508151600091506002905b9250925092565b60008060008573ffffffffffffffffffffffffffffffffffffffff16858560405160240162002bd6929190620039c6565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1626ba7e000000000000000000000000000000000000000000000000000000001790525162002c59919062003924565b600060405180830381855afa9150503d806000811462002c96576040519150601f19603f3d011682016040523d82523d6000602084013e62002c9b565b606091505b509150915081801562002cb057506020815110155b8015620028b8575080517f1626ba7e000000000000000000000000000000000000000000000000000000009062002cf190830160209081019084016200381c565b149695505050505050565b600062002d2073ffffffffffffffffffffffffffffffffffffffff84168362002f1c565b9050805160001415801562002d4857508080602001905181019062002d469190620039e1565b155b1562000988576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260240162000d58565b6060600062002da88362002f2c565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b80511562002deb5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a084111562002e5a575060009150600390508262002f12565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa15801562002eaf573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811662002f085750600092506001915082905062002f12565b9250600091508190505b9450945094915050565b606062000a6c8383600062002f6e565b600060ff8216601f81111562001332576040517fb3512b0c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608147101562002fae576040517fcd78605900000000000000000000000000000000000000000000000000000000815230600482015260240162000d58565b6000808573ffffffffffffffffffffffffffffffffffffffff16848660405162002fd9919062003924565b60006040518083038185875af1925050503d806000811462003018576040519150601f19603f3d011682016040523d82523d6000602084013e6200301d565b606091505b5091509150620028b886838362002a75565b6101cc8062003a0283390190565b803573ffffffffffffffffffffffffffffffffffffffff81168114620026cf57600080fd5b600080604083850312156200307657600080fd5b8235915062003088602084016200303d565b90509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f830112620030d257600080fd5b813567ffffffffffffffff80821115620030f057620030f062003091565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171562003139576200313962003091565b816040528381528660208588010111156200315357600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000606084860312156200318957600080fd5b62003194846200303d565b925060208401359150604084013567ffffffffffffffff811115620031b857600080fd5b620031c686828701620030c0565b9150509250925092565b80356bffffffffffffffffffffffff81168114620026cf57600080fd5b600080600080600060a086880312156200320657600080fd5b853594506200321860208701620031d0565b935062003228604087016200303d565b925060608601359150608086013567ffffffffffffffff8111156200324c57600080fd5b6200325a88828901620030c0565b9150509295509295909350565b803560ff81168114620026cf57600080fd5b600080600080600080600060e0888a0312156200329557600080fd5b620032a088620031d0565b9650620032b0602089016200303d565b9550620032c0604089016200303d565b945060608801359350620032d76080890162003267565b925060a0880135915060c0880135905092959891949750929550565b801515811462000fcf57600080fd5b600080604083850312156200331657600080fd5b62003321836200303d565b915060208301356200333381620032f3565b809150509250929050565b6000602082840312156200335157600080fd5b62000a6c826200303d565b6000602082840312156200336f57600080fd5b5035919050565b600080600080600060a086880312156200338f57600080fd5b8535945062003218602087016200303d565b60008060408385031215620033b557600080fd5b823591506200308860208401620031d0565b60005b83811015620033e4578181015183820152602001620033ca565b50506000910152565b6000815180845262003407816020860160208601620033c7565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b7fff00000000000000000000000000000000000000000000000000000000000000881681526000602060e060208401526200347860e084018a620033ed565b83810360408501526200348c818a620033ed565b6060850189905273ffffffffffffffffffffffffffffffffffffffff8816608086015260a0850187905284810360c08601528551808252602080880193509091019060005b81811015620034ef57835183529284019291840191600101620034d1565b50909c9b505050505050505050505050565b6000806000606084860312156200351757600080fd5b6200352284620031d0565b925062003532602085016200303d565b915062003542604085016200303d565b90509250925092565b600080604083850312156200355f57600080fd5b6200356a83620031d0565b915062003088602084016200303d565b60008060008060008060c087890312156200359457600080fd5b86359550620035a660208801620031d0565b945060408701359350620035bd6060880162003267565b92506080870135915060a087013590509295509295509295565b60008060208385031215620035eb57600080fd5b823567ffffffffffffffff808211156200360457600080fd5b818501915085601f8301126200361957600080fd5b8135818111156200362957600080fd5b8660208260051b85010111156200363f57600080fd5b60209290920196919550909350505050565b600060208083016020845280855180835260408601915060408160051b87010192506020870160005b82811015620036ca577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452620036b7858351620033ed565b945092850192908501906001016200367a565b5092979650505050505050565b60008060008060008060c08789031215620036f157600080fd5b620036fc87620031d0565b95506200370c602088016200303d565b94506200371c604088016200303d565b93506200372c606088016200303d565b92506080870135915060a087013567ffffffffffffffff8111156200375057600080fd5b6200375e89828a01620030c0565b9150509295509295509295565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820281158282048414176200133257620013326200376b565b600082620037eb577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b818103818111156200133257620013326200376b565b808201808211156200133257620013326200376b565b6000602082840312156200382f57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126200389b57600080fd5b83018035915067ffffffffffffffff821115620038b757600080fd5b602001915036819003821315620038cd57600080fd5b9250929050565b6bffffffffffffffffffffffff8281168282160390808211156200145357620014536200376b565b6bffffffffffffffffffffffff8181168382160190808211156200145357620014536200376b565b6000825162003938818460208701620033c7565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600181811c908216806200398657607f821691505b602082108103620039c0577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b82815260406020820152600062000a696040830184620033ed565b600060208284031215620039f457600080fd5b815162000a6c81620032f356fe608060405234801561001057600080fd5b506040516101cc3803806101cc83398101604081905261002f9161011c565b6040516317066a5760e21b81526001600160a01b038281166004830152831690635c19a95c90602401600060405180830381600087803b15801561007257600080fd5b505af1158015610086573d6000803e3d6000fd5b505060405163095ea7b360e01b815233600482015260001960248201526001600160a01b038516925063095ea7b391506044016020604051808303816000875af11580156100d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100fc9190610156565b50505061017f565b6001600160a01b038116811461011957600080fd5b50565b6000806040838503121561012f57600080fd5b825161013a81610104565b602084015190925061014b81610104565b809150509250929050565b60006020828403121561016857600080fd5b8151801515811461017857600080fd5b9392505050565b603f8061018d6000396000f3fe6080604052600080fdfea2646970667358221220defe974d338236b7160b55d8085409609e608cac3ae33625fa36e65bc712a3f364736f6c63430008170033a2646970667358221220881acdf2b86321ce5553f215df4ff4b0142142c1d27dc4e4686ac1dfc4d2076264736f6c63430008170033000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f98400000000000000000000000071218d9e40cac8f7c76a9aba2de7e6aae4e9c736", + "nonce": "0x1", + "chainId": "0x1" + }, + "additionalContracts": [], + "isFixedGasLimit": false + }, + { + "hash": "0x63364db99bef2d65a5dc0cc0e1b4e3fd544360282c71a2d8bf9f9ca8be3fcce8", + "transactionType": "CREATE", + "contractName": "V3FactoryOwner", + "contractAddress": "0x2e27332b25ce245f6628377bc83573a001313c58", + "function": null, + "arguments": [ + "0x1a9C8182C09F50C8318d769245beA52c32BE35BC", + "0x1F98431c8aD98523631AE4a59f267346ea31F984", + "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "10000000000000000000", + "0xE3071e87a7E6dD19A911Dbf1127BA9dD67Aa6fc8" + ], + "transaction": { + "from": "0x71218d9e40cac8f7c76a9aba2de7e6aae4e9c736", + "gas": "0x104eca", + "value": "0x0", + "input": "0x60e060405234801561001057600080fd5b50604051610edf380380610edf83398101604081905261002f91610127565b6001600160a01b0385166100565760405163a553972760e01b815260040160405180910390fd5b816000036100775760405163b4230b9d60e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0387811691821790925585821660805284821660a052600084815591831660c0526040519091907fbf265e8326285a2747e33e54d5945f7111f2b5edb826eb8c08d4677779b3ff97908290a360405182906000907f8f6c5c01f9385e42ed275713f18de607d67ea7f6673e431418c8b286057a2207908290a35050505050610192565b6001600160a01b038116811461012457600080fd5b50565b600080600080600060a0868803121561013f57600080fd5b855161014a8161010f565b602087015190955061015b8161010f565b604087015190945061016c8161010f565b6060870151608088015191945092506101848161010f565b809150509295509295909350565b60805160a05160c051610d036101dc6000396000818161017e015281816104d3015261056f0152600081816101e101526104f701526000818160c801526104550152610d036000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c80638a7c195f11610076578063bf2d5f1b1161005b578063bf2d5f1b146101a0578063e2f6f511146101dc578063f851a4401461020357600080fd5b80638a7c195f14610166578063a508ff6c1461017957600080fd5b80636b46c8c3116100a75780636b46c8c314610129578063704b6c02146101405780637f4d39451461015357600080fd5b80632dd31000146100c357806336077b3c14610114575b600080fd5b6100ea7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b610127610122366004610b10565b610223565b005b61013260005481565b60405190815260200161010b565b61012761014e366004610b55565b6102ba565b610127610161366004610b72565b61039d565b610127610174366004610b8b565b610410565b6100ea7f000000000000000000000000000000000000000000000000000000000000000081565b6101b36101ae366004610bf1565b6104ca565b604080516fffffffffffffffffffffffffffffffff93841681529290911660208301520161010b565b6100ea7f000000000000000000000000000000000000000000000000000000000000000081565b6001546100ea9073ffffffffffffffffffffffffffffffffffffffff1681565b61022b61079e565b6040517f8206a4d100000000000000000000000000000000000000000000000000000000815260ff80841660048301528216602482015273ffffffffffffffffffffffffffffffffffffffff841690638206a4d190604401600060405180830381600087803b15801561029d57600080fd5b505af11580156102b1573d6000803e3d6000fd5b50505050505050565b6102c261079e565b73ffffffffffffffffffffffffffffffffffffffff811661030f576040517fa553972700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60015460405173ffffffffffffffffffffffffffffffffffffffff8084169216907fbf265e8326285a2747e33e54d5945f7111f2b5edb826eb8c08d4677779b3ff9790600090a3600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6103a561079e565b806000036103df576040517fb4230b9d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805460405183927f8f6c5c01f9385e42ed275713f18de607d67ea7f6673e431418c8b286057a220791a3600055565b61041861079e565b6040517f8a7c195f00000000000000000000000000000000000000000000000000000000815262ffffff83166004820152600282900b60248201527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690638a7c195f90604401600060405180830381600087803b1580156104ae57600080fd5b505af11580156104c2573d6000803e3d6000fd5b505050505050565b60008061053c337f00000000000000000000000000000000000000000000000000000000000000006000547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166107f1909392919063ffffffff16565b6000546040517f3c6b16ab00000000000000000000000000000000000000000000000000000000815260048101919091527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690633c6b16ab90602401600060405180830381600087803b1580156105c857600080fd5b505af11580156105dc573d6000803e3d6000fd5b50506040517f85b6672900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88811660048301526fffffffffffffffffffffffffffffffff808916602484015287166044830152600093508392508916906385b667299060640160408051808303816000875af1158015610672573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106969190610c4d565b91509150856fffffffffffffffffffffffffffffffff16826fffffffffffffffffffffffffffffffff1610806106ef5750846fffffffffffffffffffffffffffffffff16816fffffffffffffffffffffffffffffffff16105b15610726576040517f0790df8600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516fffffffffffffffffffffffffffffffff80851682528316602082015273ffffffffffffffffffffffffffffffffffffffff808a16923392918c16917fd377f58cbc83f844989775f0d4bfa247dbee70bf3d851b8c5f0e0fe51d3b6ef9910160405180910390a49097909650945050505050565b60015473ffffffffffffffffffffffffffffffffffffffff1633146107ef576040517fd064e4bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905261088690859061088c565b50505050565b60006108ae73ffffffffffffffffffffffffffffffffffffffff84168361092c565b905080516000141580156108d35750808060200190518101906108d19190610c7c565b155b15610927576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201526024015b60405180910390fd5b505050565b606061093a83836000610941565b9392505050565b60608147101561097f576040517fcd78605900000000000000000000000000000000000000000000000000000000815230600482015260240161091e565b6000808573ffffffffffffffffffffffffffffffffffffffff1684866040516109a89190610c9e565b60006040518083038185875af1925050503d80600081146109e5576040519150601f19603f3d011682016040523d82523d6000602084013e6109ea565b606091505b50915091506109fa868383610a04565b9695505050505050565b606082610a1957610a1482610a93565b61093a565b8151158015610a3d575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610a8c576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240161091e565b508061093a565b805115610aa35780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b73ffffffffffffffffffffffffffffffffffffffff81168114610ad557600080fd5b803560ff81168114610b0b57600080fd5b919050565b600080600060608486031215610b2557600080fd5b8335610b3081610ad8565b9250610b3e60208501610afa565b9150610b4c60408501610afa565b90509250925092565b600060208284031215610b6757600080fd5b813561093a81610ad8565b600060208284031215610b8457600080fd5b5035919050565b60008060408385031215610b9e57600080fd5b823562ffffff81168114610bb157600080fd5b91506020830135600281900b8114610bc857600080fd5b809150509250929050565b6fffffffffffffffffffffffffffffffff81168114610ad557600080fd5b60008060008060808587031215610c0757600080fd5b8435610c1281610ad8565b93506020850135610c2281610ad8565b92506040850135610c3281610bd3565b91506060850135610c4281610bd3565b939692955090935050565b60008060408385031215610c6057600080fd5b8251610c6b81610bd3565b6020840151909250610bc881610bd3565b600060208284031215610c8e57600080fd5b8151801515811461093a57600080fd5b6000825160005b81811015610cbf5760208186018101518583015201610ca5565b50600092019182525091905056fea264697066735822122008a6b35575393a510061efd1eae133068932958d79f59515eea9f79583b84b1f64736f6c634300081700330000000000000000000000001a9c8182c09f50c8318d769245bea52c32be35bc0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f984000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000008ac7230489e80000000000000000000000000000e3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8", + "nonce": "0x2", + "chainId": "0x1" + }, + "additionalContracts": [], + "isFixedGasLimit": false + }, + { + "hash": "0xd31c4bc43c244a0e70c861ff4b5ffb160a75041466c3f3969366d87af9732e0f", + "transactionType": "CALL", + "contractName": "UniStaker", + "contractAddress": "0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8", + "function": "setRewardNotifier(address,bool)", + "arguments": [ + "0x2e27332b25Ce245F6628377bc83573A001313C58", + "true" + ], + "transaction": { + "from": "0x71218d9e40cac8f7c76a9aba2de7e6aae4e9c736", + "to": "0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8", + "gas": "0x1024b", + "value": "0x0", + "input": "0x255a4f730000000000000000000000002e27332b25ce245f6628377bc83573a001313c580000000000000000000000000000000000000000000000000000000000000001", + "nonce": "0x3", + "chainId": "0x1" + }, + "additionalContracts": [], + "isFixedGasLimit": false + }, + { + "hash": "0xc2d0e810c682b52aec3e1b8687bea9a706f37099b6e0736edb561d38c521205a", + "transactionType": "CALL", + "contractName": "UniStaker", + "contractAddress": "0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8", + "function": "setAdmin(address)", + "arguments": [ + "0x1a9C8182C09F50C8318d769245beA52c32BE35BC" + ], + "transaction": { + "from": "0x71218d9e40cac8f7c76a9aba2de7e6aae4e9c736", + "to": "0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8", + "gas": "0x9b1f", + "value": "0x0", + "input": "0x704b6c020000000000000000000000001a9c8182c09f50c8318d769245bea52c32be35bc", + "nonce": "0x4", + "chainId": "0x1" + }, + "additionalContracts": [], + "isFixedGasLimit": false + } + ], + "receipts": [ + { + "status": "0x1", + "cumulativeGasUsed": "0x103bc5f", + "logs": [ + { + "address": "0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8", + "topics": [ + "0xbf265e8326285a2747e33e54d5945f7111f2b5edb826eb8c08d4677779b3ff97", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000071218d9e40cac8f7c76a9aba2de7e6aae4e9c736" + ], + "data": "0x", + "blockHash": "0xb82652f0e42b1cf06e33e98c6f42104659bd5f005d8cc36e96ab9a2718fe4076", + "blockNumber": "0x13044d2", + "transactionHash": "0xb40c76d24316a801610e08a8ac917b3cdd17478fc189a71a1919c47056686019", + "transactionIndex": "0x72", + "logIndex": "0x1c1", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000000000000000000000000000040000000000000000000000000000020000000000000000000000000000000100000000000000000000000000000000000000000000000000002000000000000000000000000000000800000000020000000000000000000800010000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "type": "0x2", + "transactionHash": "0xb40c76d24316a801610e08a8ac917b3cdd17478fc189a71a1919c47056686019", + "transactionIndex": "0x72", + "blockHash": "0xb82652f0e42b1cf06e33e98c6f42104659bd5f005d8cc36e96ab9a2718fe4076", + "blockNumber": "0x13044d2", + "gasUsed": "0x33c6c9", + "effectiveGasPrice": "0x366f0d3c3", + "from": "0x71218d9e40cac8f7c76a9aba2de7e6aae4e9c736", + "to": null, + "contractAddress": "0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8" + }, + { + "status": "0x1", + "cumulativeGasUsed": "0x13fe4b8", + "logs": [ + { + "address": "0x2e27332b25ce245f6628377bc83573a001313c58", + "topics": [ + "0xbf265e8326285a2747e33e54d5945f7111f2b5edb826eb8c08d4677779b3ff97", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000001a9c8182c09f50c8318d769245bea52c32be35bc" + ], + "data": "0x", + "blockHash": "0xb82652f0e42b1cf06e33e98c6f42104659bd5f005d8cc36e96ab9a2718fe4076", + "blockNumber": "0x13044d2", + "transactionHash": "0x63364db99bef2d65a5dc0cc0e1b4e3fd544360282c71a2d8bf9f9ca8be3fcce8", + "transactionIndex": "0xa1", + "logIndex": "0x206", + "removed": false + }, + { + "address": "0x2e27332b25ce245f6628377bc83573a001313c58", + "topics": [ + "0x8f6c5c01f9385e42ed275713f18de607d67ea7f6673e431418c8b286057a2207", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000000000008ac7230489e80000" + ], + "data": "0x", + "blockHash": "0xb82652f0e42b1cf06e33e98c6f42104659bd5f005d8cc36e96ab9a2718fe4076", + "blockNumber": "0x13044d2", + "transactionHash": "0x63364db99bef2d65a5dc0cc0e1b4e3fd544360282c71a2d8bf9f9ca8be3fcce8", + "transactionIndex": "0xa1", + "logIndex": "0x207", + "removed": false + } + ], + "logsBloom": "0x00000000040000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000020004000000000000000800000000000000000000000000000000000000000000000008000000000000100010000000000100008000200000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000040000000000000000000000800000000000000008", + "type": "0x2", + "transactionHash": "0x63364db99bef2d65a5dc0cc0e1b4e3fd544360282c71a2d8bf9f9ca8be3fcce8", + "transactionIndex": "0xa1", + "blockHash": "0xb82652f0e42b1cf06e33e98c6f42104659bd5f005d8cc36e96ab9a2718fe4076", + "blockNumber": "0x13044d2", + "gasUsed": "0xc8c59", + "effectiveGasPrice": "0x366f0d3c3", + "from": "0x71218d9e40cac8f7c76a9aba2de7e6aae4e9c736", + "to": null, + "contractAddress": "0x2e27332b25ce245f6628377bc83573a001313c58" + }, + { + "status": "0x1", + "cumulativeGasUsed": "0x1c8c10e", + "logs": [ + { + "address": "0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8", + "topics": [ + "0xb33ca1dabfb28a2e1bd06b332c396b1a3d538278691341a5503bbad53f919197", + "0x0000000000000000000000002e27332b25ce245f6628377bc83573a001313c58" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "blockHash": "0xb82652f0e42b1cf06e33e98c6f42104659bd5f005d8cc36e96ab9a2718fe4076", + "blockNumber": "0x13044d2", + "transactionHash": "0xd31c4bc43c244a0e70c861ff4b5ffb160a75041466c3f3969366d87af9732e0f", + "transactionIndex": "0xf0", + "logIndex": "0x30e", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000200000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000001010000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000", + "type": "0x2", + "transactionHash": "0xd31c4bc43c244a0e70c861ff4b5ffb160a75041466c3f3969366d87af9732e0f", + "transactionIndex": "0xf0", + "blockHash": "0xb82652f0e42b1cf06e33e98c6f42104659bd5f005d8cc36e96ab9a2718fe4076", + "blockNumber": "0x13044d2", + "gasUsed": "0xbb00", + "effectiveGasPrice": "0x366f0d3c3", + "from": "0x71218d9e40cac8f7c76a9aba2de7e6aae4e9c736", + "to": "0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8", + "contractAddress": null + }, + { + "status": "0x1", + "cumulativeGasUsed": "0xa17537", + "logs": [ + { + "address": "0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8", + "topics": [ + "0xbf265e8326285a2747e33e54d5945f7111f2b5edb826eb8c08d4677779b3ff97", + "0x00000000000000000000000071218d9e40cac8f7c76a9aba2de7e6aae4e9c736", + "0x0000000000000000000000001a9c8182c09f50c8318d769245bea52c32be35bc" + ], + "data": "0x", + "blockHash": "0xd1d09893467d1df1579539cc6832043b8f283702db4507b75b154b48a02290b1", + "blockNumber": "0x13044d3", + "transactionHash": "0xc2d0e810c682b52aec3e1b8687bea9a706f37099b6e0736edb561d38c521205a", + "transactionIndex": "0x7f", + "logIndex": "0x121", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000000000000000000000000000040000000000000000000000000000020000000000000000000000000000000100000000000000000000000000000000000000000000000000002000000000000000000000000000000800000000000000000000000000000000010000000000000000000000000000000000000000001000000000000000000010000000000100000000000000000000000008000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000", + "type": "0x2", + "transactionHash": "0xc2d0e810c682b52aec3e1b8687bea9a706f37099b6e0736edb561d38c521205a", + "transactionIndex": "0x7f", + "blockHash": "0xd1d09893467d1df1579539cc6832043b8f283702db4507b75b154b48a02290b1", + "blockNumber": "0x13044d3", + "gasUsed": "0x704f", + "effectiveGasPrice": "0x3d3aabd5a", + "from": "0x71218d9e40cac8f7c76a9aba2de7e6aae4e9c736", + "to": "0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8", + "contractAddress": null + } + ], + "libraries": [], + "pending": [], + "returns": { + "0": { + "internal_type": "contract V3FactoryOwner", + "value": "0x2e27332b25Ce245F6628377bc83573A001313C58" + }, + "1": { + "internal_type": "contract UniStaker", + "value": "0xE3071e87a7E6dD19A911Dbf1127BA9dD67Aa6fc8" + } + }, + "timestamp": 1716563645, + "chain": 1, + "commit": "ff79c33" +} \ No newline at end of file diff --git a/broadcast/Deploy.s.sol/1/run-latest.json b/broadcast/Deploy.s.sol/1/run-latest.json new file mode 100644 index 0000000..042d5d5 --- /dev/null +++ b/broadcast/Deploy.s.sol/1/run-latest.json @@ -0,0 +1,252 @@ +{ + "transactions": [ + { + "hash": "0xb40c76d24316a801610e08a8ac917b3cdd17478fc189a71a1919c47056686019", + "transactionType": "CREATE", + "contractName": "UniStaker", + "contractAddress": "0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8", + "function": null, + "arguments": [ + "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984", + "0x71218d9e40CaC8F7C76A9ABA2De7e6aAE4E9c736" + ], + "transaction": { + "from": "0x71218d9e40cac8f7c76a9aba2de7e6aae4e9c736", + "gas": "0x4349e0", + "value": "0x0", + "input": "0x6101a06040523480156200001257600080fd5b506040516200415438038062004154833981016040819052620000359162000279565b60408051808201825260098152682ab734a9ba30b5b2b960b91b602080830191909152825180840190935260018352603160f81b90830152906200007b8260006200014c565b610120526200008c8160016200014c565b61014052815160208084019190912060e052815190820120610100524660a0526200011a60e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60805250503060c0526001600160a01b0383811661016052821661018052620001438162000185565b505050620004b6565b60006020835110156200016c576200016483620001ec565b90506200017f565b8162000179848262000374565b5060ff90505b92915050565b620001908162000238565b6004546040516001600160a01b038084169216907fbf265e8326285a2747e33e54d5945f7111f2b5edb826eb8c08d4677779b3ff9790600090a3600480546001600160a01b0319166001600160a01b0392909216919091179055565b600080829050601f8151111562000223578260405163305a27a960e01b81526004016200021a919062000440565b60405180910390fd5b8051620002308262000491565b179392505050565b6001600160a01b038116620002605760405163602c43ef60e11b815260040160405180910390fd5b50565b6001600160a01b03811681146200026057600080fd5b6000806000606084860312156200028f57600080fd5b83516200029c8162000263565b6020850151909350620002af8162000263565b6040850151909250620002c28162000263565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620002f857607f821691505b6020821081036200031957634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200036f576000816000526020600020601f850160051c810160208610156200034a5750805b601f850160051c820191505b818110156200036b5782815560010162000356565b5050505b505050565b81516001600160401b03811115620003905762000390620002cd565b620003a881620003a18454620002e3565b846200031f565b602080601f831160018114620003e05760008415620003c75750858301515b600019600386901b1c1916600185901b1785556200036b565b600085815260208120601f198616915b828110156200041157888601518255948401946001909101908401620003f0565b5085821015620004305787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006020808352835180602085015260005b81811015620004705785810183015185820160400152820162000452565b506000604082860101526040601f19601f8301168501019250505092915050565b80516020808301519190811015620003195760001960209190910360031b1b16919050565b60805160a05160c05160e0516101005161012051610140516101605161018051613c0362000551600039600081816103c601528181610bcf01528181611286015281816125e001526126da01526000818161069301528181610eb90152611a1a015260006122ac0152600061227d015260006127ec015260006127c40152600061271c01526000612747015260006127720152613c036000f3fe60806040523480156200001157600080fd5b5060043610620003615760003560e01c806389ee09f011620001c9578063b88a802f1162000101578063e69f949511620000a3578063e70f9445116200007a578063e70f944514620008e6578063edafe2c8146200091d578063f851a440146200094057600080fd5b8063e69f9495146200087f578063e6a612c31462000896578063e6dec27014620008ad57600080fd5b8063c6f6173b11620000d8578063c6f6173b1462000854578063ce4b5bbe146200085e578063ddda8a11146200087557600080fd5b8063b88a802f146200081d578063c3be99781462000827578063c3c16e4e146200084a57600080fd5b8063a677a37b116200016b578063ae0d27b61162000142578063ae0d27b61462000743578063b02c43d0146200074d578063b1fadf80146200080657600080fd5b8063a677a37b14620006e3578063a841ee281462000706578063ac9650d8146200071d57600080fd5b806399248ea711620001a057806399248ea7146200068d5780639a9b116514620006b55780639e544fff14620006cc57600080fd5b806389ee09f014620006375780638cf0f587146200065f57806398f2b576146200067657600080fd5b80635a57b46f116200029d57806376c5d758116200023f578063817b1cd21162000216578063817b1cd214620005f757806384b0196e146200060157806386312a81146200062057600080fd5b806376c5d758146200056e57806377d7a92114620005965780637ecebe0014620005be57600080fd5b806361dc0549116200027457806361dc054914620005365780636bad5e041462000540578063704b6c02146200055757600080fd5b80635a57b46f14620004f85780635ade228a14620005145780635ba8fcfe146200051f57600080fd5b80632be3a2c2116200030757806337e9f64a11620002de57806337e9f64a14620004af57806339aab4b014620004b95780633c6b16ab14620004e157600080fd5b80632be3a2c2146200043c5780632d7ef361146200045f57806331cb4bea146200048757600080fd5b80631c39b672116200033c5780631c39b67214620003c0578063228e1f3d146200040e578063255a4f73146200042557600080fd5b8063073a2ae9146200036657806314a7bcaf146200037f57806316463c5b14620003a9575b600080fd5b6200037d6200037736600462003062565b62000961565b005b620003966200039036600462003173565b6200098d565b6040519081526020015b60405180910390f35b6200037d620003ba366004620031ed565b62000a73565b620003e87f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001620003a0565b620003966200041f36600462003279565b62000b66565b6200037d6200043636600462003302565b62000c56565b620003966200044d3660046200333e565b60076020526000908152604090205481565b620003967fd5e4d3028bb2c1dddfe7c51559a12df9cdd4bf3c0579f14d78e276a15e87ea4f81565b620003967f420c9ec84cf25c36dead54f6e6827a954e8e601dea0a7d82594581c54138773281565b62000396600a5481565b620003967f300c1a75d358323d4ec7b212cd1e88afbd0250186b09c957b383ee5e6ad897f581565b6200037d620004f23660046200335c565b62000cea565b6200037d33600090815260026020526040902080546001019055565b6200039662278d0081565b6200037d6200053036600462003376565b62000fd2565b62000396600b5481565b6200037d62000551366004620033a1565b620010b0565b6200037d620005683660046200333e565b620010d7565b620003967f277b94e6cefe6a0f880d649624078c4df18c5639ffab0db19ad83a5c59b67a9681565b620003967f6bac54099c7bf34385b0fcc7cec4b62c6138950310516bf6d92b106726e80b6881565b62000396620005cf3660046200333e565b73ffffffffffffffffffffffffffffffffffffffff1660009081526002602052604090205490565b6200039660055481565b6200060b620010ec565b604051620003a0979695949392919062003439565b6200037d6200063136600462003376565b62001152565b620003967f02b86dfac8c39cc498eeafc5b86f375784c18fd83dfdc4e3620b4f0ec1042c9481565b620003966200067036600462003501565b620011e6565b62000396620006873660046200354b565b620011f6565b620003e87f000000000000000000000000000000000000000000000000000000000000000081565b6200037d620006c63660046200357a565b62001206565b62000396620006dd3660046200333e565b62001309565b62000396620006f43660046200333e565b600f6020526000908152604090205481565b6200037d62000717366004620033a1565b62001338565b620007346200072e366004620035d7565b6200135f565b604051620003a0919062003651565b620003966200145a565b620007ba6200075e3660046200335c565b6008602052600090815260409020805460018201546002909201546bffffffffffffffffffffffff82169273ffffffffffffffffffffffffffffffffffffffff6c01000000000000000000000000909304831692908116911684565b604080516bffffffffffffffffffffffff909516855273ffffffffffffffffffffffffffffffffffffffff938416602086015291831691840191909152166060820152608001620003a0565b6200037d62000817366004620031ed565b620014b9565b620003966200154d565b62000396620008383660046200333e565b60066020526000908152604090205481565b62000396600c5481565b62000396600d5481565b620003966ec097ce7bc90715b34b9f100000000081565b620003966200155a565b6200039662000890366004620036d7565b62001572565b6200037d620008a736600462003062565b6200165f565b620003e8620008be3660046200333e565b60096020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b6200090c620008f73660046200333e565b60106020526000908152604090205460ff1681565b6040519015158152602001620003a0565b620003966200092e3660046200333e565b600e6020526000908152604090205481565b600454620003e89073ffffffffffffffffffffffffffffffffffffffff1681565b60008281526008602052604090206200097b813362001686565b620009888184846200172d565b505050565b60006200099a8362001820565b62000a5e8462000a577f420c9ec84cf25c36dead54f6e6827a954e8e601dea0a7d82594581c54138773287620009fa8973ffffffffffffffffffffffffffffffffffffffff16600090815260026020526040902080546001810190915590565b8860405160200162000a3b949392919093845273ffffffffffffffffffffffffffffffffffffffff9290921660208401526040830152606082015260800190565b604051602081830303815290604052805190602001206200185b565b84620018a6565b62000a6984620018f5565b90505b9392505050565b600085815260086020526040902062000a8d818562001686565b62000a988362001820565b62000b518462000a577f277b94e6cefe6a0f880d649624078c4df18c5639ffab0db19ad83a5c59b67a9689898962000afa8b73ffffffffffffffffffffffffffffffffffffffff16600090815260026020526040902080546001810190915590565b6040805160208101969096528501939093526bffffffffffffffffffffffff909116606084015273ffffffffffffffffffffffffffffffffffffffff16608083015260a082015260c0810187905260e00162000a3b565b62000b5e81878762001a41565b505050505050565b6040517fd505accf0000000000000000000000000000000000000000000000000000000081523360048201523060248201526bffffffffffffffffffffffff881660448201526064810185905260ff8416608482015260a4810183905260c481018290526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063d505accf9060e401600060405180830381600087803b15801562000c2957600080fd5b505af192505050801562000c3b575060015b5062000c4a3389898962001c43565b98975050505050505050565b62000c6062001f1d565b73ffffffffffffffffffffffffffffffffffffffff821660008181526010602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001685151590811790915591519182527fb33ca1dabfb28a2e1bd06b332c396b1a3d538278691341a5503bbad53f919197910160405180910390a25050565b3360009081526010602052604090205460ff1662000d61576040517f93bf15a50000000000000000000000000000000000000000000000000000000081527f6e6f74206e6f746966696572000000000000000000000000000000000000000060048201523360248201526044015b60405180910390fd5b62000d6b6200145a565b600d55600a54421062000dac5762278d0062000d976ec097ce7bc90715b34b9f1000000000836200379a565b62000da39190620037b4565b600c5562000e0b565b600042600a5462000dbe9190620037f0565b600c5462000dcd91906200379a565b905062278d0062000dee6ec097ce7bc90715b34b9f1000000000846200379a565b62000dfa908362003806565b62000e069190620037b4565b600c55505b62000e1a62278d004262003806565b600a5542600b55600c5462000e40906ec097ce7bc90715b34b9f100000000090620037b4565b60000362000e7a576040517f2fe5e38f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526ec097ce7bc90715b34b9f1000000000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa15801562000f16573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000f3c91906200381c565b62000f4891906200379a565b62278d00600c5462000f5b91906200379a565b111562000f94576040517fee554ac900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080518281523360208201527f48f411442545d43fc993afadc0fd408cf0d1c606f3d10d1de7b05c994463ed97910160405180910390a150565b50565b600085815260086020526040902062000fec818562001686565b62000ff78362001820565b620010a38462000a577f300c1a75d358323d4ec7b212cd1e88afbd0250186b09c957b383ee5e6ad897f5898989620010598b73ffffffffffffffffffffffffffffffffffffffff16600090815260026020526040902080546001810190915590565b60408051602081019690965285019390935273ffffffffffffffffffffffffffffffffffffffff918216606085015216608083015260a082015260c0810187905260e00162000a3b565b62000b5e8187876200172d565b6000828152600860205260409020620010ca813362001686565b6200098881848462001f9a565b620010e162001f1d565b62000fcf81620021dc565b6000606080600080600060606200110262002275565b6200110c620022a4565b604080516000808252602082019092527f0f000000000000000000000000000000000000000000000000000000000000009b939a50919850469750309650945092509050565b60008581526008602052604090206200116c818562001686565b620011778362001820565b620011d98462000a577fd5e4d3028bb2c1dddfe7c51559a12df9cdd4bf3c0579f14d78e276a15e87ea4f898989620010598b73ffffffffffffffffffffffffffffffffffffffff16600090815260026020526040902080546001810190915590565b62000b5e818787620022d3565b600062000a693385858562001c43565b600062000a6c3384843362001c43565b600086815260086020526040902062001220813362001686565b6040517fd505accf0000000000000000000000000000000000000000000000000000000081523360048201523060248201526bffffffffffffffffffffffff871660448201526064810186905260ff8516608482015260a4810184905260c481018390527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063d505accf9060e401600060405180830381600087803b158015620012e057600080fd5b505af1925050508015620012f2575060015b506200130081888862001f9a565b50505050505050565b60006ec097ce7bc90715b34b9f1000000000620013268362002439565b620013329190620037b4565b92915050565b600082815260086020526040902062001352813362001686565b6200098881848462001a41565b60608167ffffffffffffffff8111156200137d576200137d62003091565b604051908082528060200260200182016040528015620013b257816020015b60608152602001906001900390816200139c5790505b50905060005b8281101562001453576200142a30858584818110620013db57620013db62003836565b9050602002810190620013ef919062003865565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250620024d992505050565b8282815181106200143f576200143f62003836565b6020908102919091010152600101620013b8565b5092915050565b60006005546000036200146e5750600d5490565b600554600b546200147e6200155a565b6200148a9190620037f0565b600c546200149991906200379a565b620014a59190620037b4565b600d54620014b4919062003806565b905090565b6000858152600860205260409020620014d3818562001686565b620014de8362001820565b620015408462000a577f6bac54099c7bf34385b0fcc7cec4b62c6138950310516bf6d92b106726e80b6889898962000afa8b73ffffffffffffffffffffffffffffffffffffffff16600090815260026020526040902080546001810190915590565b62000b5e81878762001f9a565b6000620014b433620018f5565b600042600a54116200156d5750600a5490565b504290565b60006200157f8362001820565b620016468462000a577f02b86dfac8c39cc498eeafc5b86f375784c18fd83dfdc4e3620b4f0ec1042c948a8a8a8a620015e28c73ffffffffffffffffffffffffffffffffffffffff16600090815260026020526040902080546001810190915590565b6040805160208101979097526bffffffffffffffffffffffff9095169486019490945273ffffffffffffffffffffffffffffffffffffffff928316606086015290821660808501521660a083015260c082015260e081018790526101000162000a3b565b620016548488888862001c43565b979650505050505050565b600082815260086020526040902062001679813362001686565b62000988818484620022d3565b815473ffffffffffffffffffffffffffffffffffffffff8281166c01000000000000000000000000909204161462001729576040517f93bf15a50000000000000000000000000000000000000000000000000000000081527f6e6f74206f776e65720000000000000000000000000000000000000000000000600482015273ffffffffffffffffffffffffffffffffffffffff8216602482015260440162000d58565b5050565b620017388162002562565b600183015473ffffffffffffffffffffffffffffffffffffffff908116600081815260096020908152604091829020548251938452858516918401919091529092169184917f4ac5bca5b979462f72ac2586d359f46427c09a49b337dcbd3ca9975140101694910160405180910390a26001840180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790556000620017f783620025b0565b85549091506200181990839083906bffffffffffffffffffffffff16620026d4565b5050505050565b8042111562000fcf576040517f537c993600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000620013326200186b62002702565b836040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b6000620018b58484846200283d565b905080620018ef576040517fb0d4837c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b600062001901620028c2565b6200190c82620028de565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600f60205260408120546200194e906ec097ce7bc90715b34b9f100000000090620037b4565b905080600003620019625750600092915050565b6200197d6ec097ce7bc90715b34b9f1000000000826200379a565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600f6020526040902054620019af9190620037f0565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600f6020526040908190209290925590517f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f72419062001a0c9084815260200190565b60405180910390a2620013327f0000000000000000000000000000000000000000000000000000000000000000848362002924565b62001a4b620028c2565b600283015462001a719073ffffffffffffffffffffffffffffffffffffffff16620028de565b82548190849060009062001a959084906bffffffffffffffffffffffff16620038d4565b92506101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550806bffffffffffffffffffffffff166005600082825462001ae59190620037f0565b909155505082546c01000000000000000000000000900473ffffffffffffffffffffffffffffffffffffffff16600090815260066020526040812080546bffffffffffffffffffffffff8416929062001b40908490620037f0565b9091555050600283015473ffffffffffffffffffffffffffffffffffffffff16600090815260076020526040812080546bffffffffffffffffffffffff8416929062001b8e908490620037f0565b9091555050600183015473ffffffffffffffffffffffffffffffffffffffff908116600090815260096020526040902054845462001bf192918216916c01000000000000000000000000909104166bffffffffffffffffffffffff8416620026d4565b8254604080516bffffffffffffffffffffffff8085168252909216602083015283917fcda86d0ec3f513f43f5512de1982307d90747e4da0550585ca8744cbc7d8619f910160405180910390a2505050565b600062001c508362002562565b62001c5b8262002562565b62001c65620028c2565b62001c7082620028de565b600062001c7d84620025b0565b905062001c89620029a7565b9150846bffffffffffffffffffffffff166005600082825462001cad919062003806565b909155505073ffffffffffffffffffffffffffffffffffffffff8616600090815260066020526040812080546bffffffffffffffffffffffff8816929062001cf790849062003806565b909155505073ffffffffffffffffffffffffffffffffffffffff8316600090815260076020526040812080546bffffffffffffffffffffffff8816929062001d4190849062003806565b9091555050604080516080810182526bffffffffffffffffffffffff80881680835273ffffffffffffffffffffffffffffffffffffffff808b1660208086019182528a83168688019081528a84166060880190815260008b81526008909352979091209551915183166c01000000000000000000000000029190941617845591516001840180549184167fffffffffffffffffffffffff0000000000000000000000000000000000000000928316179055935160029093018054939092169290931691909117905562001e189087908390620026d4565b6040805173ffffffffffffffffffffffffffffffffffffffff881681526bffffffffffffffffffffffff87166020820181905281830152905183917feb6032fe8d7a2f7003e5b33948bdc807f994be970351cd021a033784812c8baa919081900360600190a260405173ffffffffffffffffffffffffffffffffffffffff84169060009084907fe1fcac5fc7d2f61f04d109cb8169e6163bdf912d84879a78652bb7b93573cc7c908390a4604080516000815273ffffffffffffffffffffffffffffffffffffffff8616602082015283917f4ac5bca5b979462f72ac2586d359f46427c09a49b337dcbd3ca9975140101694910160405180910390a250949350505050565b60045473ffffffffffffffffffffffffffffffffffffffff16331462001f98576040517f93bf15a50000000000000000000000000000000000000000000000000000000081527f6e6f742061646d696e0000000000000000000000000000000000000000000000600482015233602482015260440162000d58565b565b62001fa4620028c2565b600283015462001fca9073ffffffffffffffffffffffffffffffffffffffff16620028de565b600183015473ffffffffffffffffffffffffffffffffffffffff9081166000908152600960205260408120546005805491909316926bffffffffffffffffffffffff85169290916200201e90849062003806565b909155505083546c01000000000000000000000000900473ffffffffffffffffffffffffffffffffffffffff16600090815260066020526040812080546bffffffffffffffffffffffff851692906200207990849062003806565b9091555050600284015473ffffffffffffffffffffffffffffffffffffffff16600090815260076020526040812080546bffffffffffffffffffffffff85169290620020c790849062003806565b9091555050835482908590600090620020f09084906bffffffffffffffffffffffff16620038fc565b92506101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055506200215d84600001600c9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682846bffffffffffffffffffffffff16620026d4565b8354604080516c01000000000000000000000000830473ffffffffffffffffffffffffffffffffffffffff1681526bffffffffffffffffffffffff80861660208301529092169082015283907feb6032fe8d7a2f7003e5b33948bdc807f994be970351cd021a033784812c8baa9060600160405180910390a250505050565b620021e78162002562565b60045460405173ffffffffffffffffffffffffffffffffffffffff8084169216907fbf265e8326285a2747e33e54d5945f7111f2b5edb826eb8c08d4677779b3ff9790600090a3600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6060620014b47f00000000000000000000000000000000000000000000000000000000000000006000620029bd565b6060620014b47f00000000000000000000000000000000000000000000000000000000000000006001620029bd565b620022de8162002562565b620022e8620028c2565b60028301546200230e9073ffffffffffffffffffffffffffffffffffffffff16620028de565b8254600284015473ffffffffffffffffffffffffffffffffffffffff16600090815260076020526040812080546bffffffffffffffffffffffff909316929091906200235c908490620037f0565b909155506200236d905081620028de565b600283015460405173ffffffffffffffffffffffffffffffffffffffff80841692169084907fe1fcac5fc7d2f61f04d109cb8169e6163bdf912d84879a78652bb7b93573cc7c90600090a46002830180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091558354600091825260076020526040822080546bffffffffffffffffffffffff9092169290916200242f90849062003806565b9091555050505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600e6020526040812054620024696200145a565b620024759190620037f0565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260076020526040902054620024a791906200379a565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600f602052604090205462001332919062003806565b60606000808473ffffffffffffffffffffffffffffffffffffffff168460405162002505919062003924565b600060405180830381855af49150503d806000811462002542576040519150601f19603f3d011682016040523d82523d6000602084013e62002547565b606091505b50915091506200255985838362002a75565b95945050505050565b73ffffffffffffffffffffffffffffffffffffffff811662000fcf576040517fc05887de00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8082166000908152600960205260409020541680620026cf577f0000000000000000000000000000000000000000000000000000000000000000826040516200260e906200302f565b73ffffffffffffffffffffffffffffffffffffffff928316815291166020820152604001604051809103906000f0801580156200264f573d6000803e3d6000fd5b5073ffffffffffffffffffffffffffffffffffffffff83811660008181526009602052604080822080547fffffffffffffffffffffffff000000000000000000000000000000000000000016948616948517905551939450919290917f53ff145c5d53f9465a0d97719aeab68428f349b2cf0b009e9dd75b94b315d7be91a35b919050565b620009887f000000000000000000000000000000000000000000000000000000000000000084848462002b0c565b60003073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161480156200276957507f000000000000000000000000000000000000000000000000000000000000000046145b156200279457507f000000000000000000000000000000000000000000000000000000000000000090565b620014b4604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60008060006200284e858562002b54565b50909250905060008160038111156200286b576200286b62003942565b148015620028a457508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b80620028b85750620028b886868662002ba5565b9695505050505050565b620028cc6200145a565b600d55620028d96200155a565b600b55565b620028e98162002439565b73ffffffffffffffffffffffffffffffffffffffff9091166000908152600f6020908152604080832093909355600d54600e90915291902055565b60405173ffffffffffffffffffffffffffffffffffffffff8381166024830152604482018390526200098891859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505062002cfc565b600354620029b781600162003806565b60035590565b606060ff8314620029db57620029d38362002d99565b905062001332565b818054620029e99062003971565b80601f016020809104026020016040519081016040528092919081815260200182805462002a179062003971565b801562002a685780601f1062002a3c5761010080835404028352916020019162002a68565b820191906000526020600020905b81548152906001019060200180831162002a4a57829003601f168201915b5050505050905062001332565b60608262002a8e5762002a888262002dda565b62000a6c565b815115801562002ab3575073ffffffffffffffffffffffffffffffffffffffff84163b155b1562002b04576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240162000d58565b508062000a6c565b60405173ffffffffffffffffffffffffffffffffffffffff8481166024830152838116604483015260648201839052620018ef9186918216906323b872dd906084016200295f565b6000806000835160410362002b925760208401516040850151606086015160001a62002b838882858562002e1d565b95509550955050505062002b9e565b50508151600091506002905b9250925092565b60008060008573ffffffffffffffffffffffffffffffffffffffff16858560405160240162002bd6929190620039c6565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1626ba7e000000000000000000000000000000000000000000000000000000001790525162002c59919062003924565b600060405180830381855afa9150503d806000811462002c96576040519150601f19603f3d011682016040523d82523d6000602084013e62002c9b565b606091505b509150915081801562002cb057506020815110155b8015620028b8575080517f1626ba7e000000000000000000000000000000000000000000000000000000009062002cf190830160209081019084016200381c565b149695505050505050565b600062002d2073ffffffffffffffffffffffffffffffffffffffff84168362002f1c565b9050805160001415801562002d4857508080602001905181019062002d469190620039e1565b155b1562000988576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260240162000d58565b6060600062002da88362002f2c565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b80511562002deb5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a084111562002e5a575060009150600390508262002f12565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa15801562002eaf573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811662002f085750600092506001915082905062002f12565b9250600091508190505b9450945094915050565b606062000a6c8383600062002f6e565b600060ff8216601f81111562001332576040517fb3512b0c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60608147101562002fae576040517fcd78605900000000000000000000000000000000000000000000000000000000815230600482015260240162000d58565b6000808573ffffffffffffffffffffffffffffffffffffffff16848660405162002fd9919062003924565b60006040518083038185875af1925050503d806000811462003018576040519150601f19603f3d011682016040523d82523d6000602084013e6200301d565b606091505b5091509150620028b886838362002a75565b6101cc8062003a0283390190565b803573ffffffffffffffffffffffffffffffffffffffff81168114620026cf57600080fd5b600080604083850312156200307657600080fd5b8235915062003088602084016200303d565b90509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f830112620030d257600080fd5b813567ffffffffffffffff80821115620030f057620030f062003091565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171562003139576200313962003091565b816040528381528660208588010111156200315357600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000606084860312156200318957600080fd5b62003194846200303d565b925060208401359150604084013567ffffffffffffffff811115620031b857600080fd5b620031c686828701620030c0565b9150509250925092565b80356bffffffffffffffffffffffff81168114620026cf57600080fd5b600080600080600060a086880312156200320657600080fd5b853594506200321860208701620031d0565b935062003228604087016200303d565b925060608601359150608086013567ffffffffffffffff8111156200324c57600080fd5b6200325a88828901620030c0565b9150509295509295909350565b803560ff81168114620026cf57600080fd5b600080600080600080600060e0888a0312156200329557600080fd5b620032a088620031d0565b9650620032b0602089016200303d565b9550620032c0604089016200303d565b945060608801359350620032d76080890162003267565b925060a0880135915060c0880135905092959891949750929550565b801515811462000fcf57600080fd5b600080604083850312156200331657600080fd5b62003321836200303d565b915060208301356200333381620032f3565b809150509250929050565b6000602082840312156200335157600080fd5b62000a6c826200303d565b6000602082840312156200336f57600080fd5b5035919050565b600080600080600060a086880312156200338f57600080fd5b8535945062003218602087016200303d565b60008060408385031215620033b557600080fd5b823591506200308860208401620031d0565b60005b83811015620033e4578181015183820152602001620033ca565b50506000910152565b6000815180845262003407816020860160208601620033c7565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b7fff00000000000000000000000000000000000000000000000000000000000000881681526000602060e060208401526200347860e084018a620033ed565b83810360408501526200348c818a620033ed565b6060850189905273ffffffffffffffffffffffffffffffffffffffff8816608086015260a0850187905284810360c08601528551808252602080880193509091019060005b81811015620034ef57835183529284019291840191600101620034d1565b50909c9b505050505050505050505050565b6000806000606084860312156200351757600080fd5b6200352284620031d0565b925062003532602085016200303d565b915062003542604085016200303d565b90509250925092565b600080604083850312156200355f57600080fd5b6200356a83620031d0565b915062003088602084016200303d565b60008060008060008060c087890312156200359457600080fd5b86359550620035a660208801620031d0565b945060408701359350620035bd6060880162003267565b92506080870135915060a087013590509295509295509295565b60008060208385031215620035eb57600080fd5b823567ffffffffffffffff808211156200360457600080fd5b818501915085601f8301126200361957600080fd5b8135818111156200362957600080fd5b8660208260051b85010111156200363f57600080fd5b60209290920196919550909350505050565b600060208083016020845280855180835260408601915060408160051b87010192506020870160005b82811015620036ca577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452620036b7858351620033ed565b945092850192908501906001016200367a565b5092979650505050505050565b60008060008060008060c08789031215620036f157600080fd5b620036fc87620031d0565b95506200370c602088016200303d565b94506200371c604088016200303d565b93506200372c606088016200303d565b92506080870135915060a087013567ffffffffffffffff8111156200375057600080fd5b6200375e89828a01620030c0565b9150509295509295509295565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820281158282048414176200133257620013326200376b565b600082620037eb577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b818103818111156200133257620013326200376b565b808201808211156200133257620013326200376b565b6000602082840312156200382f57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126200389b57600080fd5b83018035915067ffffffffffffffff821115620038b757600080fd5b602001915036819003821315620038cd57600080fd5b9250929050565b6bffffffffffffffffffffffff8281168282160390808211156200145357620014536200376b565b6bffffffffffffffffffffffff8181168382160190808211156200145357620014536200376b565b6000825162003938818460208701620033c7565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600181811c908216806200398657607f821691505b602082108103620039c0577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b82815260406020820152600062000a696040830184620033ed565b600060208284031215620039f457600080fd5b815162000a6c81620032f356fe608060405234801561001057600080fd5b506040516101cc3803806101cc83398101604081905261002f9161011c565b6040516317066a5760e21b81526001600160a01b038281166004830152831690635c19a95c90602401600060405180830381600087803b15801561007257600080fd5b505af1158015610086573d6000803e3d6000fd5b505060405163095ea7b360e01b815233600482015260001960248201526001600160a01b038516925063095ea7b391506044016020604051808303816000875af11580156100d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100fc9190610156565b50505061017f565b6001600160a01b038116811461011957600080fd5b50565b6000806040838503121561012f57600080fd5b825161013a81610104565b602084015190925061014b81610104565b809150509250929050565b60006020828403121561016857600080fd5b8151801515811461017857600080fd5b9392505050565b603f8061018d6000396000f3fe6080604052600080fdfea2646970667358221220defe974d338236b7160b55d8085409609e608cac3ae33625fa36e65bc712a3f364736f6c63430008170033a2646970667358221220881acdf2b86321ce5553f215df4ff4b0142142c1d27dc4e4686ac1dfc4d2076264736f6c63430008170033000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f98400000000000000000000000071218d9e40cac8f7c76a9aba2de7e6aae4e9c736", + "nonce": "0x1", + "chainId": "0x1" + }, + "additionalContracts": [], + "isFixedGasLimit": false + }, + { + "hash": "0x63364db99bef2d65a5dc0cc0e1b4e3fd544360282c71a2d8bf9f9ca8be3fcce8", + "transactionType": "CREATE", + "contractName": "V3FactoryOwner", + "contractAddress": "0x2e27332b25ce245f6628377bc83573a001313c58", + "function": null, + "arguments": [ + "0x1a9C8182C09F50C8318d769245beA52c32BE35BC", + "0x1F98431c8aD98523631AE4a59f267346ea31F984", + "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "10000000000000000000", + "0xE3071e87a7E6dD19A911Dbf1127BA9dD67Aa6fc8" + ], + "transaction": { + "from": "0x71218d9e40cac8f7c76a9aba2de7e6aae4e9c736", + "gas": "0x104eca", + "value": "0x0", + "input": "0x60e060405234801561001057600080fd5b50604051610edf380380610edf83398101604081905261002f91610127565b6001600160a01b0385166100565760405163a553972760e01b815260040160405180910390fd5b816000036100775760405163b4230b9d60e01b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0387811691821790925585821660805284821660a052600084815591831660c0526040519091907fbf265e8326285a2747e33e54d5945f7111f2b5edb826eb8c08d4677779b3ff97908290a360405182906000907f8f6c5c01f9385e42ed275713f18de607d67ea7f6673e431418c8b286057a2207908290a35050505050610192565b6001600160a01b038116811461012457600080fd5b50565b600080600080600060a0868803121561013f57600080fd5b855161014a8161010f565b602087015190955061015b8161010f565b604087015190945061016c8161010f565b6060870151608088015191945092506101848161010f565b809150509295509295909350565b60805160a05160c051610d036101dc6000396000818161017e015281816104d3015261056f0152600081816101e101526104f701526000818160c801526104550152610d036000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c80638a7c195f11610076578063bf2d5f1b1161005b578063bf2d5f1b146101a0578063e2f6f511146101dc578063f851a4401461020357600080fd5b80638a7c195f14610166578063a508ff6c1461017957600080fd5b80636b46c8c3116100a75780636b46c8c314610129578063704b6c02146101405780637f4d39451461015357600080fd5b80632dd31000146100c357806336077b3c14610114575b600080fd5b6100ea7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b610127610122366004610b10565b610223565b005b61013260005481565b60405190815260200161010b565b61012761014e366004610b55565b6102ba565b610127610161366004610b72565b61039d565b610127610174366004610b8b565b610410565b6100ea7f000000000000000000000000000000000000000000000000000000000000000081565b6101b36101ae366004610bf1565b6104ca565b604080516fffffffffffffffffffffffffffffffff93841681529290911660208301520161010b565b6100ea7f000000000000000000000000000000000000000000000000000000000000000081565b6001546100ea9073ffffffffffffffffffffffffffffffffffffffff1681565b61022b61079e565b6040517f8206a4d100000000000000000000000000000000000000000000000000000000815260ff80841660048301528216602482015273ffffffffffffffffffffffffffffffffffffffff841690638206a4d190604401600060405180830381600087803b15801561029d57600080fd5b505af11580156102b1573d6000803e3d6000fd5b50505050505050565b6102c261079e565b73ffffffffffffffffffffffffffffffffffffffff811661030f576040517fa553972700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60015460405173ffffffffffffffffffffffffffffffffffffffff8084169216907fbf265e8326285a2747e33e54d5945f7111f2b5edb826eb8c08d4677779b3ff9790600090a3600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6103a561079e565b806000036103df576040517fb4230b9d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805460405183927f8f6c5c01f9385e42ed275713f18de607d67ea7f6673e431418c8b286057a220791a3600055565b61041861079e565b6040517f8a7c195f00000000000000000000000000000000000000000000000000000000815262ffffff83166004820152600282900b60248201527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690638a7c195f90604401600060405180830381600087803b1580156104ae57600080fd5b505af11580156104c2573d6000803e3d6000fd5b505050505050565b60008061053c337f00000000000000000000000000000000000000000000000000000000000000006000547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166107f1909392919063ffffffff16565b6000546040517f3c6b16ab00000000000000000000000000000000000000000000000000000000815260048101919091527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690633c6b16ab90602401600060405180830381600087803b1580156105c857600080fd5b505af11580156105dc573d6000803e3d6000fd5b50506040517f85b6672900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88811660048301526fffffffffffffffffffffffffffffffff808916602484015287166044830152600093508392508916906385b667299060640160408051808303816000875af1158015610672573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106969190610c4d565b91509150856fffffffffffffffffffffffffffffffff16826fffffffffffffffffffffffffffffffff1610806106ef5750846fffffffffffffffffffffffffffffffff16816fffffffffffffffffffffffffffffffff16105b15610726576040517f0790df8600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516fffffffffffffffffffffffffffffffff80851682528316602082015273ffffffffffffffffffffffffffffffffffffffff808a16923392918c16917fd377f58cbc83f844989775f0d4bfa247dbee70bf3d851b8c5f0e0fe51d3b6ef9910160405180910390a49097909650945050505050565b60015473ffffffffffffffffffffffffffffffffffffffff1633146107ef576040517fd064e4bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905261088690859061088c565b50505050565b60006108ae73ffffffffffffffffffffffffffffffffffffffff84168361092c565b905080516000141580156108d35750808060200190518101906108d19190610c7c565b155b15610927576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201526024015b60405180910390fd5b505050565b606061093a83836000610941565b9392505050565b60608147101561097f576040517fcd78605900000000000000000000000000000000000000000000000000000000815230600482015260240161091e565b6000808573ffffffffffffffffffffffffffffffffffffffff1684866040516109a89190610c9e565b60006040518083038185875af1925050503d80600081146109e5576040519150601f19603f3d011682016040523d82523d6000602084013e6109ea565b606091505b50915091506109fa868383610a04565b9695505050505050565b606082610a1957610a1482610a93565b61093a565b8151158015610a3d575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610a8c576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516600482015260240161091e565b508061093a565b805115610aa35780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b73ffffffffffffffffffffffffffffffffffffffff81168114610ad557600080fd5b803560ff81168114610b0b57600080fd5b919050565b600080600060608486031215610b2557600080fd5b8335610b3081610ad8565b9250610b3e60208501610afa565b9150610b4c60408501610afa565b90509250925092565b600060208284031215610b6757600080fd5b813561093a81610ad8565b600060208284031215610b8457600080fd5b5035919050565b60008060408385031215610b9e57600080fd5b823562ffffff81168114610bb157600080fd5b91506020830135600281900b8114610bc857600080fd5b809150509250929050565b6fffffffffffffffffffffffffffffffff81168114610ad557600080fd5b60008060008060808587031215610c0757600080fd5b8435610c1281610ad8565b93506020850135610c2281610ad8565b92506040850135610c3281610bd3565b91506060850135610c4281610bd3565b939692955090935050565b60008060408385031215610c6057600080fd5b8251610c6b81610bd3565b6020840151909250610bc881610bd3565b600060208284031215610c8e57600080fd5b8151801515811461093a57600080fd5b6000825160005b81811015610cbf5760208186018101518583015201610ca5565b50600092019182525091905056fea264697066735822122008a6b35575393a510061efd1eae133068932958d79f59515eea9f79583b84b1f64736f6c634300081700330000000000000000000000001a9c8182c09f50c8318d769245bea52c32be35bc0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f984000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000008ac7230489e80000000000000000000000000000e3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8", + "nonce": "0x2", + "chainId": "0x1" + }, + "additionalContracts": [], + "isFixedGasLimit": false + }, + { + "hash": "0xd31c4bc43c244a0e70c861ff4b5ffb160a75041466c3f3969366d87af9732e0f", + "transactionType": "CALL", + "contractName": "UniStaker", + "contractAddress": "0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8", + "function": "setRewardNotifier(address,bool)", + "arguments": [ + "0x2e27332b25Ce245F6628377bc83573A001313C58", + "true" + ], + "transaction": { + "from": "0x71218d9e40cac8f7c76a9aba2de7e6aae4e9c736", + "to": "0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8", + "gas": "0x1024b", + "value": "0x0", + "input": "0x255a4f730000000000000000000000002e27332b25ce245f6628377bc83573a001313c580000000000000000000000000000000000000000000000000000000000000001", + "nonce": "0x3", + "chainId": "0x1" + }, + "additionalContracts": [], + "isFixedGasLimit": false + }, + { + "hash": "0xc2d0e810c682b52aec3e1b8687bea9a706f37099b6e0736edb561d38c521205a", + "transactionType": "CALL", + "contractName": "UniStaker", + "contractAddress": "0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8", + "function": "setAdmin(address)", + "arguments": [ + "0x1a9C8182C09F50C8318d769245beA52c32BE35BC" + ], + "transaction": { + "from": "0x71218d9e40cac8f7c76a9aba2de7e6aae4e9c736", + "to": "0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8", + "gas": "0x9b1f", + "value": "0x0", + "input": "0x704b6c020000000000000000000000001a9c8182c09f50c8318d769245bea52c32be35bc", + "nonce": "0x4", + "chainId": "0x1" + }, + "additionalContracts": [], + "isFixedGasLimit": false + } + ], + "receipts": [ + { + "status": "0x1", + "cumulativeGasUsed": "0x103bc5f", + "logs": [ + { + "address": "0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8", + "topics": [ + "0xbf265e8326285a2747e33e54d5945f7111f2b5edb826eb8c08d4677779b3ff97", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x00000000000000000000000071218d9e40cac8f7c76a9aba2de7e6aae4e9c736" + ], + "data": "0x", + "blockHash": "0xb82652f0e42b1cf06e33e98c6f42104659bd5f005d8cc36e96ab9a2718fe4076", + "blockNumber": "0x13044d2", + "transactionHash": "0xb40c76d24316a801610e08a8ac917b3cdd17478fc189a71a1919c47056686019", + "transactionIndex": "0x72", + "logIndex": "0x1c1", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000000000000000000000000000040000000000000000000000000000020000000000000000000000000000000100000000000000000000000000000000000000000000000000002000000000000000000000000000000800000000020000000000000000000800010000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "type": "0x2", + "transactionHash": "0xb40c76d24316a801610e08a8ac917b3cdd17478fc189a71a1919c47056686019", + "transactionIndex": "0x72", + "blockHash": "0xb82652f0e42b1cf06e33e98c6f42104659bd5f005d8cc36e96ab9a2718fe4076", + "blockNumber": "0x13044d2", + "gasUsed": "0x33c6c9", + "effectiveGasPrice": "0x366f0d3c3", + "from": "0x71218d9e40cac8f7c76a9aba2de7e6aae4e9c736", + "to": null, + "contractAddress": "0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8" + }, + { + "status": "0x1", + "cumulativeGasUsed": "0x13fe4b8", + "logs": [ + { + "address": "0x2e27332b25ce245f6628377bc83573a001313c58", + "topics": [ + "0xbf265e8326285a2747e33e54d5945f7111f2b5edb826eb8c08d4677779b3ff97", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000001a9c8182c09f50c8318d769245bea52c32be35bc" + ], + "data": "0x", + "blockHash": "0xb82652f0e42b1cf06e33e98c6f42104659bd5f005d8cc36e96ab9a2718fe4076", + "blockNumber": "0x13044d2", + "transactionHash": "0x63364db99bef2d65a5dc0cc0e1b4e3fd544360282c71a2d8bf9f9ca8be3fcce8", + "transactionIndex": "0xa1", + "logIndex": "0x206", + "removed": false + }, + { + "address": "0x2e27332b25ce245f6628377bc83573a001313c58", + "topics": [ + "0x8f6c5c01f9385e42ed275713f18de607d67ea7f6673e431418c8b286057a2207", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000000000008ac7230489e80000" + ], + "data": "0x", + "blockHash": "0xb82652f0e42b1cf06e33e98c6f42104659bd5f005d8cc36e96ab9a2718fe4076", + "blockNumber": "0x13044d2", + "transactionHash": "0x63364db99bef2d65a5dc0cc0e1b4e3fd544360282c71a2d8bf9f9ca8be3fcce8", + "transactionIndex": "0xa1", + "logIndex": "0x207", + "removed": false + } + ], + "logsBloom": "0x00000000040000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000020004000000000000000800000000000000000000000000000000000000000000000008000000000000100010000000000100008000200000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000040000000000000000000000800000000000000008", + "type": "0x2", + "transactionHash": "0x63364db99bef2d65a5dc0cc0e1b4e3fd544360282c71a2d8bf9f9ca8be3fcce8", + "transactionIndex": "0xa1", + "blockHash": "0xb82652f0e42b1cf06e33e98c6f42104659bd5f005d8cc36e96ab9a2718fe4076", + "blockNumber": "0x13044d2", + "gasUsed": "0xc8c59", + "effectiveGasPrice": "0x366f0d3c3", + "from": "0x71218d9e40cac8f7c76a9aba2de7e6aae4e9c736", + "to": null, + "contractAddress": "0x2e27332b25ce245f6628377bc83573a001313c58" + }, + { + "status": "0x1", + "cumulativeGasUsed": "0x1c8c10e", + "logs": [ + { + "address": "0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8", + "topics": [ + "0xb33ca1dabfb28a2e1bd06b332c396b1a3d538278691341a5503bbad53f919197", + "0x0000000000000000000000002e27332b25ce245f6628377bc83573a001313c58" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "blockHash": "0xb82652f0e42b1cf06e33e98c6f42104659bd5f005d8cc36e96ab9a2718fe4076", + "blockNumber": "0x13044d2", + "transactionHash": "0xd31c4bc43c244a0e70c861ff4b5ffb160a75041466c3f3969366d87af9732e0f", + "transactionIndex": "0xf0", + "logIndex": "0x30e", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000200000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000001010000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000", + "type": "0x2", + "transactionHash": "0xd31c4bc43c244a0e70c861ff4b5ffb160a75041466c3f3969366d87af9732e0f", + "transactionIndex": "0xf0", + "blockHash": "0xb82652f0e42b1cf06e33e98c6f42104659bd5f005d8cc36e96ab9a2718fe4076", + "blockNumber": "0x13044d2", + "gasUsed": "0xbb00", + "effectiveGasPrice": "0x366f0d3c3", + "from": "0x71218d9e40cac8f7c76a9aba2de7e6aae4e9c736", + "to": "0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8", + "contractAddress": null + }, + { + "status": "0x1", + "cumulativeGasUsed": "0xa17537", + "logs": [ + { + "address": "0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8", + "topics": [ + "0xbf265e8326285a2747e33e54d5945f7111f2b5edb826eb8c08d4677779b3ff97", + "0x00000000000000000000000071218d9e40cac8f7c76a9aba2de7e6aae4e9c736", + "0x0000000000000000000000001a9c8182c09f50c8318d769245bea52c32be35bc" + ], + "data": "0x", + "blockHash": "0xd1d09893467d1df1579539cc6832043b8f283702db4507b75b154b48a02290b1", + "blockNumber": "0x13044d3", + "transactionHash": "0xc2d0e810c682b52aec3e1b8687bea9a706f37099b6e0736edb561d38c521205a", + "transactionIndex": "0x7f", + "logIndex": "0x121", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000000000000000000000000000040000000000000000000000000000020000000000000000000000000000000100000000000000000000000000000000000000000000000000002000000000000000000000000000000800000000000000000000000000000000010000000000000000000000000000000000000000001000000000000000000010000000000100000000000000000000000008000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000", + "type": "0x2", + "transactionHash": "0xc2d0e810c682b52aec3e1b8687bea9a706f37099b6e0736edb561d38c521205a", + "transactionIndex": "0x7f", + "blockHash": "0xd1d09893467d1df1579539cc6832043b8f283702db4507b75b154b48a02290b1", + "blockNumber": "0x13044d3", + "gasUsed": "0x704f", + "effectiveGasPrice": "0x3d3aabd5a", + "from": "0x71218d9e40cac8f7c76a9aba2de7e6aae4e9c736", + "to": "0xe3071e87a7e6dd19a911dbf1127ba9dd67aa6fc8", + "contractAddress": null + } + ], + "libraries": [], + "pending": [], + "returns": { + "0": { + "internal_type": "contract V3FactoryOwner", + "value": "0x2e27332b25Ce245F6628377bc83573A001313C58" + }, + "1": { + "internal_type": "contract UniStaker", + "value": "0xE3071e87a7E6dD19A911Dbf1127BA9dD67Aa6fc8" + } + }, + "timestamp": 1716563645, + "chain": 1, + "commit": "ff79c33" +} \ No newline at end of file diff --git a/test/helpers/UniStaker.handler.sol b/test/helpers/UniStaker.handler.sol index e879e00..1490b56 100644 --- a/test/helpers/UniStaker.handler.sol +++ b/test/helpers/UniStaker.handler.sol @@ -68,7 +68,7 @@ contract UniStakerHandler is CommonBase, StdCheats, StdUtils { countCall("enableRewardNotifier") doCheckpoints { - vm.assume(_notifier != address(0)); + vm.assume(_notifier != address(0) && _notifier != address(uniStaker)); _rewardNotifiers.add(_notifier); vm.prank(admin); uniStaker.setRewardNotifier(_notifier, true); @@ -157,9 +157,7 @@ contract UniStakerHandler is CommonBase, StdCheats, StdUtils { function claimReward(uint256 _actorSeed) public countCall("claimReward") doCheckpoints { _useActor(_beneficiaries, _actorSeed); vm.startPrank(_currentActor); - uint256 rewardsClaimed = - uniStaker.scaledUnclaimedRewardCheckpoint(_currentActor) / uniStaker.SCALE_FACTOR(); - uniStaker.claimReward(); + uint256 rewardsClaimed = uniStaker.claimReward(); vm.stopPrank(); ghost_rewardsClaimed += rewardsClaimed; }