Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
CurveLPPessimisticFeed
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 10000 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import {ICurvePool} from "src/interfaces/ICurvePool.sol"; import {IChainlinkBasePriceFeed} from "src/interfaces/IChainlinkFeed.sol"; contract CurveLPPessimisticFeed { ICurvePool public immutable curvePool; IChainlinkBasePriceFeed public immutable coin1Feed; IChainlinkBasePriceFeed public immutable coin2Feed; string public description; constructor(address _curvePool, address _coin1Feed, address _coin2Feed) { curvePool = ICurvePool(_curvePool); coin1Feed = IChainlinkBasePriceFeed(_coin1Feed); coin2Feed = IChainlinkBasePriceFeed(_coin2Feed); require( coin1Feed.decimals() == coin2Feed.decimals() && coin1Feed.decimals() == 18, "CurveLPPessimisticFeed: DECIMALS_MISMATCH" ); description = string(abi.encodePacked(curvePool.symbol(), " / USD")); } /** * @return roundId The round ID of the Chainlink price feed * @return minLpUsdprice The latest LP token price in USD * @return startedAt The timestamp when the latest round of Chainlink price feed started * @return updatedAt The timestamp when the latest round of Chainlink price feed was updated * @return answeredInRound The round ID in which the answer was computed */ function latestRoundData() public view returns (uint80, int256, uint256, uint256, uint80) { ( uint80 roundId, int256 usdPriceCoin1, uint startedAt, uint updatedAt, uint80 answeredInRound ) = coin1Feed.latestRoundData(); ( uint80 roundIdCoin2, int256 usdPriceCoin2, uint startedAtCoin2, uint updatedAtCoin2, uint80 answeredInRoundCoin2 ) = coin2Feed.latestRoundData(); int256 minLpUsdPrice; // If coin1 price is lower than coin2 price, use coin1 price if (usdPriceCoin1 < usdPriceCoin2) { minLpUsdPrice = (usdPriceCoin1 * int256(curvePool.get_virtual_price())) / int256(10 ** decimals()); } else { minLpUsdPrice = (usdPriceCoin2 * int(curvePool.get_virtual_price())) / int256(10 ** decimals()); } if (updatedAtCoin2 < updatedAt) { roundId = roundIdCoin2; startedAt = startedAtCoin2; updatedAt = updatedAtCoin2; answeredInRound = answeredInRoundCoin2; } return (roundId, minLpUsdPrice, startedAt, updatedAt, answeredInRound); } /** @notice Retrieves the latest price for LP token @return price The latest price for LP token */ function latestAnswer() external view returns (int256) { (, int256 price, , , ) = latestRoundData(); return price; } /** * @notice Retrieves number of decimals for the LP token price feed * @return decimals The number of decimals for the LP token price feed */ function decimals() public pure returns (uint8) { return 18; } }
pragma solidity ^0.8.13; interface ICurvePool { function price_oracle(uint256 k) external view returns (uint256); function get_virtual_price() external view returns (uint256); function price_oracle() external view returns (uint256); function add_liquidity( uint256[2] memory _amounts, uint256 _min_mint_amount, address _receiver ) external returns (uint256); function add_liquidity( uint256[2] memory _amounts, uint256 _min_mint_amount ) external returns (uint256); function add_liquidity( uint256[3] memory _amounts, uint256 _min_mint_amount, address _receiver ) external returns (uint256); function add_liquidity( uint256[3] memory _amounts, uint256 _min_mint_amount ) external returns (uint256); function remove_liquidity_one_coin( uint256 _burn_amount, int128 i, uint256 _min_received, address _receiver ) external returns (uint256); function coins(uint index) external view returns (address); function exchange( uint i, uint j, uint dx, uint min_dy, bool use_eth, address receiver ) external payable returns (uint); function calc_token_amount( uint256[2] memory _amounts, bool _is_deposit ) external view returns (uint256); function calc_withdraw_one_coin( uint256 _burn_amount, int128 i ) external view returns (uint256); function symbol() external view returns (string memory); }
pragma solidity ^0.8.13; interface IChainlinkFeed { function aggregator() external view returns (address aggregator); function decimals() external view returns (uint8 decimals); function latestRoundData() external view returns ( uint80 roundId, int256 crvUsdPrice, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); function latestAnswer() external view returns (int256 price); function description() external view returns (string memory description); } interface IChainlinkBasePriceFeed is IChainlinkFeed { function assetToUsd() external view returns (IChainlinkFeed); function assetToUsdFallback() external view returns (IChainlinkFeed); function assetToUsdHeartbeat() external view returns (uint256 heartbeat); }
{ "remappings": [ "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "solmate/=lib/solmate/src/" ], "optimizer": { "enabled": true, "runs": 10000 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "shanghai", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_curvePool","type":"address"},{"internalType":"address","name":"_coin1Feed","type":"address"},{"internalType":"address","name":"_coin2Feed","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"coin1Feed","outputs":[{"internalType":"contract IChainlinkBasePriceFeed","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"coin2Feed","outputs":[{"internalType":"contract IChainlinkBasePriceFeed","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"curvePool","outputs":[{"internalType":"contract ICurvePool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"description","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestAnswer","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRoundData","outputs":[{"internalType":"uint80","name":"","type":"uint80"},{"internalType":"int256","name":"","type":"int256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint80","name":"","type":"uint80"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60e060405234801562000010575f80fd5b5060405162000e8638038062000e868339810160408190526200003391620002ae565b6001600160a01b0380841660805282811660a052811660c08190526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa15801562000088573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620000ae9190620002f5565b60ff1660a0516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620000f0573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620001169190620002f5565b60ff161480156200018e575060a0516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000161573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620001879190620002f5565b60ff166012145b620001f15760405162461bcd60e51b815260206004820152602960248201527f43757276654c5050657373696d6973746963466565643a20444543494d414c536044820152680be9a92a69a82a886960bb1b606482015260840160405180910390fd5b6080516001600160a01b03166395d89b416040518163ffffffff1660e01b81526004015f60405180830381865afa1580156200022f573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405262000258919081019062000356565b6040516020016200026a919062000409565b6040516020818303038152906040525f9081620002889190620004c0565b5050505062000588565b80516001600160a01b0381168114620002a9575f80fd5b919050565b5f805f60608486031215620002c1575f80fd5b620002cc8462000292565b9250620002dc6020850162000292565b9150620002ec6040850162000292565b90509250925092565b5f6020828403121562000306575f80fd5b815160ff8116811462000317575f80fd5b9392505050565b634e487b7160e01b5f52604160045260245ffd5b5f5b838110156200034e57818101518382015260200162000334565b50505f910152565b5f6020828403121562000367575f80fd5b81516001600160401b03808211156200037e575f80fd5b818401915084601f83011262000392575f80fd5b815181811115620003a757620003a76200031e565b604051601f8201601f19908116603f01168101908382118183101715620003d257620003d26200031e565b81604052828152876020848701011115620003eb575f80fd5b620003fe83602083016020880162000332565b979650505050505050565b5f82516200041c81846020870162000332565b65080bc81554d160d21b920191825250600601919050565b600181811c908216806200044957607f821691505b6020821081036200046857634e487b7160e01b5f52602260045260245ffd5b50919050565b601f821115620004bb575f81815260208120601f850160051c81016020861015620004965750805b601f850160051c820191505b81811015620004b757828155600101620004a2565b5050505b505050565b81516001600160401b03811115620004dc57620004dc6200031e565b620004f481620004ed845462000434565b846200046e565b602080601f8311600181146200052a575f8415620005125750858301515b5f19600386901b1c1916600185901b178555620004b7565b5f85815260208120601f198616915b828110156200055a5788860151825594840194600190910190840162000539565b50858210156200057857878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c0516108b8620005ce5f395f818161010e01526102de01525f8181610135015261024201525f818160830152818161038a015261043e01526108b85ff3fe608060405234801561000f575f80fd5b506004361061007a575f3560e01c80637284e416116100585780637284e416146100f45780638c94cfd014610109578063faba60dd14610130578063feaf968c14610157575f80fd5b8063218751b21461007e578063313ce567146100cf57806350d25bcd146100de575b5f80fd5b6100a57f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b604051601281526020016100c6565b6100e6610196565b6040519081526020016100c6565b6100fc6101ab565b6040516100c6919061050e565b6100a57f000000000000000000000000000000000000000000000000000000000000000081565b6100a57f000000000000000000000000000000000000000000000000000000000000000081565b61015f610236565b6040805169ffffffffffffffffffff968716815260208101959095528401929092526060830152909116608082015260a0016100c6565b5f806101a0610236565b509195945050505050565b5f80546101b790610577565b80601f01602080910402602001604051908101604052809291908181526020018280546101e390610577565b801561022e5780601f106102055761010080835404028352916020019161022e565b820191905f5260205f20905b81548152906001019060200180831161021157829003601f168201915b505050505081565b5f805f805f805f805f807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa1580156102a9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102cd91906105e6565b945094509450945094505f805f805f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610345573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061036991906105e6565b945094509450945094505f848a1215610430576103886012600a61077f565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663bb7b8b806040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103f1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104159190610794565b61041f908c6107ab565b61042991906107f6565b90506104e0565b61043c6012600a61077f565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663bb7b8b806040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104a5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104c99190610794565b6104d390876107ab565b6104dd91906107f6565b90505b878310156104f557859a508398508297508196505b999f999e50969c50949a50929850959650505050505050565b5f6020808352835180828501525f5b818110156105395785810183015185820160400152820161051d565b505f6040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b600181811c9082168061058b57607f821691505b6020821081036105c2577f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b50919050565b805169ffffffffffffffffffff811681146105e1575f80fd5b919050565b5f805f805f60a086880312156105fa575f80fd5b610603866105c8565b9450602086015193506040860151925060608601519150610626608087016105c8565b90509295509295909350565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b600181815b808511156106b857817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561069e5761069e610632565b808516156106ab57918102915b93841c9390800290610664565b509250929050565b5f826106ce57506001610779565b816106da57505f610779565b81600181146106f057600281146106fa57610716565b6001915050610779565b60ff84111561070b5761070b610632565b50506001821b610779565b5060208310610133831016604e8410600b8410161715610739575081810a610779565b610743838361065f565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561077557610775610632565b0290505b92915050565b5f61078d60ff8416836106c0565b9392505050565b5f602082840312156107a4575f80fd5b5051919050565b8082025f82127f8000000000000000000000000000000000000000000000000000000000000000841416156107e2576107e2610632565b818105831482151761077957610779610632565b5f82610829577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83147f80000000000000000000000000000000000000000000000000000000000000008314161561087d5761087d610632565b50059056fea264697066735822122092c144e2fac752336820d9440d6fb9736705564c1815afd67e7fb89e553e0f6764736f6c63430008140033000000000000000000000000ef484de8c07b6e2d732a92b5f78e81b38f99f95e000000000000000000000000fdc4a4abcd45518cfbc3f8d43a48f5513ffab8910000000000000000000000005cb542eb054f81b8fa1760c077f44aa80271c75d
Deployed Bytecode
0x608060405234801561000f575f80fd5b506004361061007a575f3560e01c80637284e416116100585780637284e416146100f45780638c94cfd014610109578063faba60dd14610130578063feaf968c14610157575f80fd5b8063218751b21461007e578063313ce567146100cf57806350d25bcd146100de575b5f80fd5b6100a57f000000000000000000000000ef484de8c07b6e2d732a92b5f78e81b38f99f95e81565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b604051601281526020016100c6565b6100e6610196565b6040519081526020016100c6565b6100fc6101ab565b6040516100c6919061050e565b6100a57f0000000000000000000000005cb542eb054f81b8fa1760c077f44aa80271c75d81565b6100a57f000000000000000000000000fdc4a4abcd45518cfbc3f8d43a48f5513ffab89181565b61015f610236565b6040805169ffffffffffffffffffff968716815260208101959095528401929092526060830152909116608082015260a0016100c6565b5f806101a0610236565b509195945050505050565b5f80546101b790610577565b80601f01602080910402602001604051908101604052809291908181526020018280546101e390610577565b801561022e5780601f106102055761010080835404028352916020019161022e565b820191905f5260205f20905b81548152906001019060200180831161021157829003601f168201915b505050505081565b5f805f805f805f805f807f000000000000000000000000fdc4a4abcd45518cfbc3f8d43a48f5513ffab89173ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa1580156102a9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102cd91906105e6565b945094509450945094505f805f805f7f0000000000000000000000005cb542eb054f81b8fa1760c077f44aa80271c75d73ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610345573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061036991906105e6565b945094509450945094505f848a1215610430576103886012600a61077f565b7f000000000000000000000000ef484de8c07b6e2d732a92b5f78e81b38f99f95e73ffffffffffffffffffffffffffffffffffffffff1663bb7b8b806040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103f1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104159190610794565b61041f908c6107ab565b61042991906107f6565b90506104e0565b61043c6012600a61077f565b7f000000000000000000000000ef484de8c07b6e2d732a92b5f78e81b38f99f95e73ffffffffffffffffffffffffffffffffffffffff1663bb7b8b806040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104a5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104c99190610794565b6104d390876107ab565b6104dd91906107f6565b90505b878310156104f557859a508398508297508196505b999f999e50969c50949a50929850959650505050505050565b5f6020808352835180828501525f5b818110156105395785810183015185820160400152820161051d565b505f6040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b600181811c9082168061058b57607f821691505b6020821081036105c2577f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b50919050565b805169ffffffffffffffffffff811681146105e1575f80fd5b919050565b5f805f805f60a086880312156105fa575f80fd5b610603866105c8565b9450602086015193506040860151925060608601519150610626608087016105c8565b90509295509295909350565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b600181815b808511156106b857817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561069e5761069e610632565b808516156106ab57918102915b93841c9390800290610664565b509250929050565b5f826106ce57506001610779565b816106da57505f610779565b81600181146106f057600281146106fa57610716565b6001915050610779565b60ff84111561070b5761070b610632565b50506001821b610779565b5060208310610133831016604e8410600b8410161715610739575081810a610779565b610743838361065f565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561077557610775610632565b0290505b92915050565b5f61078d60ff8416836106c0565b9392505050565b5f602082840312156107a4575f80fd5b5051919050565b8082025f82127f8000000000000000000000000000000000000000000000000000000000000000841416156107e2576107e2610632565b818105831482151761077957610779610632565b5f82610829577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83147f80000000000000000000000000000000000000000000000000000000000000008314161561087d5761087d610632565b50059056fea264697066735822122092c144e2fac752336820d9440d6fb9736705564c1815afd67e7fb89e553e0f6764736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000ef484de8c07b6e2d732a92b5f78e81b38f99f95e000000000000000000000000fdc4a4abcd45518cfbc3f8d43a48f5513ffab8910000000000000000000000005cb542eb054f81b8fa1760c077f44aa80271c75d
-----Decoded View---------------
Arg [0] : _curvePool (address): 0xef484de8C07B6e2d732A92B5F78e81B38f99f95E
Arg [1] : _coin1Feed (address): 0xFDc4a4ABcd45518CfBc3F8d43a48f5513FFAb891
Arg [2] : _coin2Feed (address): 0x5CB542EB054f81b8Fa1760c077f44AA80271c75D
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000ef484de8c07b6e2d732a92b5f78e81b38f99f95e
Arg [1] : 000000000000000000000000fdc4a4abcd45518cfbc3f8d43a48f5513ffab891
Arg [2] : 0000000000000000000000005cb542eb054f81b8fa1760c077f44aa80271c75d
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
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.