Contract 0x32248ec445d3c72b42f16b040e55bcd5cf5a8712 2

Premia 
 

Contract Overview

Premia: Fee Collector Implementation
Balance:
0 ETH

ETH Value:
$0.00
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x6243a60cfacd0676328597dac566f7155548647ee81322d5e166c39bf0d2b5cd0x60a0604033033272021-11-24 17:15:05369 days 3 hrs ago0xc7f8d87734ab2cbf70030ac8aa82abfe3e8126cb IN  Contract Creation0 ETH0.004467270247 ETH
[ Download CSV Export 
Latest 5 internal transactions
Parent Txn Hash Block From To Value
0xc5bbb90fe1c800053caf26ce9545ac2308965824d2ff855603a8ea52376ca7ff111097602022-05-03 15:04:54209 days 5 hrs ago 0x5ca1ea5549e4e7cb64ae35225e11865d2572b3f9 Premia: Fee Collector Implementation0 ETH
0xb3371d8aa32b42e48265fea0543742cdf5fb07503b76316ecc766c1161ee286251664362022-01-28 10:21:16304 days 10 hrs ago 0x5ca1ea5549e4e7cb64ae35225e11865d2572b3f9 Premia: Fee Collector Implementation0 ETH
0x61e0ce078480b4b6478c5b94bd6df6e5d4fe6b5af122290a9fe9c3e1aefaa70540814292021-12-25 18:03:01338 days 2 hrs ago 0x5ca1ea5549e4e7cb64ae35225e11865d2572b3f9 Premia: Fee Collector Implementation0 ETH
0xdbf9d4674d7887064bb70aea77d8a63ca6019bc1a7d3924cba2728f151f7898236952912021-12-09 6:52:08354 days 14 hrs ago 0x5ca1ea5549e4e7cb64ae35225e11865d2572b3f9 Premia: Fee Collector Implementation0 ETH
0xbe25be50b4682e3c43b6c500f22ca1e38ddb3b0dc087dd07136503d1f24e1ae735148812021-12-02 15:04:07361 days 5 hrs ago 0x5ca1ea5549e4e7cb64ae35225e11865d2572b3f9 Premia: Fee Collector Implementation0 ETH
[ Download CSV Export 
Loading

Similar Match Source Code
Note: This contract matches the deployed ByteCode of the Source Code for Contract 0x9d3F42C5ca9426303b91567288E461230049e092

Contract Name:
FeeCollector

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 7 : FeeCollector.sol
// SPDX-License-Identifier: BUSL-1.1
// For further clarification please see https://license.premia.legal

pragma solidity ^0.8.0;

import {SafeERC20} from "@solidstate/contracts/utils/SafeERC20.sol";
import {IERC20} from "@solidstate/contracts/token/ERC20/IERC20.sol";

import {IFeeCollector} from "./interface/IFeeCollector.sol";
import {IPoolIO} from "./pool/IPoolIO.sol";

// Contract used to facilitate withdrawal of fees to multisig on L2, in order to bridge to L1
contract FeeCollector is IFeeCollector {
    using SafeERC20 for IERC20;

    // The treasury address which will receive a portion of the protocol fees
    address public immutable RECEIVER;

    constructor(address _receiver) {
        RECEIVER = _receiver;
    }

    function withdraw(address[] memory pools, address[] memory tokens)
        external
        override
    {
        for (uint256 i = 0; i < pools.length; i++) {
            IPoolIO(pools[i]).withdrawFees();
        }

        for (uint256 i = 0; i < tokens.length; i++) {
            uint256 amount = IERC20(tokens[i]).balanceOf(address(this));

            if (amount > 0) {
                IERC20(tokens[i]).safeTransfer(RECEIVER, amount);
            }
        }
    }
}

File 2 of 7 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import { IERC20 } from '../token/ERC20/IERC20.sol';
import { AddressUtils } from './AddressUtils.sol';

/**
 * @title Safe ERC20 interaction library
 * @dev derived from https://github.com/OpenZeppelin/openzeppelin-contracts/ (MIT license)
 */
library SafeERC20 {
    using AddressUtils for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(
            token,
            abi.encodeWithSelector(token.transfer.selector, to, value)
        );
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(
            token,
            abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
        );
    }

    /**
     * @dev safeApprove (like approve) should only be called when setting an initial allowance or when resetting it to zero; otherwise prefer safeIncreaseAllowance and safeDecreaseAllowance
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            'SafeERC20: approve from non-zero to non-zero allowance'
        );

        _callOptionalReturn(
            token,
            abi.encodeWithSelector(token.approve.selector, spender, value)
        );
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(
            token,
            abi.encodeWithSelector(
                token.approve.selector,
                spender,
                newAllowance
            )
        );
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(
                oldAllowance >= value,
                'SafeERC20: decreased allowance below zero'
            );
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(
                token,
                abi.encodeWithSelector(
                    token.approve.selector,
                    spender,
                    newAllowance
                )
            );
        }
    }

    /**
     * @notice send transaction data and check validity of return value, if present
     * @param token ERC20 token interface
     * @param data transaction data
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        bytes memory returndata = address(token).functionCall(
            data,
            'SafeERC20: low-level call failed'
        );

        if (returndata.length > 0) {
            require(
                abi.decode(returndata, (bool)),
                'SafeERC20: ERC20 operation did not succeed'
            );
        }
    }
}

File 3 of 7 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import { IERC20Internal } from './IERC20Internal.sol';

/**
 * @title ERC20 interface
 * @dev see https://github.com/ethereum/EIPs/issues/20
 */
interface IERC20 is IERC20Internal {
    /**
     * @notice query the total minted token supply
     * @return token supply
     */
    function totalSupply() external view returns (uint256);

    /**
     * @notice query the token balance of given account
     * @param account address to query
     * @return token balance
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @notice query the allowance granted from given holder to given spender
     * @param holder approver of allowance
     * @param spender recipient of allowance
     * @return token allowance
     */
    function allowance(address holder, address spender)
        external
        view
        returns (uint256);

    /**
     * @notice grant approval to spender to spend tokens
     * @dev prefer ERC20Extended functions to avoid transaction-ordering vulnerability (see https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729)
     * @param spender recipient of allowance
     * @param amount quantity of tokens approved for spending
     * @return success status (always true; otherwise function should revert)
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @notice transfer tokens to given recipient
     * @param recipient beneficiary of token transfer
     * @param amount quantity of tokens to transfer
     * @return success status (always true; otherwise function should revert)
     */
    function transfer(address recipient, uint256 amount)
        external
        returns (bool);

    /**
     * @notice transfer tokens to given recipient on behalf of given holder
     * @param holder holder of tokens prior to transfer
     * @param recipient beneficiary of token transfer
     * @param amount quantity of tokens to transfer
     * @return success status (always true; otherwise function should revert)
     */
    function transferFrom(
        address holder,
        address recipient,
        uint256 amount
    ) external returns (bool);
}

File 4 of 7 : IFeeCollector.sol
// SPDX-License-Identifier: LGPL-3.0-or-later

pragma solidity ^0.8.0;

interface IFeeCollector {
    function withdraw(address[] memory pools, address[] memory tokens) external;
}

File 5 of 7 : IPoolIO.sol
// SPDX-License-Identifier: LGPL-3.0-or-later

pragma solidity ^0.8.0;

interface IPoolIO {
    function setDivestmentTimestamp(uint64 timestamp, bool isCallPool) external;

    function deposit(uint256 amount, bool isCallPool) external payable;

    function swapAndDeposit(
        uint256 amount,
        bool isCallPool,
        uint256 amountOut,
        uint256 amountInMax,
        address[] calldata path,
        bool isSushi
    ) external payable;

    function withdraw(uint256 amount, bool isCallPool) external;

    function reassign(uint256 tokenId, uint256 contractSize)
        external
        returns (
            uint256 baseCost,
            uint256 feeCost,
            uint256 amountOut
        );

    function reassignBatch(
        uint256[] calldata tokenIds,
        uint256[] calldata contractSizes
    )
        external
        returns (
            uint256[] memory baseCosts,
            uint256[] memory feeCosts,
            uint256 amountOutCall,
            uint256 amountOutPut
        );

    function withdrawAllAndReassignBatch(
        bool isCallPool,
        uint256[] calldata tokenIds,
        uint256[] calldata contractSizes
    )
        external
        returns (
            uint256[] memory baseCosts,
            uint256[] memory feeCosts,
            uint256 amountOutCall,
            uint256 amountOutPut
        );

    function withdrawFees()
        external
        returns (uint256 amountOutCall, uint256 amountOutPut);

    function annihilate(uint256 tokenId, uint256 contractSize) external;

    function claimRewards(bool isCallPool) external;

    function claimRewards(address account, bool isCallPool) external;

    function updateMiningPools() external;
}

File 6 of 7 : AddressUtils.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

library AddressUtils {
    function toString(address account) internal pure returns (string memory) {
        bytes32 value = bytes32(uint256(uint160(account)));
        bytes memory alphabet = '0123456789abcdef';
        bytes memory chars = new bytes(42);

        chars[0] = '0';
        chars[1] = 'x';

        for (uint256 i = 0; i < 20; i++) {
            chars[2 + i * 2] = alphabet[uint8(value[i + 12] >> 4)];
            chars[3 + i * 2] = alphabet[uint8(value[i + 12] & 0x0f)];
        }

        return string(chars);
    }

    function isContract(address account) internal view returns (bool) {
        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    function sendValue(address payable account, uint256 amount) internal {
        (bool success, ) = account.call{ value: amount }('');
        require(success, 'AddressUtils: failed to send value');
    }

    function functionCall(address target, bytes memory data)
        internal
        returns (bytes memory)
    {
        return
            functionCall(target, data, 'AddressUtils: failed low-level call');
    }

    function functionCall(
        address target,
        bytes memory data,
        string memory error
    ) internal returns (bytes memory) {
        return _functionCallWithValue(target, data, 0, error);
    }

    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return
            functionCallWithValue(
                target,
                data,
                value,
                'AddressUtils: failed low-level call with value'
            );
    }

    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory error
    ) internal returns (bytes memory) {
        require(
            address(this).balance >= value,
            'AddressUtils: insufficient balance for call'
        );
        return _functionCallWithValue(target, data, value, error);
    }

    function _functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory error
    ) private returns (bytes memory) {
        require(
            isContract(target),
            'AddressUtils: function call to non-contract'
        );

        (bool success, bytes memory returnData) = target.call{ value: value }(
            data
        );

        if (success) {
            return returnData;
        } else if (returnData.length > 0) {
            assembly {
                let returnData_size := mload(returnData)
                revert(add(32, returnData), returnData_size)
            }
        } else {
            revert(error);
        }
    }
}

File 7 of 7 : IERC20Internal.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @title Partial ERC20 interface needed by internal functions
 */
interface IERC20Internal {
    event Transfer(address indexed from, address indexed to, uint256 value);

    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_receiver","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"RECEIVER","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"pools","type":"address[]"},{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a060405234801561001057600080fd5b506040516107a63803806107a683398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161071561009160003960008181604001526101f001526107156000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063ad7430cc1461003b578063c8b686721461007e575b600080fd5b6100627f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200160405180910390f35b61009161008c366004610557565b610093565b005b60005b825181101561013f578281815181106100b1576100b16105bb565b60200260200101516001600160a01b031663476343ee6040518163ffffffff1660e01b81526004016040805180830381600087803b1580156100f257600080fd5b505af1158015610106573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061012a91906105d1565b50508080610137906105f5565b915050610096565b5060005b8151811015610255576000828281518110610160576101606105bb565b60209081029190910101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b1580156101ab57600080fd5b505afa1580156101bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101e3919061061e565b90508015610242576102427f000000000000000000000000000000000000000000000000000000000000000082858581518110610222576102226105bb565b60200260200101516001600160a01b031661025a9092919063ffffffff16565b508061024d816105f5565b915050610143565b505050565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092018352602080830180516001600160e01b031663a9059cbb60e01b17905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656490840152610255928692916000916102ea91851690849061036c565b80519091501561025557808060200190518101906103089190610637565b6102555760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084015b60405180910390fd5b606061037b8484600085610383565b949350505050565b6060843b6103e75760405162461bcd60e51b815260206004820152602b60248201527f416464726573735574696c733a2066756e6374696f6e2063616c6c20746f206e60448201526a1bdb8b58dbdb9d1c9858dd60aa1b6064820152608401610363565b600080866001600160a01b031685876040516104039190610690565b60006040518083038185875af1925050503d8060008114610440576040519150601f19603f3d011682016040523d82523d6000602084013e610445565b606091505b5091509150811561045957915061037b9050565b8051156104695780518082602001fd5b8360405162461bcd60e51b815260040161036391906106ac565b634e487b7160e01b600052604160045260246000fd5b80356001600160a01b03811681146104b057600080fd5b919050565b600082601f8301126104c657600080fd5b8135602067ffffffffffffffff808311156104e3576104e3610483565b8260051b604051601f19603f8301168101818110848211171561050857610508610483565b60405293845285810183019383810192508785111561052657600080fd5b83870191505b8482101561054c5761053d82610499565b8352918301919083019061052c565b979650505050505050565b6000806040838503121561056a57600080fd5b823567ffffffffffffffff8082111561058257600080fd5b61058e868387016104b5565b935060208501359150808211156105a457600080fd5b506105b1858286016104b5565b9150509250929050565b634e487b7160e01b600052603260045260246000fd5b600080604083850312156105e457600080fd5b505080516020909101519092909150565b600060001982141561061757634e487b7160e01b600052601160045260246000fd5b5060010190565b60006020828403121561063057600080fd5b5051919050565b60006020828403121561064957600080fd5b8151801515811461065957600080fd5b9392505050565b60005b8381101561067b578181015183820152602001610663565b8381111561068a576000848401525b50505050565b600082516106a2818460208701610660565b9190910192915050565b60208152600082518060208401526106cb816040850160208701610660565b601f01601f1916919091016040019291505056fea2646970667358221220983a06d8bfddc3d4be4b0e36ff890c8f9bd3e1770427a4d6ff0ad06460b1656f64736f6c63430008090033000000000000000000000000a079c6b032133b95cf8b3d273d27eeb6b110a469

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.