ETH Price: $3,270.91 (-1.20%)

Contract

0x444443bae5bB8640677A8cdF94CB8879Fec948Ec
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

1 Internal Transaction found.

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block
From
To
165572542023-02-04 18:37:59706 days ago1675535879  Contract Creation0 ETH
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x0259e629...50F7671fa
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
ShareValueHelper

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, None license
File 1 of 1 : Helper.sol
pragma solidity 0.8.6;

interface IVault {
    function totalSupply() external view returns (uint);
    function lockedProfitDegradation() external view returns (uint);
    function lastReport() external view returns (uint);
    function totalAssets() external view returns (uint);
    function lockedProfit() external view returns (uint);
}

/// @title Share Value Helper
/// @dev This works on all Yearn vaults 0.4.0+
/// @dev Achieves a higher precision conversion than pricePerShare; particularly for tokens with < 18 decimals.
contract ShareValueHelper {

    /// @notice Helper function to convert shares to underlying amount with exact precision
    function sharesToAmount(address vault, uint shares) external view returns (uint) {
        uint totalSupply = IVault(vault).totalSupply();
        if (totalSupply == 0) return shares;

        uint freeFunds = calculateFreeFunds(vault);
        return (
            shares
            * freeFunds
            / totalSupply
        );
    }

    /// @notice Helper function to convert underlying amount to shares with exact precision
    function amountToShares(address vault, uint amount) external view returns (uint) {
        uint totalSupply = IVault(vault).totalSupply();
        if (totalSupply > 0) {
            return amount * totalSupply / calculateFreeFunds(vault);
        }
        return amount;
    }
    
    function calculateFreeFunds(address vault) public view returns (uint) {
        uint totalAssets = IVault(vault).totalAssets();
        uint lockedFundsRatio = (block.timestamp - IVault(vault).lastReport()) * IVault(vault).lockedProfitDegradation();

        if (lockedFundsRatio < 10 ** 18) {
            uint lockedProfit = IVault(vault).lockedProfit();
            lockedProfit -= (
                lockedFundsRatio
                * lockedProfit
                / 10 ** 18
            );
            return totalAssets - lockedProfit;
        }
        else {
            return totalAssets;
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"amountToShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"}],"name":"calculateFreeFunds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"sharesToAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063a59c850414610046578063c1e2998d1461006b578063d3d83fa61461007e575b600080fd5b610059610054366004610459565b610091565b60405190815260200160405180910390f35b610059610079366004610437565b61013d565b61005961008c366004610459565b610375565b600080836001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100cd57600080fd5b505afa1580156100e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101059190610483565b90508015610132576101168461013d565b61012082856104be565b61012a919061049c565b915050610137565b829150505b92915050565b600080826001600160a01b03166301e1d1146040518163ffffffff1660e01b815260040160206040518083038186803b15801561017957600080fd5b505afa15801561018d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101b19190610483565b90506000836001600160a01b031663422327166040518163ffffffff1660e01b815260040160206040518083038186803b1580156101ee57600080fd5b505afa158015610202573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102269190610483565b846001600160a01b031663c3535b526040518163ffffffff1660e01b815260040160206040518083038186803b15801561025f57600080fd5b505afa158015610273573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102979190610483565b6102a190426104dd565b6102ab91906104be565b9050670de0b6b3a764000081101561036e576000846001600160a01b03166344b813966040518163ffffffff1660e01b815260040160206040518083038186803b1580156102f857600080fd5b505afa15801561030c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103309190610483565b9050670de0b6b3a764000061034582846104be565b61034f919061049c565b61035990826104dd565b905061036581846104dd565b95945050505050565b5092915050565b600080836001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156103b157600080fd5b505afa1580156103c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103e99190610483565b9050806103f95782915050610137565b60006104048561013d565b90508161041182866104be565b610365919061049c565b80356001600160a01b038116811461043257600080fd5b919050565b60006020828403121561044957600080fd5b6104528261041b565b9392505050565b6000806040838503121561046c57600080fd5b6104758361041b565b946020939093013593505050565b60006020828403121561049557600080fd5b5051919050565b6000826104b957634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156104d8576104d86104f4565b500290565b6000828210156104ef576104ef6104f4565b500390565b634e487b7160e01b600052601160045260246000fdfea264697066735822122075e30a47644342473a6a4d79108dc89e90b8a3bb72f02a005dea46458925b61764736f6c63430008060033

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.