Skip to content
Verified contractPartialMIT

ManualSweeper

Address0x92074bcde36dfcd5f8fa5d2c5219c2963b77a904
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.17

 

Same code

1 more contract

 

Details

Compiler
solc 0.8.17+commit.8df45f5f
Language
solidity
Optimization
Yes, 200 runs
EVM version
london
License
MIT
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
19,140,450
Creation transaction
0xf2babafa94…3b4e141787

src/contracts/sweepers/Manual.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import {TransferFailed} from '@floor/utils/Errors.sol';

import {ISweeper} from '@floor-interfaces/actions/Sweeper.sol';

/**
 * Allows a sweep to be referenced as manually swept outside of onchain logic. This references
 * another transaction to provide information that the sweep was completed.
 *
 * This can be used to allow for multiple fractional sweeps from multiple epoch votes to be
 * completed in a single transaction.
 *
 * @dev The Manual Sweeper shouldn't receive and hold/spend ETH as part of the process as it
 * should just allow a tx code to be passed in. This sweeper would assume that the sweeping would
 * be done externally and this would just provide reference to the external sweep. For example,
 * if we were to sweep OTC, then we may just link to the tx. For this reason, any ETH received in
 * the `msg.value` should be returned to the sender.
 */
contract ManualSweeper is ISweeper {
    /**
     * Our execute function call will just return the provided bytes data that should unpack
     * into a string message to be subsequently stored onchain against the sweep.
     */
    function execute(address[] calldata /* collections */, uint[] calldata /* amounts */, bytes calldata data)
        external
        payable
        override
        returns (string memory)
    {
        // Ensure that we have been provided data parameters
        require(data.length != 0, 'Invalid data parameter');

        // Return any fees from the sender. This ensures that no fees are retained in the contract
        if (msg.value != 0) {
            (bool success,) = payable(msg.sender).call{value: msg.value}('');
            if (!success) revert TransferFailed();
        }

        return string(data);
    }

    /**
     * Specify that only a TREASURY_MANAGER can run this sweeper.
     */
    function permissions() public pure override returns (bytes32) {
        return keccak256('TreasuryManager');
    }
}

src/contracts/utils/Errors.sol

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

/**
 * A collection of generic errors that can be referenced across multiple
 * contracts. Contract-specific errors should still be stored in their
 * individual Solidity files.
 */

/// If a NULL address tries to be stored which should not be accepted
error CannotSetNullAddress();

/// If the caller has entered an insufficient amount to process the action. This
/// will likely be a zero amount.
error InsufficientAmount();

/// If the caller enters a percentage value that is too high for the requirements
error PercentageTooHigh(uint amount);

/// If a required ETH or token `transfer` call fails
error TransferFailed();

/// If a user calls a deposit related function with a zero amount
error CannotDepositZeroAmount();

/// If a user calls a withdrawal related function with a zero amount
error CannotWithdrawZeroAmount();

/// If there are no rewards available to be claimed
error NoRewardsAvailableToClaim();

/// If the requested collection is not approved
/// @param collection Address of the collection requested
error CollectionNotApproved(address collection);

/// If the requested strategy implementation is not approved
/// @param strategyImplementation Address of the strategy implementation requested
error StrategyNotApproved(address strategyImplementation);

src/interfaces/actions/Sweeper.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * Used by sweepers.
 */
abstract contract ISweeper {
    function execute(address[] calldata collections, uint[] calldata amounts, bytes calldata data)
        external
        payable
        virtual
        returns (string memory);

    /**
     * Specify the {AuthorityControl} permissions, if any, that are required to
     * run the sweeper. If no permissions are set, then anyone can run the sweeper
     * in their allocated sweep window.
     */
    function permissions() public view virtual returns (bytes32);
}

/**
 * Used by mercenary sweepers.
 */
abstract contract IMercenarySweeper {
    function execute(uint warIndex, uint amount) external payable virtual returns (uint);
}
Compiler settingsShow
{
  "metadata": {
    "bytecodeHash": "none"
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "london",
  "remappings": [
    ":@1inch/=lib/",
    ":@ERC721A/=lib/ERC721A/contracts/",
    ":@chainlink/=lib/chainlink/",
    ":@charmfi/=lib/charmfi-contracts-0.8.0-support/",
    ":@floor-interfaces/=src/interfaces/",
    ":@floor-scripts/=script/",
    ":@floor/=src/contracts/",
    ":@manifoldxyz/=lib/lssvm2/lib/",
    ":@mocks/=lib/nftx-protocol-v3/src/mocks/",
    ":@murky/=lib/murky/src/",
    ":@nftx-protocol-v3/=lib/nftx-protocol-v3/src/",
    ":@openzeppelin-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    ":@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    ":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    ":@permit2/=lib/nftx-protocol-v3/lib/permit2/src/",
    ":@prb/math/=lib/lssvm2/lib/prb-math/src/",
    ":@prb/test/=lib/foundry-random/lib/prb-test/src/",
    ":@solidity-math-utils/=lib/solidity-math-utils/project/contracts/",
    ":@solidity-trigonometry/=lib/solidity-trigonometry/src/",
    ":@src/=lib/nftx-protocol-v3/src/",
    ":@sudoswap/=lib/lssvm/src/",
    ":@test/=lib/nftx-protocol-v3/test/",
    ":@uni-core/=lib/nftx-protocol-v3/src/uniswap/v3-core/",
    ":@uni-periphery/=lib/nftx-protocol-v3/src/uniswap/v3-periphery/",
    ":@uniswap-v3/=lib/",
    ":@uniswap/lib/=lib/nftx-protocol-v3/lib/solidity-lib/",
    ":@uniswap/v2-core/=lib/nftx-protocol-v3/lib/v2-core/",
    ":@uniswap/v3-core/contracts/=lib/nftx-protocol-v3/src/uniswap/v3-core/",
    ":@uniswap/v3-periphery/=lib/v3-periphery/",
    ":CramBit/=lib/foundry-random/lib/CramBit/",
    ":ERC721A/=lib/ERC721A/contracts/",
    ":base64-sol/=lib/nftx-protocol-v3/src/uniswap/v3-periphery/libraries/",
    ":chainlink/=lib/chainlink/",
    ":charmfi-contracts-0.8.0-support/=lib/charmfi-contracts-0.8.0-support/",
    ":clones-with-immutable-args/=lib/lssvm2/lib/clones-with-immutable-args/src/",
    ":crambit/=lib/foundry-random/lib/CramBit/src/",
    ":create2-helpers/=lib/lssvm2/lib/royalty-registry-solidity/lib/create2-helpers/",
    ":create3-factory/=lib/lssvm2/lib/create3-factory/",
    ":ds-test/=lib/forge-std/lib/ds-test/src/",
    ":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    ":forge-std/=lib/forge-std/src/",
    ":foundry-huff/=lib/lssvm2/lib/foundry-huff/src/",
    ":foundry-random/=lib/foundry-random/src/",
    ":huffmate/=lib/lssvm2/lib/huffmate/src/",
    ":libraries-solidity/=lib/lssvm2/lib/libraries-solidity/contracts/",
    ":lssvm/=lib/lssvm/src/",
    ":lssvm2/=lib/lssvm2/src/",
    ":manifoldxyz/=lib/lssvm2/lib/royalty-registry-solidity/contracts/",
    ":murky/=lib/murky/src/",
    ":nftx-protocol-v3/=lib/nftx-protocol-v3/src/",
    ":openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    ":openzeppelin-contracts/=lib/openzeppelin-contracts/",
    ":prb-math/=lib/solidity-trigonometry/lib/prb-math/contracts/",
    ":prb-test/=lib/foundry-random/lib/prb-test/src/",
    ":royalty-registry-solidity.git/=lib/lssvm/lib/royalty-registry-solidity.git/contracts/",
    ":royalty-registry-solidity/=lib/lssvm2/lib/royalty-registry-solidity/",
    ":solidity-bytes-utils/=lib/foundry-random/lib/solidity-bytes-utils/contracts/",
    ":solidity-math-utils/=lib/solidity-math-utils/",
    ":solidity-stringutils/=lib/lssvm2/lib/foundry-huff/lib/solidity-stringutils/",
    ":solidity-trigonometry/=lib/solidity-trigonometry/src/",
    ":solidity-utils/=lib/solidity-utils/contracts/",
    ":solmate/=lib/lssvm2/lib/solmate/src/",
    ":src/=lib/foundry-random/src/",
    ":stringutils/=lib/lssvm2/lib/foundry-huff/lib/solidity-stringutils/",
    ":v3-core/=lib/v3-core/contracts/",
    ":v3-periphery/=lib/v3-periphery/contracts/",
    ":weird-erc20/=lib/lssvm/lib/solmate/lib/weird-erc20/src/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.