ETH Price: $2,712.65 (+0.11%)

Contract

0xEbA9A8fdd2539d33e070c66Afc1127478bA78054
 

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

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Token Minter

Compiler Version
vyper:0.3.1

Optimization Enabled:
N/A

Other Settings:
default evmVersion, MIT license

Contract Source Code (Vyper language format)

# @version 0.3.1
"""
@title Token Minter
@author Curve Finance
@license MIT
"""

# Original idea and credit:
# Curve Finance's Token Minter
# https://resources.curve.fi/base-features/understanding-gauges
# https://github.com/curvefi/curve-dao-contracts/blob/master/contracts/Minter.vy
# This contract is an almost-identical fork of Curve's contract

interface LiquidityGauge:
    # Presumably, other gauges will provide the same interfaces
    def integrate_fraction(addr: address) -> uint256: view
    def user_checkpoint(addr: address) -> bool: nonpayable

interface MERC20:
    def mint(_to: address, _value: uint256) -> bool: nonpayable

interface GaugeController:
    def gauge_types(addr: address) -> int128: view


event Minted:
    recipient: indexed(address)
    gauge: address
    minted: uint256


token: public(address)
controller: public(address)

# user -> gauge -> value
minted: public(HashMap[address, HashMap[address, uint256]])

# minter -> user -> can mint?
allowed_to_mint_for: public(HashMap[address, HashMap[address, bool]])


@external
def initialize(_token: address, _controller: address):
    assert self.token == ZERO_ADDRESS, "already initialized"

    self.token = _token
    self.controller = _controller


@internal
def _mint_for(gauge_addr: address, _for: address):
    assert GaugeController(self.controller).gauge_types(gauge_addr) >= 0  # dev: gauge is not added

    LiquidityGauge(gauge_addr).user_checkpoint(_for)
    total_mint: uint256 = LiquidityGauge(gauge_addr).integrate_fraction(_for)
    to_mint: uint256 = total_mint - self.minted[_for][gauge_addr]

    if to_mint != 0:
        MERC20(self.token).mint(_for, to_mint)
        self.minted[_for][gauge_addr] = total_mint

        log Minted(_for, gauge_addr, total_mint)


@external
@nonreentrant('lock')
def mint(gauge_addr: address):
    """
    @notice Mint everything which belongs to `msg.sender` and send to them
    @param gauge_addr `LiquidityGauge` address to get mintable amount from
    """
    self._mint_for(gauge_addr, msg.sender)


@external
@nonreentrant('lock')
def mint_many(gauge_addrs: address[8]):
    """
    @notice Mint everything which belongs to `msg.sender` across multiple gauges
    @param gauge_addrs List of `LiquidityGauge` addresses
    """
    for i in range(8):
        if gauge_addrs[i] == ZERO_ADDRESS:
            break
        self._mint_for(gauge_addrs[i], msg.sender)


@external
@nonreentrant('lock')
def mint_for(gauge_addr: address, _for: address):
    """
    @notice Mint tokens for `_for`
    @dev Only possible when `msg.sender` has been approved via `toggle_approve_mint`
    @param gauge_addr `LiquidityGauge` address to get mintable amount from
    @param _for Address to mint to
    """
    if self.allowed_to_mint_for[msg.sender][_for]:
        self._mint_for(gauge_addr, _for)


@external
def toggle_approve_mint(minting_user: address):
    """
    @notice allow `minting_user` to mint for `msg.sender`
    @param minting_user Address to toggle permission for
    """
    self.allowed_to_mint_for[minting_user][msg.sender] = not self.allowed_to_mint_for[minting_user][msg.sender]

Contract Security Audit

Contract ABI

[{"name":"Minted","inputs":[{"name":"recipient","type":"address","indexed":true},{"name":"gauge","type":"address","indexed":false},{"name":"minted","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"stateMutability":"nonpayable","type":"function","name":"initialize","inputs":[{"name":"_token","type":"address"},{"name":"_controller","type":"address"}],"outputs":[],"gas":76092},{"stateMutability":"nonpayable","type":"function","name":"mint","inputs":[{"name":"gauge_addr","type":"address"}],"outputs":[],"gas":112502},{"stateMutability":"nonpayable","type":"function","name":"mint_many","inputs":[{"name":"gauge_addrs","type":"address[8]"}],"outputs":[],"gas":499362},{"stateMutability":"nonpayable","type":"function","name":"mint_for","inputs":[{"name":"gauge_addr","type":"address"},{"name":"_for","type":"address"}],"outputs":[],"gas":115095},{"stateMutability":"nonpayable","type":"function","name":"toggle_approve_mint","inputs":[{"name":"minting_user","type":"address"}],"outputs":[],"gas":38081},{"stateMutability":"view","type":"function","name":"token","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":2610},{"stateMutability":"view","type":"function","name":"controller","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":2640},{"stateMutability":"view","type":"function","name":"minted","inputs":[{"name":"arg0","type":"address"},{"name":"arg1","type":"address"}],"outputs":[{"name":"","type":"uint256"}],"gas":3202},{"stateMutability":"view","type":"function","name":"allowed_to_mint_for","inputs":[{"name":"arg0","type":"address"},{"name":"arg1","type":"address"}],"outputs":[{"name":"","type":"bool"}],"gas":3232}]

61056156600436101561000d576103aa565b60046000601c37600051346105585763485cc95581186100d0576004358060a01c6105585760e0526024358060a01c6105585761010052600154156100c1576013610120527f616c726561647920696e697469616c697a6564000000000000000000000000006101405261012050610120518061014001818260206001820306601f82010390500336823750506308c379a060e0526020610100526101205160206001820306601f820103905060440160fcfd5b60e05160015561010051600255005b636a6278428118610111576004358060a01c610558576101c0526000546105585760016000556101c05160e052336101005261010a6103b0565b6000600055005b63a51e19048118610208576004358060a01c610558576101c0526024358060a01c610558576101e0526044358060a01c61055857610200526064358060a01c61055857610220526084358060a01c610558576102405260a4358060a01c610558576102605260c4358060a01c610558576102805260e4358060a01c610558576102a0526000546105585760016000556102c060006008818352015b6101c06102c05160088110156105585760200201516101ca576101ff565b6101c06102c051600881101561055857602002015160e05233610100526101ef6103b0565b81516001018083528114156101ac575b50506000600055005b6327f18ae3811861027e576004358060a01c610558576101c0526024358060a01c610558576101e05260005461055857600160005560043360a05260805260406080206101e05160a05260805260406080205415610277576101c05160e0526101e051610100526102776103b0565b6000600055005b63dd289d6081186102d4576004358060a01c6105585760e052600460e05160a05260805260406080203360a05260805260406080205415600460e05160a05260805260406080203360a052608052604060802055005b63fc0c546a81186102eb5760015460e052602060e0f35b63f77c479181186103025760025460e052602060e0f35b638b752bb08118610355576004358060a01c6105585760e0526024358060a01c6105585761010052600360e05160a05260805260406080206101005160a052608052604060802054610120526020610120f35b63a099003381186103a8576004358060a01c6105585760e0526024358060a01c6105585761010052600460e05160a05260805260406080206101005160a052608052604060802054610120526020610120f35b505b60006000fd5b6000633f9095b76101205260e051610140526020610120602461013c6002545afa6103e0573d600060003e3d6000fd5b601f3d111561055857610120511261055857634b8200936101205261010051610140526020610120602461013c600060e0515af1610423573d600060003e3d6000fd5b601f3d1115610558576101205063094007076101405261010051610160526020610140602461015c60e0515afa61045f573d600060003e3d6000fd5b601f3d11156105585761014051610120526101205160036101005160a052608052604060802060e05160a05260805260406080205480821061055857808203905090506101405260006101405114610556576340c10f19610160526101005161018052610140516101a0526020610160604461017c60006001545af16104ea573d600060003e3d6000fd5b601f3d111561055857610160506101205160036101005160a052608052604060802060e05160a052608052604060802055610100517f9d228d69b5fdb8d273a2336f8fb8612d039631024ea9bf09c424a9503aa078f060e0516101605261012051610180526040610160a25b565b600080fd5b61000461056103610004600039610004610561036000f3

Deployed Bytecode

0x600436101561000d576103aa565b60046000601c37600051346105585763485cc95581186100d0576004358060a01c6105585760e0526024358060a01c6105585761010052600154156100c1576013610120527f616c726561647920696e697469616c697a6564000000000000000000000000006101405261012050610120518061014001818260206001820306601f82010390500336823750506308c379a060e0526020610100526101205160206001820306601f820103905060440160fcfd5b60e05160015561010051600255005b636a6278428118610111576004358060a01c610558576101c0526000546105585760016000556101c05160e052336101005261010a6103b0565b6000600055005b63a51e19048118610208576004358060a01c610558576101c0526024358060a01c610558576101e0526044358060a01c61055857610200526064358060a01c61055857610220526084358060a01c610558576102405260a4358060a01c610558576102605260c4358060a01c610558576102805260e4358060a01c610558576102a0526000546105585760016000556102c060006008818352015b6101c06102c05160088110156105585760200201516101ca576101ff565b6101c06102c051600881101561055857602002015160e05233610100526101ef6103b0565b81516001018083528114156101ac575b50506000600055005b6327f18ae3811861027e576004358060a01c610558576101c0526024358060a01c610558576101e05260005461055857600160005560043360a05260805260406080206101e05160a05260805260406080205415610277576101c05160e0526101e051610100526102776103b0565b6000600055005b63dd289d6081186102d4576004358060a01c6105585760e052600460e05160a05260805260406080203360a05260805260406080205415600460e05160a05260805260406080203360a052608052604060802055005b63fc0c546a81186102eb5760015460e052602060e0f35b63f77c479181186103025760025460e052602060e0f35b638b752bb08118610355576004358060a01c6105585760e0526024358060a01c6105585761010052600360e05160a05260805260406080206101005160a052608052604060802054610120526020610120f35b63a099003381186103a8576004358060a01c6105585760e0526024358060a01c6105585761010052600460e05160a05260805260406080206101005160a052608052604060802054610120526020610120f35b505b60006000fd5b6000633f9095b76101205260e051610140526020610120602461013c6002545afa6103e0573d600060003e3d6000fd5b601f3d111561055857610120511261055857634b8200936101205261010051610140526020610120602461013c600060e0515af1610423573d600060003e3d6000fd5b601f3d1115610558576101205063094007076101405261010051610160526020610140602461015c60e0515afa61045f573d600060003e3d6000fd5b601f3d11156105585761014051610120526101205160036101005160a052608052604060802060e05160a05260805260406080205480821061055857808203905090506101405260006101405114610556576340c10f19610160526101005161018052610140516101a0526020610160604461017c60006001545af16104ea573d600060003e3d6000fd5b601f3d111561055857610160506101205160036101005160a052608052604060802060e05160a052608052604060802055610100517f9d228d69b5fdb8d273a2336f8fb8612d039631024ea9bf09c424a9503aa078f060e0516101605261012051610180526040610160a25b565b600080fd

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

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.