ETH Price: $2,426.05 (+0.08%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60e06040192251982024-02-14 9:04:23264 days ago1707901463IN
 Create: FeeConverter
0 ETH0.0082575135

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FeeConverter

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 7 : FeeConverter.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.10 <0.8.0;

import "../interfaces/IFundV5.sol";
import "../interfaces/IPrimaryMarketV5.sol";
import "../interfaces/ITrancheIndexV2.sol";

contract FeeConverter is ITrancheIndexV2 {
    IFundV5 public immutable fund;
    IPrimaryMarketV5 public immutable primaryMarket;
    address public immutable feeCollector;

    constructor(address primaryMarket_, address feeCollector_) public {
        primaryMarket = IPrimaryMarketV5(primaryMarket_);
        fund = IFundV5(IPrimaryMarketV5(primaryMarket_).fund());
        feeCollector = feeCollector_;
    }

    function collectFee() external {
        uint256 fee = fund.trancheBalanceOf(TRANCHE_Q, address(this));
        uint256 version = fund.getRebalanceSize();
        primaryMarket.redeem(feeCollector, fee, 0, version);
    }
}

File 2 of 7 : IFundV3.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.10 <0.8.0;
pragma experimental ABIEncoderV2;

import "./ITwapOracleV2.sol";

interface IFundV3 {
    /// @notice A linear transformation matrix that represents a rebalance.
    ///
    ///         ```
    ///             [        1        0        0 ]
    ///         R = [ ratioB2Q  ratioBR        0 ]
    ///             [ ratioR2Q        0  ratioBR ]
    ///         ```
    ///
    ///         Amounts of the three tranches `q`, `b` and `r` can be rebalanced by multiplying the matrix:
    ///
    ///         ```
    ///         [ q', b', r' ] = [ q, b, r ] * R
    ///         ```
    struct Rebalance {
        uint256 ratioB2Q;
        uint256 ratioR2Q;
        uint256 ratioBR;
        uint256 timestamp;
    }

    function tokenUnderlying() external view returns (address);

    function tokenQ() external view returns (address);

    function tokenB() external view returns (address);

    function tokenR() external view returns (address);

    function tokenShare(uint256 tranche) external view returns (address);

    function primaryMarket() external view returns (address);

    function primaryMarketUpdateProposal() external view returns (address, uint256);

    function strategy() external view returns (address);

    function strategyUpdateProposal() external view returns (address, uint256);

    function underlyingDecimalMultiplier() external view returns (uint256);

    function twapOracle() external view returns (ITwapOracleV2);

    function feeCollector() external view returns (address);

    function endOfDay(uint256 timestamp) external pure returns (uint256);

    function trancheTotalSupply(uint256 tranche) external view returns (uint256);

    function trancheBalanceOf(uint256 tranche, address account) external view returns (uint256);

    function trancheAllBalanceOf(address account) external view returns (uint256, uint256, uint256);

    function trancheBalanceVersion(address account) external view returns (uint256);

    function trancheAllowance(
        uint256 tranche,
        address owner,
        address spender
    ) external view returns (uint256);

    function trancheAllowanceVersion(
        address owner,
        address spender
    ) external view returns (uint256);

    function trancheTransfer(
        uint256 tranche,
        address recipient,
        uint256 amount,
        uint256 version
    ) external;

    function trancheTransferFrom(
        uint256 tranche,
        address sender,
        address recipient,
        uint256 amount,
        uint256 version
    ) external;

    function trancheApprove(
        uint256 tranche,
        address spender,
        uint256 amount,
        uint256 version
    ) external;

    function getRebalanceSize() external view returns (uint256);

    function getRebalance(uint256 index) external view returns (Rebalance memory);

    function getRebalanceTimestamp(uint256 index) external view returns (uint256);

    function currentDay() external view returns (uint256);

    function splitRatio() external view returns (uint256);

    function historicalSplitRatio(uint256 version) external view returns (uint256);

    function fundActivityStartTime() external view returns (uint256);

    function isFundActive(uint256 timestamp) external view returns (bool);

    function getEquivalentTotalB() external view returns (uint256);

    function getEquivalentTotalQ() external view returns (uint256);

    function historicalEquivalentTotalB(uint256 timestamp) external view returns (uint256);

    function historicalNavs(uint256 timestamp) external view returns (uint256 navB, uint256 navR);

    function extrapolateNav(uint256 price) external view returns (uint256, uint256, uint256);

    function doRebalance(
        uint256 amountQ,
        uint256 amountB,
        uint256 amountR,
        uint256 index
    ) external view returns (uint256 newAmountQ, uint256 newAmountB, uint256 newAmountR);

    function batchRebalance(
        uint256 amountQ,
        uint256 amountB,
        uint256 amountR,
        uint256 fromIndex,
        uint256 toIndex
    ) external view returns (uint256 newAmountQ, uint256 newAmountB, uint256 newAmountR);

    function refreshBalance(address account, uint256 targetVersion) external;

    function refreshAllowance(address owner, address spender, uint256 targetVersion) external;

    function shareTransfer(address sender, address recipient, uint256 amount) external;

    function shareTransferFrom(
        address spender,
        address sender,
        address recipient,
        uint256 amount
    ) external returns (uint256 newAllowance);

    function shareIncreaseAllowance(
        address sender,
        address spender,
        uint256 addedValue
    ) external returns (uint256 newAllowance);

    function shareDecreaseAllowance(
        address sender,
        address spender,
        uint256 subtractedValue
    ) external returns (uint256 newAllowance);

    function shareApprove(address owner, address spender, uint256 amount) external;

    function historicalUnderlying(uint256 timestamp) external view returns (uint256);

    function getTotalUnderlying() external view returns (uint256);

    function getStrategyUnderlying() external view returns (uint256);

    function getTotalDebt() external view returns (uint256);

    event RebalanceTriggered(
        uint256 indexed index,
        uint256 indexed day,
        uint256 navSum,
        uint256 navB,
        uint256 navROrZero,
        uint256 ratioB2Q,
        uint256 ratioR2Q,
        uint256 ratioBR
    );
    event Settled(uint256 indexed day, uint256 navB, uint256 navR, uint256 interestRate);
    event InterestRateUpdated(uint256 baseInterestRate, uint256 floatingInterestRate);
    event BalancesRebalanced(
        address indexed account,
        uint256 version,
        uint256 balanceQ,
        uint256 balanceB,
        uint256 balanceR
    );
    event AllowancesRebalanced(
        address indexed owner,
        address indexed spender,
        uint256 version,
        uint256 allowanceQ,
        uint256 allowanceB,
        uint256 allowanceR
    );
}

File 3 of 7 : IFundV5.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.10 <0.8.0;

import "./IFundV3.sol";

interface IFundV5 is IFundV3 {
    function weightB() external view returns (uint256);

    function getSettledDay() external view returns (uint256);

    function getEquivalentTotalR() external view returns (uint256);

    function frozen() external view returns (bool);
}

File 4 of 7 : IPrimaryMarketV5.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.10 <0.8.0;

interface IPrimaryMarketV5 {
    function fund() external view returns (address);

    function getCreation(uint256 underlying) external view returns (uint256 outQ);

    function getCreationForQ(uint256 minOutQ) external view returns (uint256 underlying);

    function getRedemption(uint256 inQ) external view returns (uint256 underlying, uint256 fee);

    function getRedemptionForUnderlying(uint256 minUnderlying) external view returns (uint256 inQ);

    function getSplit(uint256 inQ) external view returns (uint256 outB, uint256 outR);

    function getSplitForR(uint256 minOutR) external view returns (uint256 inQ, uint256 outB);

    function getMerge(uint256 inB) external view returns (uint256 inR, uint256 outQ, uint256 feeQ);

    function getMergeByR(
        uint256 inR
    ) external view returns (uint256 inB, uint256 outQ, uint256 feeQ);

    function canBeRemovedFromFund() external view returns (bool);

    function create(
        address recipient,
        uint256 minOutQ,
        uint256 version
    ) external returns (uint256 outQ);

    function redeem(
        address recipient,
        uint256 inQ,
        uint256 minUnderlying,
        uint256 version
    ) external returns (uint256 underlying);

    function redeemAndUnwrap(
        address recipient,
        uint256 inQ,
        uint256 minUnderlying,
        uint256 version
    ) external returns (uint256 underlying);

    function redeemAndUnwrapWstETH(
        address recipient,
        uint256 inQ,
        uint256 minStETH,
        uint256 version
    ) external returns (uint256 stETHAmount);

    function queueRedemption(
        address recipient,
        uint256 inQ,
        uint256 minUnderlying,
        uint256 version
    ) external returns (uint256 underlying, uint256 index);

    function claimRedemptions(
        address account,
        uint256[] calldata indices
    ) external returns (uint256 underlying);

    function claimRedemptionsAndUnwrap(
        address account,
        uint256[] calldata indices
    ) external returns (uint256 underlying);

    function claimRedemptionsAndUnwrapWstETH(
        address account,
        uint256[] calldata indices
    ) external returns (uint256 stETHAmount);

    function split(
        address recipient,
        uint256 inQ,
        uint256 version
    ) external returns (uint256 outB, uint256 outR);

    function merge(address recipient, uint256 inB, uint256 version) external returns (uint256 outQ);

    function settle(uint256 day) external;
}

File 5 of 7 : ITrancheIndexV2.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.10 <0.8.0;

/// @notice Amounts of QUEEN, BISHOP and ROOK are sometimes stored in a `uint256[3]` array.
///         This contract defines index of each tranche in this array.
///
///         Solidity does not allow constants to be defined in interfaces. So this contract follows
///         the naming convention of interfaces but is implemented as an `abstract contract`.
abstract contract ITrancheIndexV2 {
    uint256 internal constant TRANCHE_Q = 0;
    uint256 internal constant TRANCHE_B = 1;
    uint256 internal constant TRANCHE_R = 2;

    uint256 internal constant TRANCHE_COUNT = 3;
}

File 6 of 7 : ITwapOracle.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.10 <0.8.0;

interface ITwapOracle {
    enum UpdateType {
        PRIMARY,
        SECONDARY,
        OWNER,
        CHAINLINK,
        UNISWAP_V2
    }

    function getTwap(uint256 timestamp) external view returns (uint256);
}

File 7 of 7 : ITwapOracleV2.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.6.10 <0.8.0;

import "./ITwapOracle.sol";

interface ITwapOracleV2 is ITwapOracle {
    function getLatest() external view returns (uint256);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"primaryMarket_","type":"address"},{"internalType":"address","name":"feeCollector_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"collectFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fund","outputs":[{"internalType":"contract IFundV5","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"primaryMarket","outputs":[{"internalType":"contract IPrimaryMarketV5","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60e060405234801561001057600080fd5b5060405161044f38038061044f8339818101604052604081101561003357600080fd5b5080516020918201516001600160601b0319606083901b1660a052604080516316c1a85160e31b81529051929391926001600160a01b0385169263b60d42889260048082019391829003018186803b15801561008e57600080fd5b505afa1580156100a2573d6000803e3d6000fd5b505050506040513d60208110156100b857600080fd5b50516001600160601b0319606091821b811660805291901b1660c0525060805160601c60a05160601c60c05160601c61033461011b6000398060d952806102405250806091528061028452508060b5528061012452806101b652506103346000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80631e77ceda14610051578063b60d428814610075578063c415b95c1461007d578063d4d5d32a14610085575b600080fd5b61005961008f565b604080516001600160a01b039092168252519081900360200190f35b6100596100b3565b6100596100d7565b61008d6100fb565b005b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60408051636c73303160e11b815260006004820181905230602483015291516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163d8e66062916044808301926020929190829003018186803b15801561016a57600080fd5b505afa15801561017e573d6000803e3d6000fd5b505050506040513d602081101561019457600080fd5b505160408051635264e68160e01b815290519192506000916001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691635264e681916004808301926020929190829003018186803b1580156101fc57600080fd5b505afa158015610210573d6000803e3d6000fd5b505050506040513d602081101561022657600080fd5b50516040805163ea2092f360e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018690526000604483018190526064830185905292519394507f0000000000000000000000000000000000000000000000000000000000000000169263ea2092f392608480840193602093929083900390910190829087803b1580156102ce57600080fd5b505af11580156102e2573d6000803e3d6000fd5b505050506040513d60208110156102f857600080fd5b5050505056fea26469706673582212206bf85baca7fc1cc12251a37a8d67b98ad5551c03e722c6921a96a27e44bfb4c464736f6c634300060c0033000000000000000000000000a8be5ab62794a647254e1e62844201efc8477e2200000000000000000000000000db7b1300b2b24fb9bdf4f661f650a2998e367a

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80631e77ceda14610051578063b60d428814610075578063c415b95c1461007d578063d4d5d32a14610085575b600080fd5b61005961008f565b604080516001600160a01b039092168252519081900360200190f35b6100596100b3565b6100596100d7565b61008d6100fb565b005b7f000000000000000000000000a8be5ab62794a647254e1e62844201efc8477e2281565b7f000000000000000000000000811c9dd8b7b670a78d02fac592ebbe465e5dd0fa81565b7f00000000000000000000000000db7b1300b2b24fb9bdf4f661f650a2998e367a81565b60408051636c73303160e11b815260006004820181905230602483015291516001600160a01b037f000000000000000000000000811c9dd8b7b670a78d02fac592ebbe465e5dd0fa169163d8e66062916044808301926020929190829003018186803b15801561016a57600080fd5b505afa15801561017e573d6000803e3d6000fd5b505050506040513d602081101561019457600080fd5b505160408051635264e68160e01b815290519192506000916001600160a01b037f000000000000000000000000811c9dd8b7b670a78d02fac592ebbe465e5dd0fa1691635264e681916004808301926020929190829003018186803b1580156101fc57600080fd5b505afa158015610210573d6000803e3d6000fd5b505050506040513d602081101561022657600080fd5b50516040805163ea2092f360e01b81526001600160a01b037f00000000000000000000000000db7b1300b2b24fb9bdf4f661f650a2998e367a81166004830152602482018690526000604483018190526064830185905292519394507f000000000000000000000000a8be5ab62794a647254e1e62844201efc8477e22169263ea2092f392608480840193602093929083900390910190829087803b1580156102ce57600080fd5b505af11580156102e2573d6000803e3d6000fd5b505050506040513d60208110156102f857600080fd5b5050505056fea26469706673582212206bf85baca7fc1cc12251a37a8d67b98ad5551c03e722c6921a96a27e44bfb4c464736f6c634300060c0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000a8be5ab62794a647254e1e62844201efc8477e2200000000000000000000000000db7b1300b2b24fb9bdf4f661f650a2998e367a

-----Decoded View---------------
Arg [0] : primaryMarket_ (address): 0xa8BE5AB62794a647254e1e62844201EFC8477e22
Arg [1] : feeCollector_ (address): 0x00DB7B1300B2B24fB9bdf4F661f650a2998e367A

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000a8be5ab62794a647254e1e62844201efc8477e22
Arg [1] : 00000000000000000000000000db7b1300b2b24fb9bdf4f661f650a2998e367a


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.