Address Contract Partially Verified
Address
0xe741c804Ca2e26a0aa5511a6018119CD6991Aaa5
Balance
0 ETH
Nonce
1
Code Size
2232 bytes
Creator
0xcfaD496f...a781 at tx 0x732a21ab...ced606
Indexed Transactions
0 (1 on-chain, 1.2% indexed)
Contract Bytecode
2232 bytes
0x608060405234801561000f575f80fd5b506004361061007a575f3560e01c80637284e416116100585780637284e416146100f45780638c94cfd014610109578063faba60dd14610130578063feaf968c14610157575f80fd5b8063218751b21461007e578063313ce567146100cf57806350d25bcd146100de575b5f80fd5b6100a57f000000000000000000000000744793b5110f6ca9cc7cdfe1ce16677c3eb192ef81565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b604051601281526020016100c6565b6100e6610196565b6040519081526020016100c6565b6100fc6101ab565b6040516100c6919061050e565b6100a57f0000000000000000000000005cb542eb054f81b8fa1760c077f44aa80271c75d81565b6100a57f0000000000000000000000003326a10a83b77faae29aedbb8aaeb18e5872624d81565b61015f610236565b6040805169ffffffffffffffffffff968716815260208101959095528401929092526060830152909116608082015260a0016100c6565b5f806101a0610236565b509195945050505050565b5f80546101b790610577565b80601f01602080910402602001604051908101604052809291908181526020018280546101e390610577565b801561022e5780601f106102055761010080835404028352916020019161022e565b820191905f5260205f20905b81548152906001019060200180831161021157829003601f168201915b505050505081565b5f805f805f805f805f807f0000000000000000000000003326a10a83b77faae29aedbb8aaeb18e5872624d73ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa1580156102a9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102cd91906105e6565b945094509450945094505f805f805f7f0000000000000000000000005cb542eb054f81b8fa1760c077f44aa80271c75d73ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610345573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061036991906105e6565b945094509450945094505f848a1215610430576103886012600a61077f565b7f000000000000000000000000744793b5110f6ca9cc7cdfe1ce16677c3eb192ef73ffffffffffffffffffffffffffffffffffffffff1663bb7b8b806040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103f1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104159190610794565b61041f908c6107ab565b61042991906107f6565b90506104e0565b61043c6012600a61077f565b7f000000000000000000000000744793b5110f6ca9cc7cdfe1ce16677c3eb192ef73ffffffffffffffffffffffffffffffffffffffff1663bb7b8b806040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104a5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104c99190610794565b6104d390876107ab565b6104dd91906107f6565b90505b878310156104f557859a508398508297508196505b999f999e50969c50949a50929850959650505050505050565b5f6020808352835180828501525f5b818110156105395785810183015185820160400152820161051d565b505f6040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b600181811c9082168061058b57607f821691505b6020821081036105c2577f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b50919050565b805169ffffffffffffffffffff811681146105e1575f80fd5b919050565b5f805f805f60a086880312156105fa575f80fd5b610603866105c8565b9450602086015193506040860151925060608601519150610626608087016105c8565b90509295509295909350565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b600181815b808511156106b857817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561069e5761069e610632565b808516156106ab57918102915b93841c9390800290610664565b509250929050565b5f826106ce57506001610779565b816106da57505f610779565b81600181146106f057600281146106fa57610716565b6001915050610779565b60ff84111561070b5761070b610632565b50506001821b610779565b5060208310610133831016604e8410600b8410161715610739575081810a610779565b610743838361065f565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561077557610775610632565b0290505b92915050565b5f61078d60ff8416836106c0565b9392505050565b5f602082840312156107a4575f80fd5b5051919050565b8082025f82127f8000000000000000000000000000000000000000000000000000000000000000841416156107e2576107e2610632565b818105831482151761077957610779610632565b5f82610829577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83147f80000000000000000000000000000000000000000000000000000000000000008314161561087d5761087d610632565b50059056fea2646970667358221220cbb859fd6ce42ca211359011e5303341cb1e6963c58808a5a1b52bfda41be2aa64736f6c63430008140033
Verified Source Code Partial Match
Compiler: v0.8.20+commit.a1b79de6
EVM: shanghai
Optimization: Yes (10000 runs)
CurveLPPessimisticFeed.sol 108 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import {ICurvePool} from "src/interfaces/ICurvePool.sol";
import {IChainlinkBasePriceFeed} from "src/interfaces/IChainlinkFeed.sol";
import {IERC20} from "src/interfaces/IERC20.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,
bool _oldCurveImpl
) {
curvePool = ICurvePool(_curvePool);
coin1Feed = IChainlinkBasePriceFeed(_coin1Feed);
coin2Feed = IChainlinkBasePriceFeed(_coin2Feed);
require(
coin1Feed.decimals() == coin2Feed.decimals() &&
coin1Feed.decimals() == 18,
"CurveLPPessimisticFeed: DECIMALS_MISMATCH"
);
if (_oldCurveImpl)
description = string(
abi.encodePacked(
IERC20(curvePool.lp_token()).symbol(),
" / USD"
)
);
else
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;
}
}
ICurvePool.sol 63 lines
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);
function lp_token() external view returns (address);
}
IChainlinkFeed.sol 30 lines
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);
}
IERC20.sol 31 lines
pragma solidity ^0.8.13;
interface IERC20 {
function approve(address, uint) external;
function transfer(address, uint) external returns (bool);
function transferFrom(address, address, uint) external returns (bool);
function balanceOf(address) external view returns (uint);
function allowance(address from, address to) external view returns (uint);
function symbol() external view returns (string memory);
}
interface IMintable is IERC20 {
function mint(address, uint) external;
function burn(uint) external;
function addMinter(address minter) external;
}
interface IDelegateableERC20 is IERC20 {
function delegate(address delegatee) external;
function delegates(
address delegator
) external view returns (address delegatee);
}
Read Contract
coin1Feed 0xfaba60dd → address
coin2Feed 0x8c94cfd0 → address
curvePool 0x218751b2 → address
decimals 0x313ce567 → uint8
description 0x7284e416 → string
latestAnswer 0x50d25bcd → int256
latestRoundData 0xfeaf968c → uint80, int256, uint256, uint256, uint80
Recent Transactions
This address has 1 on-chain transactions, but only 1.2% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →