ETH Price: $2,348.80 (+0.91%)

Contract

0xAba04e7fe37fc3808d601DE4d65690E2889d7621
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x61060756165135122023-01-29 15:57:11591 days ago1675007831IN
 Create: Vyper_contract
0 ETH0.0078285420.33260402

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Vyper_contract

Compiler Version
vyper:0.2.16

Optimization Enabled:
N/A

Other Settings:
MIT license

Contract Source Code (Vyper language format)

# @version 0.2.16
# Curve.Fi, 2021
# Distributed under MIT license

interface Tricrypto:
    def virtual_price() -> uint256: view
    def price_oracle(k: uint256) -> uint256: view
    def A() -> uint256: view
    def gamma() -> uint256: view

interface Chainlink:
    def latestAnswer() -> int256: view

POOL: constant(address) = 0xD51a44d3FaE010294C616388b506AcdA1bfAAE46
BTC_FEED: constant(address) = 0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c
ETH_FEED: constant(address) = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419
GAMMA0: constant(uint256) = 28000000000000  # 2.8e-5
A0: constant(uint256) = 2 * 3**3 * 10000
DISCOUNT0: constant(uint256) = 1087460000000000  # 0.00108..


@pure
@internal
def cubic_root(x: uint256) -> uint256:
    # x is taken at base 1e36
    # result is at base 1e18
    # Will have convergence problems when ETH*BTC is cheaper than 0.01 squared dollar
    # (for example, when BTC < $0.1 and ETH < $0.1)
    D: uint256 = x / 10**18
    for i in range(255):
        diff: uint256 = 0
        D_prev: uint256 = D
        D = D * (2 * 10**18 + x / D * 10**18 / D * 10**18 / D) / (3 * 10**18)
        if D > D_prev:
            diff = D - D_prev
        else:
            diff = D_prev - D
        if diff <= 1 or diff * 10**18 < D:
            return D
    raise "Did not converge"


@external
@view
def lp_price() -> uint256:
    vp: uint256 = Tricrypto(POOL).virtual_price()
    p1: uint256 = convert(Chainlink(BTC_FEED).latestAnswer() * 10**10, uint256)
    p2: uint256 = convert(Chainlink(ETH_FEED).latestAnswer() * 10**10, uint256)

    max_price: uint256 = 3 * vp * self.cubic_root(p1 * p2) / 10**18

    # ((A/A0) * (gamma/gamma0)**2) ** (1/3)
    g: uint256 = Tricrypto(POOL).gamma() * 10**18 / GAMMA0
    a: uint256 = Tricrypto(POOL).A() * 10**18 / A0
    discount: uint256 = max(g**2 / 10**18 * a, 10**34)  # handle qbrt nonconvergence
    # if discount is small, we take an upper bound
    discount = self.cubic_root(discount) * DISCOUNT0 / 10**18

    max_price -= max_price * discount / 10**18

    return max_price

Contract Security Audit

Contract ABI

[{"stateMutability":"view","type":"function","name":"lp_price","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":1049766}]

61060756600436101561000d5761040b565b600035601c52600051346105fe576354f0f7d58114156104095760206101c06004630c46b72a6101605261017c73d51a44d3fae010294c616388b506acda1bfaae465afa156105fe57601f3d11156105fe576000506101c0516101405260206101e060046350d25bcd6101805261019c73f4030086522a5beea4988f8ca5b36dbc97bee88c5afa156105fe57601f3d11156105fe576000506101e0516402540be4008082028215828483051417156105fe5780905090509050600081126105fe5761016052602061020060046350d25bcd6101a0526101bc735f4ec3df9cbd43714fe2740f5e3616155c5b84195afa156105fe57601f3d11156105fe57600050610200516402540be4008082028215828483051417156105fe5780905090509050600081126105fe57610180526003610140518082028215828483041417156105fe57809050905090506101405161016051610180516101a05161016051610180518082028215828483041417156105fe57809050905090506101c0526101c05160065801610411565b610220526101a052610180526101605261014052610220518082028215828483041417156105fe5780905090509050670de0b6b3a7640000808204905090506101a0526020610240600463b13739296101e0526101fc73d51a44d3fae010294c616388b506acda1bfaae465afa156105fe57601f3d11156105fe5760005061024051670de0b6b3a76400008082028215828483041417156105fe5780905090509050651977420dc000808204905090506101c0526020610260600463f446c1d06102005261021c73d51a44d3fae010294c616388b506acda1bfaae465afa156105fe57601f3d11156105fe5760005061026051670de0b6b3a76400008082028215828483041417156105fe578090509050905062083d60808204905090506101e0527001000000000000000000000000000000006101c05110156105fe5760026101c0510a670de0b6b3a7640000808204905090506101e0518082028215828483041417156105fe57809050905090506e01ed09bead87c0378d8e6400000000808210156103255780610327565b815b90509050610200526101405161016051610180516101a0516101c0516101e0516102005161020051610220526102205160065801610411565b61028052610200526101e0526101c0526101a052610180526101605261014052610280516603dd0a0301e8008082028215828483041417156105fe5780905090509050670de0b6b3a764000080820490509050610200526101a080516101a051610200518082028215828483041417156105fe5780905090509050670de0b6b3a7640000808204905090508082106105fe57808203905090508152506101a05160005260206000f35b505b60006000fd5b610160526101405261014051670de0b6b3a764000080820490509050610180526101a0600060ff818352015b60006101c052610180516101e05261018051671bc16d674ec8000061014051610180518080156105fe57820490509050670de0b6b3a76400008082028215828483041417156105fe5780905090509050610180518080156105fe57820490509050670de0b6b3a76400008082028215828483041417156105fe5780905090509050610180518080156105fe5782049050905081818301106105fe57808201905090508082028215828483041417156105fe57809050905090506729a2241af62c000080820490509050610180526101e05161018051111561053757610180516101e0518082106105fe57808203905090506101c052610552565b6101e051610180518082106105fe57808203905090506101c0525b60016101c0511161056457600161058e565b610180516101c051670de0b6b3a76400008082028215828483041417156105fe5780905090509050105b5b156105a65761018051600052505060005161016051565b5b815160010180835281141561043d575b50506308c379a06101a05260206101c05260106101e0527f446964206e6f7420636f6e766572676500000000000000000000000000000000610200526101e05060646101bcfd5b600080fd5b61000461060703610004600039610004610607036000f3

Deployed Bytecode

0x600436101561000d5761040b565b600035601c52600051346105fe576354f0f7d58114156104095760206101c06004630c46b72a6101605261017c73d51a44d3fae010294c616388b506acda1bfaae465afa156105fe57601f3d11156105fe576000506101c0516101405260206101e060046350d25bcd6101805261019c73f4030086522a5beea4988f8ca5b36dbc97bee88c5afa156105fe57601f3d11156105fe576000506101e0516402540be4008082028215828483051417156105fe5780905090509050600081126105fe5761016052602061020060046350d25bcd6101a0526101bc735f4ec3df9cbd43714fe2740f5e3616155c5b84195afa156105fe57601f3d11156105fe57600050610200516402540be4008082028215828483051417156105fe5780905090509050600081126105fe57610180526003610140518082028215828483041417156105fe57809050905090506101405161016051610180516101a05161016051610180518082028215828483041417156105fe57809050905090506101c0526101c05160065801610411565b610220526101a052610180526101605261014052610220518082028215828483041417156105fe5780905090509050670de0b6b3a7640000808204905090506101a0526020610240600463b13739296101e0526101fc73d51a44d3fae010294c616388b506acda1bfaae465afa156105fe57601f3d11156105fe5760005061024051670de0b6b3a76400008082028215828483041417156105fe5780905090509050651977420dc000808204905090506101c0526020610260600463f446c1d06102005261021c73d51a44d3fae010294c616388b506acda1bfaae465afa156105fe57601f3d11156105fe5760005061026051670de0b6b3a76400008082028215828483041417156105fe578090509050905062083d60808204905090506101e0527001000000000000000000000000000000006101c05110156105fe5760026101c0510a670de0b6b3a7640000808204905090506101e0518082028215828483041417156105fe57809050905090506e01ed09bead87c0378d8e6400000000808210156103255780610327565b815b90509050610200526101405161016051610180516101a0516101c0516101e0516102005161020051610220526102205160065801610411565b61028052610200526101e0526101c0526101a052610180526101605261014052610280516603dd0a0301e8008082028215828483041417156105fe5780905090509050670de0b6b3a764000080820490509050610200526101a080516101a051610200518082028215828483041417156105fe5780905090509050670de0b6b3a7640000808204905090508082106105fe57808203905090508152506101a05160005260206000f35b505b60006000fd5b610160526101405261014051670de0b6b3a764000080820490509050610180526101a0600060ff818352015b60006101c052610180516101e05261018051671bc16d674ec8000061014051610180518080156105fe57820490509050670de0b6b3a76400008082028215828483041417156105fe5780905090509050610180518080156105fe57820490509050670de0b6b3a76400008082028215828483041417156105fe5780905090509050610180518080156105fe5782049050905081818301106105fe57808201905090508082028215828483041417156105fe57809050905090506729a2241af62c000080820490509050610180526101e05161018051111561053757610180516101e0518082106105fe57808203905090506101c052610552565b6101e051610180518082106105fe57808203905090506101c0525b60016101c0511161056457600161058e565b610180516101c051670de0b6b3a76400008082028215828483041417156105fe5780905090509050105b5b156105a65761018051600052505060005161016051565b5b815160010180835281141561043d575b50506308c379a06101a05260206101c05260106101e0527f446964206e6f7420636f6e766572676500000000000000000000000000000000610200526101e05060646101bcfd5b600080fd

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.