Forkchoice Ethereum Mainnet

Address Contract Partially Verified

Address 0x12e39Cd22501Eec967663b9b58946d02dA2DF74c
Balance 0 ETH
Nonce 1
Code Size 3729 bytes
Indexed Transactions 0 (1 on-chain, 1.5% indexed)
External Etherscan · Sourcify

Contract Bytecode

3729 bytes
Copy Bytecode
0x608060405234801561001057600080fd5b50600436106100df5760003560e01c806388434e6c1161008c578063b6044b6811610066578063b6044b68146101a7578063c2510346146101ba578063d7ad21ac146101cd578063f2fde38b146101e057600080fd5b806388434e6c1461015c5780638da5cb5b1461016f5780639be3d69c1461019457600080fd5b8063705931fa116100bd578063705931fa1461012a578063715018a61461013d5780637a210a2b1461014557600080fd5b80630c6df5e4146100e45780630ed9cc4c146101025780633f91d69d14610117575b600080fd5b6100ec6101f3565b6040516100f99190610d11565b60405180910390f35b610115610110366004610d7a565b610204565b005b610115610125366004610d7a565b6102b7565b610115610138366004610d7a565b61051a565b6101156105c0565b61014e60045481565b6040519081526020016100f9565b61011561016a366004610d95565b610626565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016100f9565b60035461017c906001600160a01b031681565b6101156101b5366004610d7a565b61075c565b6101156101c8366004610d7a565b610806565b61014e6101db366004610dae565b6108a9565b6101156101ee366004610d7a565b6109cb565b60606101ff6001610aaa565b905090565b6000546001600160a01b031633146102635760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61026e600582610ab7565b156102b457604051600081526001600160a01b038216907f36ee46fa09c2419f7bcf8135c2bdd56bc882be141cb075961717003bed74367d906020015b60405180910390a25b50565b6000546001600160a01b031633146103115760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161025a565b61031c600182610ad5565b6103db5760405162461bcd60e51b8152602060048201526064602482018190527f45786368616e6765506f6f6c50726f636573736f723a7365745072696d61727960448301527f506f6f6c3a494e56414c49445f504f4f4c3a20476976656e2061646472657373908201527f206973206e6f7420726567697374657265642061732065786368616e6765207060848201527f6f6f6c2e0000000000000000000000000000000000000000000000000000000060a482015260c40161025a565b6003546001600160a01b03828116911614156104ab5760405162461bcd60e51b815260206004820152606360248201527f45786368616e6765506f6f6c50726f636573736f723a7365745072696d61727960448201527f506f6f6c3a414c52454144595f5345543a20546869732061646472657373206960648201527f7320616c726561647920746865207072696d61727920706f6f6c20616464726560848201527f73732e000000000000000000000000000000000000000000000000000000000060a482015260c40161025a565b600380546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff1983168117909355604080519190921680825260208201939093527ff9df320023cbf5726cbd5bdd99ae23c9382d03b65180d0611d0d72edab96cf8991015b60405180910390a15050565b6000546001600160a01b031633146105745760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161025a565b61057f600582610af7565b156102b457604051600181526001600160a01b038216907f36ee46fa09c2419f7bcf8135c2bdd56bc882be141cb075961717003bed74367d906020016102ab565b6000546001600160a01b0316331461061a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161025a565b6106246000610b0c565b565b6000546001600160a01b031633146106805760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161025a565b610fa081111561071e5760405162461bcd60e51b815260206004820152605260248201527f53746174696354617848616e646c65723a7365745461784261736973506f696e60448201527f74733a4849474845525f56414c55453a20426173697320706f696e747320636160648201527f6e6e6f742065786365656420342c3030302e0000000000000000000000000000608482015260a40161025a565b600480549082905560408051828152602081018490527ff286ef78fc83ca40c1f8a724dde9b276fac01424dff3706a5d4cd8eae02c3ae8910161050e565b6000546001600160a01b031633146107b65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161025a565b6107c1600182610af7565b156102b4576040516001600160a01b03821681527f1caec4f1ef0e654f520edf2d95d3d035ea6382500dbdd179d37017442e535284906020015b60405180910390a150565b6000546001600160a01b031633146108605760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161025a565b61086b600182610ab7565b156102b4576040516001600160a01b03821681527f3186e21fde26faa448666270e7a0d53c887d8f040950e4330a2b622e34ed6f44906020016107fb565b60006108b6600585610ad5565b806108c757506108c7600584610ad5565b156108d4575060006109c4565b60006108e06001610b69565b116109795760405162461bcd60e51b815260206004820152604860248201527f53746174696354617848616e646c65723a6765745461783a494e41435449564560448201527f3a204e6f2065786368616e676520706f6f6c732068617665206265656e20616460648201527f646564207965742e000000000000000000000000000000000000000000000000608482015260a40161025a565b610984600185610ad5565b1580156109995750610997600184610ad5565b155b156109a6575060006109c4565b612710600454836109b79190610e00565b6109c19190610e1f565b90505b9392505050565b6000546001600160a01b03163314610a255760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161025a565b6001600160a01b038116610aa15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161025a565b6102b481610b0c565b606060006109c483610b73565b6000610acc836001600160a01b038416610bcf565b90505b92915050565b6001600160a01b03811660009081526001830160205260408120541515610acc565b6000610acc836001600160a01b038416610cc2565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610acf825490565b606081600001805480602002602001604051908101604052809291908181526020018280548015610bc357602002820191906000526020600020905b815481526020019060010190808311610baf575b50505050509050919050565b60008181526001830160205260408120548015610cb8576000610bf3600183610e41565b8554909150600090610c0790600190610e41565b9050818114610c6c576000866000018281548110610c2757610c27610e58565b9060005260206000200154905080876000018481548110610c4a57610c4a610e58565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610c7d57610c7d610e6e565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610acf565b6000915050610acf565b6000818152600183016020526040812054610d0957508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610acf565b506000610acf565b6020808252825182820181905260009190848201906040850190845b81811015610d525783516001600160a01b031683529284019291840191600101610d2d565b50909695505050505050565b80356001600160a01b0381168114610d7557600080fd5b919050565b600060208284031215610d8c57600080fd5b610acc82610d5e565b600060208284031215610da757600080fd5b5035919050565b600080600060608486031215610dc357600080fd5b610dcc84610d5e565b9250610dda60208501610d5e565b9150604084013590509250925092565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615610e1a57610e1a610dea565b500290565b600082610e3c57634e487b7160e01b600052601260045260246000fd5b500490565b600082821015610e5357610e53610dea565b500390565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fdfea164736f6c634300080b000a

Verified Source Code Partial Match

Compiler: v0.8.11+commit.d7f03943 EVM: london Optimization: Yes (888 runs)
Ownable.sol 71 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _setOwner(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _setOwner(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
Context.sol 23 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}
EnumerableSet.sol 356 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastvalue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastvalue;
                // Update the index for the moved value
                set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        assembly {
            result := store
        }

        return result;
    }
}
ITaxHandler.sol 21 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;

/**
 * @title Tax handler interface
 * @dev Any class that implements this interface can be used for protocol-specific tax calculations.
 */
interface ITaxHandler {
    /**
     * @notice Get number of tokens to pay as tax.
     * @param benefactor Address of the benefactor.
     * @param beneficiary Address of the beneficiary.
     * @param amount Number of tokens in the transfer.
     * @return Number of tokens to pay as tax.
     */
    function getTax(
        address benefactor,
        address beneficiary,
        uint256 amount
    ) external view returns (uint256);
}
StaticTaxHandler.sol 107 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;

import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

import "./ITaxHandler.sol";
import "../utils/ExchangePoolProcessor.sol";

/**
 * @title Static tax handler contract
 * @dev This contract allows protocols to collect tax on transactions that count as either sells or liquidity additions
 * to exchange pools. Addresses can be exempted from tax collection, and addresses designated as exchange pools can be
 * added and removed by the owner of this contract. The owner of the contract should be set to a DAO-controlled timelock
 * or at the very least a multisig wallet.
 */
contract StaticTaxHandler is ITaxHandler, ExchangePoolProcessor {
    using EnumerableSet for EnumerableSet.AddressSet;

    /// @notice How much tax to collect in basis points. 10,000 basis points is 100%.
    uint256 public taxBasisPoints;

    /// @dev The set of addresses exempt from tax.
    EnumerableSet.AddressSet private _exempted;

    /// @notice Emitted when the tax basis points number is updated.
    event TaxBasisPointsUpdated(uint256 oldBasisPoints, uint256 newBasisPoints);

    /// @notice Emitted when an address is added to or removed from the exempted addresses set.
    event TaxExemptionUpdated(address indexed wallet, bool exempted);

    /**
     * @param initialTaxBasisPoints The number of tax basis points to start out with for tax calculations.
     */
    constructor(uint256 initialTaxBasisPoints) {
        taxBasisPoints = initialTaxBasisPoints;
    }

    /**
     * @notice Get number of tokens to pay as tax. This method specifically only check for sell-type transfers to
     * designated exchange pool addresses.
     * @dev There is no easy way to differentiate between a user selling tokens and a user adding liquidity to the pool.
     * In both cases tokens are transferred to the pool. This is an unfortunate case where users have to accept being
     * taxed on liquidity additions. To get around this issue, a separate liquidity addition contract can be deployed.
     * This contract can be exempt from taxes if its functionality is verified to only add liquidity.
     * @param benefactor Address of the benefactor.
     * @param beneficiary Address of the beneficiary.
     * @param amount Number of tokens in the transfer.
     * @return Number of tokens to pay as tax.
     */
    function getTax(
        address benefactor,
        address beneficiary,
        uint256 amount
    ) external view override returns (uint256) {
        if (_exempted.contains(benefactor) || _exempted.contains(beneficiary)) {
            return 0;
        }

        require(
            _exchangePools.length() > 0,
            "StaticTaxHandler:getTax:INACTIVE: No exchange pools have been added yet."
        );

        // Transactions between regular users (this includes contracts) aren't taxed.
        if (!_exchangePools.contains(benefactor) && !_exchangePools.contains(beneficiary)) {
            return 0;
        }

        return (amount * taxBasisPoints) / 10000;
    }

    /**
     * @notice Set new number for tax basis points.
     * @param newBasisPoints New tax basis points number to set for calculations.
     */
    function setTaxBasisPoints(uint256 newBasisPoints) external onlyOwner {
        require(
            newBasisPoints <= 4000,
            "StaticTaxHandler:setTaxBasisPoints:HIGHER_VALUE: Basis points cannot exceed 4,000."
        );

        uint256 oldBasisPoints = taxBasisPoints;
        taxBasisPoints = newBasisPoints;

        emit TaxBasisPointsUpdated(oldBasisPoints, newBasisPoints);
    }

    /**
     * @notice Add address to set of tax-exempted addresses.
     * @param exemption Address to add to set of tax-exempted addresses.
     */
    function addExemption(address exemption) external onlyOwner {
        if (_exempted.add(exemption)) {
            emit TaxExemptionUpdated(exemption, true);
        }
    }

    /**
     * @notice Remove address from set of tax-exempted addresses.
     * @param exemption Address to remove from set of tax-exempted addresses.
     */
    function removeExemption(address exemption) external onlyOwner {
        if (_exempted.remove(exemption)) {
            emit TaxExemptionUpdated(exemption, false);
        }
    }
}
ExchangePoolProcessor.sol 79 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

/**
 * @title Exchange pool processor abstract contract.
 * @dev Keeps an enumerable set of designated exchange addresses as well as a single primary pool address.
 */
abstract contract ExchangePoolProcessor is Ownable {
    using EnumerableSet for EnumerableSet.AddressSet;

    /// @dev Set of exchange pool addresses.
    EnumerableSet.AddressSet internal _exchangePools;

    /// @notice Primary exchange pool address.
    address public primaryPool;

    /// @notice Emitted when an exchange pool address is added to the set of tracked pool addresses.
    event ExchangePoolAdded(address exchangePool);

    /// @notice Emitted when an exchange pool address is removed from the set of tracked pool addresses.
    event ExchangePoolRemoved(address exchangePool);

    /// @notice Emitted when the primary pool address is updated.
    event PrimaryPoolUpdated(address oldPrimaryPool, address newPrimaryPool);

    /**
     * @notice Get list of addresses designated as exchange pools.
     * @return An array of exchange pool addresses.
     */
    function getExchangePoolAddresses() external view returns (address[] memory) {
        return _exchangePools.values();
    }

    /**
     * @notice Add an address to the set of exchange pool addresses.
     * @dev Nothing happens if the pool already exists in the set.
     * @param exchangePool Address of exchange pool to add.
     */
    function addExchangePool(address exchangePool) external onlyOwner {
        if (_exchangePools.add(exchangePool)) {
            emit ExchangePoolAdded(exchangePool);
        }
    }

    /**
     * @notice Remove an address from the set of exchange pool addresses.
     * @dev Nothing happens if the pool doesn't exist in the set..
     * @param exchangePool Address of exchange pool to remove.
     */
    function removeExchangePool(address exchangePool) external onlyOwner {
        if (_exchangePools.remove(exchangePool)) {
            emit ExchangePoolRemoved(exchangePool);
        }
    }

    /**
     * @notice Set exchange pool address as primary pool.
     * @dev To prevent issues, only addresses inside the set of exchange pool addresses can be selected as primary pool.
     * @param exchangePool Address of exchange pool to set as primary pool.
     */
    function setPrimaryPool(address exchangePool) external onlyOwner {
        require(
            _exchangePools.contains(exchangePool),
            "ExchangePoolProcessor:setPrimaryPool:INVALID_POOL: Given address is not registered as exchange pool."
        );
        require(
            primaryPool != exchangePool,
            "ExchangePoolProcessor:setPrimaryPool:ALREADY_SET: This address is already the primary pool address."
        );

        address oldPrimaryPool = primaryPool;
        primaryPool = exchangePool;

        emit PrimaryPoolUpdated(oldPrimaryPool, exchangePool);
    }
}

Read Contract

getExchangePoolAddresses 0x0c6df5e4 → address[]
getTax 0xd7ad21ac → uint256
owner 0x8da5cb5b → address
primaryPool 0x9be3d69c → address
taxBasisPoints 0x7a210a2b → uint256

Write Contract 8 functions

These functions modify contract state and require a wallet transaction to execute.

addExchangePool 0xb6044b68
address exchangePool
addExemption 0x705931fa
address exemption
removeExchangePool 0xc2510346
address exchangePool
removeExemption 0x0ed9cc4c
address exemption
renounceOwnership 0x715018a6
No parameters
setPrimaryPool 0x3f91d69d
address exchangePool
setTaxBasisPoints 0x88434e6c
uint256 newBasisPoints
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

This address has 1 on-chain transactions, but only 1.5% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →