Forkchoice Ethereum Mainnet

Address Contract Partially Verified

Address 0x30992BfF5bD4d2BA21C98198a0FD0c07a7F9DFC9
Balance 0 ETH
Nonce 1
Code Size 4298 bytes
Indexed Transactions 0 (1 on-chain, 0.7% indexed)
External Etherscan · Sourcify

Contract Bytecode

4298 bytes
0x5f3560e01c60026027820660011b610fdc01601e395f51565b6338d52e0f81186100365734610fd857602061102a60403960206040f35b63dd62ed3e8118610c0757604436103417610fd8576004358060a01c610fd8576040526024358060a01c610fd8576060525f6040516020525f5260405f20806060516020525f5260405f2090505460805260206080f3610c07565b635051fae08118610c075734610fd857602061104a60403960206040f3610c07565b63ec55688981186100d15734610fd857602061106a60403960206040f35b6370a082318118610c0757602436103417610fd8576004358060a01c610fd857604052602060206110aa5f395f5163b83769966060523060805260405160a052602060606044607c845afa610128573d5f5f3e3d5ffd5b60203d10610fd85760609050f3610c07565b632638c09e81186101585734610fd857602061108a60403960206040f35b63b3d7f6b98118610c0757602436103417610fd85760043560405260206040f3610c07565b639ec5a8948118610c075734610fd85760206110aa60403960206040f3610c07565b6306fdde038118610c075734610fd857602061102a5f395f516306fdde0360e05260c060e0600460fc845afa6101d7573d5f5f3e3d5ffd5b60403d10610fd85760e05160e001607c815111610fd8576020815101806101c0828460045afa5050506101c090506020815101806040828460045afa5050506020806101c0525f600460e0527f31555020000000000000000000000000000000000000000000000000000000006101005260e08051602082018361014001815181525050808301925050506040518161014001818183606060045afa505080820191505080610120526101209050816101c00160208251018082828560045afa50508051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506101c0f3610c07565b6395d89b418118610c075734610fd857602061102a5f395f516395d89b4160a052608060a0600460bc845afa610301573d5f5f3e3d5ffd5b60403d10610fd85760a05160a001603d815111610fd857602081510180610140828460045afa50505061014090506020815101806040828460045afa505050602080610140525f600360a0527f75702d000000000000000000000000000000000000000000000000000000000060c05260a08051602082018361010001815181525050808301925050506040518161010001818183606060045afa50508082019150508060e05260e09050816101400160208251018082828560045afa50508051806020830101601f825f03163682375050601f19601f825160200101169050905081019050610140f3610c07565b63313ce56781186104465734610fd8576020602061102a5f395f5163313ce567604052602060406004605c845afa61042a573d5f5f3e3d5ffd5b60203d10610fd8576040518060081c610fd85760805260809050f35b634cdad5068118610c0757602436103417610fd85760043560405260206040f3610c07565b6318160ddd8118610c075734610fd857602060206110aa5f395f516381d7e86760405230606052602060406024605c845afa6104a9573d5f5f3e3d5ffd5b60203d10610fd85760409050f3610c07565b63a9059cbb8118610c0757604436103417610fd8576004358060a01c610fd857604052604051156104f1573060405114156104f3565b5f5b15610fd8576024351561054e5760206110aa5f395f5163e2944fd5606052602061104a6080393360a05260405160c05260243560e0525f61010052803b15610fd8575f606060a4607c5f855af161054c573d5f5f3e3d5ffd5b505b604051337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60243560605260206060a3600160605260206060f3610c07565b6323b872dd8118610c0757606436103417610fd8576004358060a01c610fd8576040526024358060a01c610fd857606052606051156105d1573060605114156105d3565b5f5b15610fd857604435156106a9575f6040516020525f5260405f2080336020525f5260405f209050546080527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6080511461065757608051604435808203828111610fd857905090505f6040516020525f5260405f2080336020525f5260405f209050555b60206110aa5f395f5163e2944fd560a052602061104a60c03960405160e05260605161010052604435610120525f61014052803b15610fd8575f60a060a460bc5f855af16106a7573d5f5f3e3d5ffd5b505b6060516040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60443560805260206080a3600160805260206080f3610c07565b63095ea7b38118610c0757604436103417610fd8576004358060a01c610fd85760405260405115610fd8576024355f336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f3610c07565b6301e1d11481186107be5734610fd857602060206110aa5f395f516381d7e86760405230606052602060406024605c845afa6107b0573d5f5f3e3d5ffd5b60203d10610fd85760409050f35b63402d267d8118610c0757602436103417610fd8576004358060a01c610fd8576040527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60605260206060f3610c07565b63c6e6f592811861083057602436103417610fd85760043560405260206040f35b63ce96cb778118610c0757602436103417610fd8576004358060a01c610fd857604052602060206110aa5f395f5163b83769966060523060805260405160a052602060606044607c845afa610887573d5f5f3e3d5ffd5b60203d10610fd85760609050f3610c07565b6307a2d13a8118610c0757602436103417610fd85760043560405260206040f3610c07565b63ef8b30f78118610c0757602436103417610fd85760043560405260206040f3610c07565b63b6b55f258118610c0757602436103417610fd857336101a05261092b56610c07565b636e553f658118610c0757604436103417610fd8576024358060a01c610fd8576101a0525b6004356080526101a05160a052610940610c81565b6004356101c05260206101c0f3610c07565b63c63d75b6811861099f57602436103417610fd8576004358060a01c610fd8576040527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60605260206060f35b637bde82f28118610c0757604436103417610fd8576024358060a01c610fd8576101c052336101e052610bdd56610c07565b63a0712d6881186109f057602436103417610fd857336101a052610a77565b63b460af948118610c0757606436103417610fd8576024358060a01c610fd8576101c0526044358060a01c610fd8576101e0525b6004356080526101c05160a0526101e05160c052610a40610e0e565b600435610200526020610200f3610c07565b6394bf804d8118610a9a57604436103417610fd8576024358060a01c610fd8576101a0525b6004356080526101a05160a052610a8c610c81565b6004356101c05260206101c0f35b632e1a7d4d8118610c0757602436103417610fd857336101c052336101e052610a2456610c07565b630a28a4778118610c0757602436103417610fd85760043560405260206040f3610c07565b62f714ce8118610c0757604436103417610fd8576024358060a01c610fd8576101c052336101e052610a2456610c07565b63d905777e8118610c0757602436103417610fd8576004358060a01c610fd857604052602060206110aa5f395f5163b83769966060523060805260405160a052602060606044607c845afa610b6f573d5f5f3e3d5ffd5b60203d10610fd85760609050f3610c07565b63db006a758118610c0757602436103417610fd857336101c052336101e052610bdd56610c07565b63ba0876528118610c0757606436103417610fd8576024358060a01c610fd8576101c0526044358060a01c610fd8576101e0525b6004356080526101c05160a0526101e05160c052610bf9610e0e565b600435610200526020610200f35b5f5ffd5b602061104a5f395f5163c00007b0604052602061106a606039803b15610fd8575f60406024605c5f855af1610c42573d5f5f3e3d5ffd5b50602061108a5f395f516370a0823160405230606052602060406024605c845afa610c6f573d5f5f3e3d5ffd5b60203d10610fd8576040905051815250565b60805115610fd857610c9360e0610c0b565b60e05160c05260206110aa5f395f5163e2944fd560e052602061104a610100395f6101205260a051610140526080516101605260c05161018052803b15610fd8575f60e060a460fc5f855af1610ceb573d5f5f3e3d5ffd5b50602061102a5f395f516323b872dd60e0523361010052306101205260805161014052602060e0606460fc5f855af1610d26573d5f5f3e3d5ffd5b3d610d3d57803b15610fd857600161016052610d55565b60203d10610fd85760e0518060011c610fd857610160525b61016090505115610fd857602061104a5f395f51636e553f6560e05260805161010052602061106a61012039602060e0604460fc5f855af1610d99573d5f5f3e3d5ffd5b60203d10610fd85760e0505060a051337fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d760805160e05260805161010052604060e0a360a0515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60805160e052602060e0a3565b60805115610fd85760a05115610e29573060a0511415610e2b565b5f5b15610fd8573360c05114610eb0575f60c0516020525f5260405f2080336020525f5260405f2090505460e0527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60e05114610eb05760e051608051808203828111610fd857905090505f60c0516020525f5260405f2080336020525f5260405f209050555b610ebb610100610c0b565b6101005160e05260206110aa5f395f5163e2944fd561010052602061104a6101203960c051610140525f610160526080516101805260e0516101a052803b15610fd8575f61010060a461011c5f855af1610f17573d5f5f3e3d5ffd5b50602061104a5f395f5163b460af94610100526080516101205260a05161014052602061106a610160396020610100606461011c5f855af1610f5b573d5f5f3e3d5ffd5b60203d10610fd857610100505060c05160a051337ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db60805161010052608051610120526040610100a45f60c0517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef608051610100526020610100a3565b5f80fd0c07089900910c0700b30c07001804bb0c070ac2019f0c07013a0a52058d080f0b81017d08e30c0709d102c908be06ea0c07046b0c0703f00ba9077209520c0709060c070c070ae70c070c070b180000000000000000000000006e9455d109202b426169f0d8f01a3332dae160f3000000000000000000000000107717c98c8125a94d3d2cc82b86a1b705f3a27c000000000000000000000000242521ca01f330f050a65ff5b8ebbe92198ae64f00000000000000000000000041252e8691e964f7de35156b68493bab6797a27500000000000000000000000035440c602bc4f01bbec6cb616ccb901c9df5475f

Verified Source Code Partial Match

Compiler: v0.3.10+commit.91361694
Gauge.vy 376 lines
# @version 0.3.10
"""
@title Gauge
@author 1up
@license GNU AGPLv3
@notice
    Vault with 1:1 of underlying Yearn gauge token.
    Does not store balances directly, instead they are reported
    to the reward contract.
    The underlying Yearn gauge tokens are held by the proxy.
"""

from vyper.interfaces import ERC20
from vyper.interfaces import ERC4626
implements: ERC20
implements: ERC4626

interface ERC20Detailed:
    def name() -> String[124]: view
    def symbol() -> String[61]: view
    def decimals() -> uint8: view

interface YearnGauge:
    def getReward(_account: address): nonpayable

interface Rewards:
    def report(_ygauge: address, _from: address, _to: address, _amount: uint256, _rewards: uint256): nonpayable
    def gauge_supply(_gauge: address) -> uint256: view
    def gauge_balance(_gauge: address, _account: address) -> uint256: view

asset: public(immutable(address))
ygauge: public(immutable(address))
proxy: public(immutable(address))
reward_token: public(immutable(ERC20))
rewards: public(immutable(Rewards))
allowance: public(HashMap[address, HashMap[address, uint256]])

event Transfer:
    sender: indexed(address)
    receiver: indexed(address)
    value: uint256

event Approval:
    owner: indexed(address)
    spender: indexed(address)
    value: uint256

event Deposit:
    sender: indexed(address)
    owner: indexed(address)
    assets: uint256
    shares: uint256

event Withdraw:
    sender: indexed(address)
    receiver: indexed(address)
    owner: indexed(address)
    assets: uint256
    shares: uint256

@external
def __init__(_ygauge: address, _proxy: address, _reward_token: address, _rewards: address):
    """
    @notice Constructor
    @param _ygauge Yearn gauge address
    @param _proxy Proxy
    @param _reward_token Reward token address
    @param _rewards Rewards contract
    """
    asset = ERC4626(_ygauge).asset()
    ygauge = _ygauge
    proxy = _proxy
    reward_token = ERC20(_reward_token)
    rewards = Rewards(_rewards)
    assert reward_token.approve(_rewards, max_value(uint256), default_return_value=True)
    assert ERC20(asset).approve(_ygauge, max_value(uint256), default_return_value=True)
    log Transfer(empty(address), msg.sender, 0)

@external
@view
def name() -> String[128]:
    """
    @notice Get the gauge name
    @return Gauge name
    @dev Based on the name of the asset inside the Yearn gauge
    """
    name: String[124] = ERC20Detailed(asset).name()
    return concat("1UP ", name)

@external
@view
def symbol() -> String[64]:
    """
    @notice Get the gauge symbol
    @return Gauge symbol
    @dev Based on the name of the asset inside the Yearn gauge
    """
    symbol: String[61] = ERC20Detailed(asset).symbol()
    return concat("up-", symbol)

@external
@view
def decimals() -> uint8:
    """
    @notice Get the gauge decimals
    @return Gauge decimals
    @dev Same as the decimals of the asset inside the Yearn gauge
    """
    return ERC20Detailed(asset).decimals()

@external
@view
def totalSupply() -> uint256:
    """
    @notice Get the gauge total supply
    @return Gauge total supply
    """
    return rewards.gauge_supply(self)

@external
@view
def balanceOf(_account: address) -> uint256:
    """
    @notice Get the gauge balance of a user
    @param _account User
    @return Gauge balance
    """
    return rewards.gauge_balance(self, _account)

@external
def transfer(_to: address, _value: uint256) -> bool:
    """
    @notice Transfer gauge tokens to another user
    @param _to User to transfer gauge tokens to
    @param _value Amount of gauge tokens to transfer
    @return Always True
    """
    assert _to != empty(address) and _to != self

    if _value > 0:
        rewards.report(ygauge, msg.sender, _to, _value, 0)

    log Transfer(msg.sender, _to, _value)
    return True

@external
def transferFrom(_from: address, _to: address, _value: uint256) -> bool:
    """
    @notice Transfer another user's gauge tokens by spending an allowance
    @param _from User to transfer gauge tokens from
    @param _to User to transfer gauge tokens to
    @param _value Amount of gauge tokens to transfer
    @return Always True
    """
    assert _to != empty(address) and _to != self

    if _value > 0:
        allowance: uint256 = self.allowance[_from][msg.sender]
        if allowance < max_value(uint256):
            self.allowance[_from][msg.sender] = allowance - _value

        rewards.report(ygauge, _from, _to, _value, 0)

    log Transfer(_from, _to, _value)
    return True

@external
def approve(_spender: address, _value: uint256) -> bool:
    """
    @notice Approve spending of the caller's gauge tokens
    @param _spender User that is allowed to spend caller's tokens
    @param _value Amount of tokens spender is allowed to spend
    @return Always True
    """
    assert _spender != empty(address)

    self.allowance[msg.sender][_spender] = _value
    log Approval(msg.sender, _spender, _value)
    return True

@view
@external
def totalAssets() -> uint256:
    """
    @notice Get the total amount of assets in the vault
    @return Total amount of assets
    """
    return rewards.gauge_supply(self)

@view
@external
def convertToShares(_assets: uint256) -> uint256:
    """
    @notice Convert an amount of assets to shares
    @param _assets Amount of assets
    @return Amount of shares
    """
    return _assets

@view
@external
def convertToAssets(_shares: uint256) -> uint256:
    """
    @notice Convert an amount of shares to assets
    @param _shares Amount of shares
    @return Amount of assets
    """
    return _shares

@view
@external
def maxDeposit(_owner: address) -> uint256:
    """
    @notice Get the maximum amount of assets a user can deposit
    @param _owner User depositing
    @return Maximum amount of assets that can be deposited
    """
    return max_value(uint256)

@view
@external
def previewDeposit(_assets: uint256) -> uint256:
    """
    @notice Preview a deposit
    @param _assets Amount of assets to be deposited
    @return Equivalent amount of shares to be minted
    """
    return _assets

@external
def deposit(_assets: uint256, _receiver: address = msg.sender) -> uint256:
    """
    @notice Deposit assets
    @param _assets Amount of assets to deposit
    @param _receiver Recipient of the shares
    @return Amount of shares minted
    """
    self._deposit(_assets, _receiver)
    return _assets

@view
@external
def maxMint(_owner: address) -> uint256:
    """
    @notice Get the maximum amount of shares a user can mint
    @param _owner User minting
    @return Maximum amount of shares that can be minted
    """
    return max_value(uint256)

@view
@external
def previewMint(_shares: uint256) -> uint256:
    """
    @notice Preview a mint
    @param _shares Amount of shares to be minted
    @return Equivalent amount of assets to be deposited
    """
    return _shares

@external
def mint(_shares: uint256, _receiver: address = msg.sender) -> uint256:
    """
    @notice Mint shares
    @param _shares Amount of shares to mint
    @param _receiver Recipient of the shares
    @return Amount of assets deposited
    """
    self._deposit(_shares, _receiver)
    return _shares

@view
@external
def maxWithdraw(_owner: address) -> uint256:
    """
    @notice Get the maximum amount of assets a user can withdraw
    @param _owner User withdrawing
    @return Maximum amount of assets that can be withdrawn
    """
    return rewards.gauge_balance(self, _owner)

@view
@external
def previewWithdraw(_assets: uint256) -> uint256:
    """
    @notice Preview a withdrawal
    @param _assets Amount of assets to be withdrawn
    @return Equivalent amount of shares to be burned
    """
    return _assets

@external
def withdraw(_assets: uint256, _receiver: address = msg.sender, _owner: address = msg.sender) -> uint256:
    """
    @notice Withdraw assets
    @param _assets Amount of assets to withdraw
    @param _receiver Recipient of the assets
    @param _owner Owner of the shares
    @return Amount of shares redeemed
    """
    self._withdraw(_assets, _receiver, _owner)
    return _assets

@view
@external
def maxRedeem(_owner: address) -> uint256:
    """
    @notice Get the maximum amount of shares a user can redeem
    @param _owner User redeeming
    @return Maximum amount of shares that can be redeemed
    """
    return rewards.gauge_balance(self, _owner)

@view
@external
def previewRedeem(_shares: uint256) -> uint256:
    """
    @notice Preview a redemption
    @param _shares Amount of shares to be redeemed
    @return Equivalent amount of assets to be withdrawn
    """
    return _shares

@external
def redeem(_shares: uint256, _receiver: address = msg.sender, _owner: address = msg.sender) -> uint256:
    """
    @notice Redeem shares
    @param _shares Amount of shares to redeem
    @param _receiver Recipient of the assets
    @param _owner Owner of the shares
    @return Amount of assets withdrawn
    """
    self._withdraw(_shares, _receiver, _owner)
    return _shares

@internal
def _deposit(_assets: uint256, _receiver: address):
    """
    @notice
        Handle a deposit by claiming rewards, reporting to the rewards contract
        and transferring tokens from the caller to the proxy
    """
    assert _assets > 0
    pending: uint256 = self._pending()
    rewards.report(ygauge, empty(address), _receiver, _assets, pending)
    assert ERC20(asset).transferFrom(msg.sender, self, _assets, default_return_value=True)
    ERC4626(ygauge).deposit(_assets, proxy)
    log Deposit(msg.sender, _receiver, _assets, _assets)
    log Transfer(empty(address), _receiver, _assets)

@internal
def _withdraw(_assets: uint256, _receiver: address, _owner: address):
    """
    @notice
        Handle a withdrawal by claiming rewards, reporting to the rewards contract
        and transferring tokens from the proxy to the receiver
    """
    assert _assets > 0
    assert _receiver != empty(address) and _receiver != self
    if _owner != msg.sender:
        allowance: uint256 = self.allowance[_owner][msg.sender]
        if allowance < max_value(uint256):
            self.allowance[_owner][msg.sender] = allowance - _assets
    pending: uint256 = self._pending()
    rewards.report(ygauge, _owner, empty(address), _assets, pending)
    ERC4626(ygauge).withdraw(_assets, _receiver, proxy)
    log Withdraw(msg.sender, _receiver, _owner, _assets, _assets)
    log Transfer(_owner, empty(address), _assets)

@internal
def _pending() -> uint256:
    """
    @notice Claim rewards from the Yearn gauge and return reward balance
    """
    YearnGauge(ygauge).getReward(proxy)
    return reward_token.balanceOf(self)

Read Contract

allowance 0xdd62ed3e → uint256
asset 0x38d52e0f → address
balanceOf 0x70a08231 → uint256
convertToAssets 0x07a2d13a → uint256
convertToShares 0xc6e6f592 → uint256
decimals 0x313ce567 → uint8
maxDeposit 0x402d267d → uint256
maxMint 0xc63d75b6 → uint256
maxRedeem 0xd905777e → uint256
maxWithdraw 0xce96cb77 → uint256
name 0x06fdde03 → string
previewDeposit 0xef8b30f7 → uint256
previewMint 0xb3d7f6b9 → uint256
previewRedeem 0x4cdad506 → uint256
previewWithdraw 0x0a28a477 → uint256
proxy 0xec556889 → address
reward_token 0x2638c09e → address
rewards 0x9ec5a894 → address
symbol 0x95d89b41 → string
totalAssets 0x01e1d114 → uint256
totalSupply 0x18160ddd → uint256
ygauge 0x5051fae0 → address

Write Contract 13 functions

These functions modify contract state and require a wallet transaction to execute.

approve 0x095ea7b3
address _spender
uint256 _value
returns: bool
deposit 0xb6b55f25
uint256 _assets
returns: uint256
deposit 0x6e553f65
uint256 _assets
address _receiver
returns: uint256
mint 0xa0712d68
uint256 _shares
returns: uint256
mint 0x94bf804d
uint256 _shares
address _receiver
returns: uint256
redeem 0xdb006a75
uint256 _shares
returns: uint256
redeem 0x7bde82f2
uint256 _shares
address _receiver
returns: uint256
redeem 0xba087652
uint256 _shares
address _receiver
address _owner
returns: uint256
transfer 0xa9059cbb
address _to
uint256 _value
returns: bool
transferFrom 0x23b872dd
address _from
address _to
uint256 _value
returns: bool
withdraw 0x2e1a7d4d
uint256 _assets
returns: uint256
withdraw 0x00f714ce
uint256 _assets
address _receiver
returns: uint256
withdraw 0xb460af94
uint256 _assets
address _receiver
address _owner
returns: uint256

Recent Transactions

This address has 1 on-chain transactions, but only 0.7% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →