Contract 0x569D991B4D2313B0FeA3C8474E6Cb337300F951e

 
 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x10d8c5ba9f7eaf8ec6c6958f07151194e1267b05252426d6730f4113ee3d927dAdd_gauge328915092022-09-09 14:54:0788 days 12 hrs ago0x4210b1803f7cb057435ff1135f5dfdfbee086c27 IN  0x569d991b4d2313b0fea3c8474e6cb337300f951e0 MATIC0.007451150
0xe5162f39cae71adab8b8bbc00b2a6fe01a098356be85c044b42aabd0581bc8ddAdd_gauge328912432022-09-09 14:44:5988 days 12 hrs ago0x4210b1803f7cb057435ff1135f5dfdfbee086c27 IN  0x569d991b4d2313b0fea3c8474e6cb337300f951e0 MATIC0.010866750
0xd8e3e22c416566778f1a19381d86c4563abf492e92d66ce3d45188e6a12fa5acAdd_type328901122022-09-09 14:06:0588 days 13 hrs ago0x4210b1803f7cb057435ff1135f5dfdfbee086c27 IN  0x569d991b4d2313b0fea3c8474e6cb337300f951e0 MATIC0.0077826550
0x754e8d85551425869e5515d5f716b25cf3d6d07b893d8f695981ae620d64dfb10x60206122328901092022-09-09 14:05:5588 days 13 hrs ago0x4210b1803f7cb057435ff1135f5dfdfbee086c27 IN  Create: Vyper_contract0 MATIC0.09958150
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Vyper_contract

Compiler Version
vyper:0.3.4

Optimization Enabled:
N/A

Other Settings:
, MIT license

Contract Source Code (Vyper language format)

# @version 0.3.4

"""
@title Gauge Controller
@author DFX Finance
@license MIT
@notice Controls liquidity gauges and the issuance of coins through the gauges
"""

# Full fork from:
# Angle Protocol's gauge controller
# https://github.com/AngleProtocol/angle-core/blob/main/contracts/staking/GaugeController.vy
# Curve Finance's gauge controller
# https://github.com/curvefi/curve-dao-contracts/blob/master/contracts/GaugeController.vy

# 7 * 86400 seconds - all future times are rounded by week
WEEK: constant(uint256) = 604800

# Cannot change weight votes more often than once in 10 days
WEIGHT_VOTE_DELAY: constant(uint256) = 10 * 86400


struct Point:
    bias: uint256
    slope: uint256

struct VotedSlope:
    slope: uint256
    power: uint256
    end: uint256


interface VotingEscrow:
    def get_last_user_slope(addr: address) -> int128: view
    def locked__end(addr: address) -> uint256: view


event CommitOwnership:
    admin: address

event ApplyOwnership:
    admin: address

event AddType:
    name: String[64]
    type_id: int128

event NewTypeWeight:
    type_id: int128
    time: uint256
    weight: uint256
    total_weight: uint256

event NewGaugeWeight:
    gauge_address: address
    time: uint256
    weight: uint256
    total_weight: uint256

event VoteForGauge:
    time: uint256
    user: address
    gauge_addr: address
    weight: uint256

event NewGauge:
    addr: address
    gauge_type: int128
    weight: uint256

event KilledGauge:
    addr: address

MULTIPLIER: constant(uint256) = 10 ** 18

admin: public(address)  # Can and will be a smart contract
future_admin: public(address)  # Can and will be a smart contract

token: public(address)  # DFX token
voting_escrow: public(address)  # Voting escrow

# Gauge parameters
# All numbers are "fixed point" on the basis of 1e18
n_gauge_types: public(int128)
n_gauges: public(int128)
gauge_type_names: public(HashMap[int128, String[64]])

# Needed for enumeration
gauges: public(address[1000000000])

# we increment values by 1 prior to storing them here so we can rely on a value
# of zero as meaning the gauge has not been set
gauge_types_: HashMap[address, int128]

vote_user_slopes: public(HashMap[address, HashMap[address, VotedSlope]])  # user -> gauge_addr -> VotedSlope
vote_user_power: public(HashMap[address, uint256])  # Total vote power used by user
last_user_vote: public(HashMap[address, HashMap[address, uint256]])  # Last user vote's timestamp for each gauge address

# Past and scheduled points for gauge weight, sum of weights per type, total weight
# Point is for bias+slope
# changes_* are for changes in slope
# time_* are for the last change timestamp
# timestamps are rounded to whole weeks

points_weight: public(HashMap[address, HashMap[uint256, Point]])  # gauge_addr -> time -> Point
changes_weight: HashMap[address, HashMap[uint256, uint256]]  # gauge_addr -> time -> slope
time_weight: public(HashMap[address, uint256])  # gauge_addr -> last scheduled time (next week)

points_sum: public(HashMap[int128, HashMap[uint256, Point]])  # type_id -> time -> Point
changes_sum: HashMap[int128, HashMap[uint256, uint256]]  # type_id -> time -> slope
time_sum: public(uint256[1000000000])  # type_id -> last scheduled time (next week)

points_total: public(HashMap[uint256, uint256])  # time -> total weight
time_total: public(uint256)  # last scheduled time

points_type_weight: public(HashMap[int128, HashMap[uint256, uint256]])  # type_id -> time -> type weight
time_type_weight: public(uint256[1000000000])  # type_id -> last scheduled time (next week)


@external
def __init__(_token: address, _voting_escrow: address, _admin: address):
    """
    @notice Contract constructor
    @param _token `ERC20DFX` contract address
    @param _voting_escrow `VotingEscrow` contract address
    """
    assert _token != empty(address)
    assert _voting_escrow != empty(address)
    assert _admin != empty(address)

    self.admin = _admin
    self.token = _token
    self.voting_escrow = _voting_escrow
    self.time_total = block.timestamp / WEEK * WEEK
    

@external
def commit_transfer_ownership(addr: address):
    """
    @notice Transfer ownership of GaugeController to `addr`
    @param addr Address to have ownership transferred to
    """
    assert msg.sender == self.admin  # dev: admin only
    assert addr != empty(address)  # dev: future admin cannot be the 0 address
    self.future_admin = addr
    log CommitOwnership(addr)


@external
def accept_transfer_ownership():
    """
    @notice Accept a pending ownership transfer
    """
    _admin: address = self.future_admin
    assert msg.sender == _admin  # dev: future admin only

    self.admin = _admin
    log ApplyOwnership(_admin)


@external
@view
def gauge_types(_addr: address) -> int128:
    """
    @notice Get gauge type for address
    @param _addr Gauge address
    @return Gauge type id
    """
    gauge_type: int128 = self.gauge_types_[_addr]
    assert gauge_type != 0

    return gauge_type - 1


@internal
def _get_type_weight(gauge_type: int128) -> uint256:
    """
    @notice Fill historic type weights week-over-week for missed checkins
            and return the type weight for the future week
    @param gauge_type Gauge type id
    @return Type weight
    """
    t: uint256 = self.time_type_weight[gauge_type]
    if t > 0:
        w: uint256 = self.points_type_weight[gauge_type][t]
        for i in range(500):
            if t > block.timestamp:
                break
            t += WEEK
            self.points_type_weight[gauge_type][t] = w
            if t > block.timestamp:
                self.time_type_weight[gauge_type] = t
        return w
    else:
        return 0


@internal
def _get_sum(gauge_type: int128) -> uint256:
    """
    @notice Fill sum of gauge weights for the same type week-over-week for
            missed checkins and return the sum for the future week
    @param gauge_type Gauge type id
    @return Sum of weights
    """
    t: uint256 = self.time_sum[gauge_type]
    if t > 0:
        pt: Point = self.points_sum[gauge_type][t]
        for i in range(500):
            if t > block.timestamp:
                break
            t += WEEK
            d_bias: uint256 = pt.slope * WEEK
            if pt.bias > d_bias:
                pt.bias -= d_bias
                d_slope: uint256 = self.changes_sum[gauge_type][t]
                pt.slope -= d_slope
            else:
                pt.bias = 0
                pt.slope = 0
            self.points_sum[gauge_type][t] = pt
            if t > block.timestamp:
                self.time_sum[gauge_type] = t
        return pt.bias
    else:
        return 0


@internal
def _get_total() -> uint256:
    """
    @notice Fill historic total weights week-over-week for missed checkins
            and return the total for the future week
    @return Total weight
    """
    t: uint256 = self.time_total
    _n_gauge_types: int128 = self.n_gauge_types
    if t > block.timestamp:
        # If we have already checkpointed - still need to change the value
        t -= WEEK
    pt: uint256 = self.points_total[t]

    for gauge_type in range(100):
        if gauge_type == _n_gauge_types:
            break
        self._get_sum(gauge_type)
        self._get_type_weight(gauge_type)

    for i in range(500):
        if t > block.timestamp:
            break
        t += WEEK
        pt = 0
        # Scales as n_types * n_unchecked_weeks (hopefully 1 at most)
        for gauge_type in range(100):
            if gauge_type == _n_gauge_types:
                break
            type_sum: uint256 = self.points_sum[gauge_type][t].bias
            type_weight: uint256 = self.points_type_weight[gauge_type][t]
            pt += type_sum * type_weight
        self.points_total[t] = pt

        if t > block.timestamp:
            self.time_total = t
    return pt


@internal
def _get_weight(gauge_addr: address) -> uint256:
    """
    @notice Fill historic gauge weights week-over-week for missed checkins
            and return the total for the future week
    @param gauge_addr Address of the gauge
    @return Gauge weight
    """
    t: uint256 = self.time_weight[gauge_addr]
    if t > 0:
        pt: Point = self.points_weight[gauge_addr][t]
        for i in range(500):
            if t > block.timestamp:
                break
            t += WEEK
            d_bias: uint256 = pt.slope * WEEK
            if pt.bias > d_bias:
                pt.bias -= d_bias
                d_slope: uint256 = self.changes_weight[gauge_addr][t]
                pt.slope -= d_slope
            else:
                pt.bias = 0
                pt.slope = 0
            self.points_weight[gauge_addr][t] = pt
            if t > block.timestamp:
                self.time_weight[gauge_addr] = t
        return pt.bias
    else:
        return 0


@external
def add_gauge(addr: address, gauge_type: int128, weight: uint256 = 0):
    """
    @notice Add gauge `addr` of type `gauge_type` with weight `weight`
    @param addr Gauge address
    @param gauge_type Gauge type
    @param weight Gauge weight
    """
    assert msg.sender == self.admin
    assert (gauge_type >= 0) and (gauge_type < self.n_gauge_types)
    assert self.gauge_types_[addr] == 0  # dev: cannot add the same gauge twice

    n: int128 = self.n_gauges
    self.n_gauges = n + 1
    self.gauges[n] = addr

    self.gauge_types_[addr] = gauge_type + 1
    next_time: uint256 = (block.timestamp + WEEK) / WEEK * WEEK

    if weight > 0:
        _type_weight: uint256 = self._get_type_weight(gauge_type)
        _old_sum: uint256 = self._get_sum(gauge_type)
        _old_total: uint256 = self._get_total()

        self.points_sum[gauge_type][next_time].bias = weight + _old_sum
        self.time_sum[gauge_type] = next_time
        self.points_total[next_time] = _old_total + _type_weight * weight
        self.time_total = next_time

        self.points_weight[addr][next_time].bias = weight

    if self.time_sum[gauge_type] == 0:
        self.time_sum[gauge_type] = next_time
    self.time_weight[addr] = next_time

    log NewGauge(addr, gauge_type, weight)


@external
def checkpoint():
    """
    @notice Checkpoint to fill data common for all gauges
    """
    self._get_total()


@external
def checkpoint_gauge(addr: address):
    """
    @notice Checkpoint to fill data for both a specific gauge and common for all gauges
    @param addr Gauge address
    """
    self._get_weight(addr)
    self._get_total()


@internal
@view
def _gauge_relative_weight(addr: address, time: uint256) -> uint256:
    """
    @notice Get Gauge relative weight (not more than 1.0) normalized to 1e18
            (e.g. 1.0 == 1e18). Inflation which will be received by it is
            inflation_rate * relative_weight / 1e18
    @param addr Gauge address
    @param time Relative weight at the specified timestamp in the past or present
    @return Value of relative weight normalized to 1e18
    """
    t: uint256 = time / WEEK * WEEK
    _total_weight: uint256 = self.points_total[t]

    if _total_weight > 0:
        gauge_type: int128 = self.gauge_types_[addr] - 1
        _type_weight: uint256 = self.points_type_weight[gauge_type][t]
        _gauge_weight: uint256 = self.points_weight[addr][t].bias
        return MULTIPLIER * _type_weight * _gauge_weight / _total_weight

    else:
        return 0


@external
@view
def gauge_relative_weight(addr: address, time: uint256 = block.timestamp) -> uint256:
    """
    @notice Get Gauge relative weight (not more than 1.0) normalized to 1e18
            (e.g. 1.0 == 1e18). Inflation which will be received by it is
            inflation_rate * relative_weight / 1e18
    @param addr Gauge address
    @param time Relative weight at the specified timestamp in the past or present
    @return Value of relative weight normalized to 1e18
    """
    return self._gauge_relative_weight(addr, time)


@external
def gauge_relative_weight_write(addr: address, time: uint256 = block.timestamp) -> uint256:
    """
    @notice Get gauge weight normalized to 1e18 and also fill all the unfilled
            values for type and gauge records
    @dev Any address can call, however nothing is recorded if the values are filled already
    @param addr Gauge address
    @param time Relative weight at the specified timestamp in the past or present
    @return Value of relative weight normalized to 1e18
    """
    self._get_weight(addr)
    self._get_total()  # Also calculates get_sum
    return self._gauge_relative_weight(addr, time)


@internal
def _change_type_weight(type_id: int128, weight: uint256):
    """
    @notice Change type weight
    @param type_id Type id
    @param weight New type weight
    """
    old_weight: uint256 = self._get_type_weight(type_id)
    old_sum: uint256 = self._get_sum(type_id)
    _total_weight: uint256 = self._get_total()
    next_time: uint256 = (block.timestamp + WEEK) / WEEK * WEEK

    _total_weight = _total_weight + old_sum * weight - old_sum * old_weight
    self.points_total[next_time] = _total_weight
    self.points_type_weight[type_id][next_time] = weight
    self.time_total = next_time
    self.time_type_weight[type_id] = next_time

    log NewTypeWeight(type_id, next_time, weight, _total_weight)


@external
def add_type(_name: String[64], weight: uint256 = 0):
    """
    @notice Add gauge type with name `_name` and weight `weight`
    @param _name Name of gauge type
    @param weight Weight of gauge type
    """
    assert msg.sender == self.admin
    type_id: int128 = self.n_gauge_types
    self.gauge_type_names[type_id] = _name
    self.n_gauge_types = type_id + 1
    if weight != 0:
        self._change_type_weight(type_id, weight)
        log AddType(_name, type_id)


@external
def change_type_weight(type_id: int128, weight: uint256):
    """
    @notice Change gauge type `type_id` weight to `weight`
    @param type_id Gauge type id
    @param weight New Gauge weight
    """
    assert msg.sender == self.admin
    self._change_type_weight(type_id, weight)


@internal
def _change_gauge_weight(addr: address, weight: uint256):
    # Change gauge weight
    # Only needed when testing in reality
    gauge_type: int128 = self.gauge_types_[addr] - 1
    old_gauge_weight: uint256 = self._get_weight(addr)
    type_weight: uint256 = self._get_type_weight(gauge_type)
    old_sum: uint256 = self._get_sum(gauge_type)
    _total_weight: uint256 = self._get_total()
    next_time: uint256 = (block.timestamp + WEEK) / WEEK * WEEK

    self.points_weight[addr][next_time].bias = weight
    self.time_weight[addr] = next_time

    new_sum: uint256 = old_sum + weight - old_gauge_weight
    self.points_sum[gauge_type][next_time].bias = new_sum
    self.time_sum[gauge_type] = next_time

    _total_weight = _total_weight + new_sum * type_weight - old_sum * type_weight
    self.points_total[next_time] = _total_weight
    self.time_total = next_time

    log NewGaugeWeight(addr, block.timestamp, weight, _total_weight)


@external
def change_gauge_weight(addr: address, weight: uint256):
    """
    @notice Change weight of gauge `addr` to `weight`
    @param addr `GaugeController` contract address
    @param weight New Gauge weight
    """
    assert msg.sender == self.admin
    self._change_gauge_weight(addr, weight)


@external
def vote_for_gauge_weights(_gauge_addr: address, _user_weight: uint256):
    """
    @notice Allocate voting power for changing pool weights
    @param _gauge_addr Gauge which `msg.sender` votes for
    @param _user_weight Weight for a gauge in bps (units of 0.01%). Minimal is 0.01%. Ignored if 0
    """
    escrow: address = self.voting_escrow
    slope: uint256 = convert(VotingEscrow(escrow).get_last_user_slope(msg.sender), uint256)
    lock_end: uint256 = VotingEscrow(escrow).locked__end(msg.sender)
    _n_gauges: int128 = self.n_gauges
    next_time: uint256 = (block.timestamp + WEEK) / WEEK * WEEK
    assert lock_end > next_time, "Your token lock expires too soon"
    assert (_user_weight >= 0) and (_user_weight <= 10000), "You used all your voting power"
    assert block.timestamp >= self.last_user_vote[msg.sender][_gauge_addr] + WEIGHT_VOTE_DELAY, "Cannot vote so often"

    gauge_type: int128 = self.gauge_types_[_gauge_addr] - 1
    assert gauge_type >= 0, "Gauge not added"
    # Prepare slopes and biases in memory
    old_slope: VotedSlope = self.vote_user_slopes[msg.sender][_gauge_addr]
    old_dt: uint256 = 0
    if old_slope.end > next_time:
        old_dt = old_slope.end - next_time
    old_bias: uint256 = old_slope.slope * old_dt
    new_slope: VotedSlope = VotedSlope({
        slope: slope * _user_weight / 10000,
        power: _user_weight,
        end: lock_end
    })
    new_dt: uint256 = lock_end - next_time  # dev: raises when expired
    new_bias: uint256 = new_slope.slope * new_dt

    # Check and update powers (weights) used
    power_used: uint256 = self.vote_user_power[msg.sender]
    power_used = power_used + new_slope.power - old_slope.power
    self.vote_user_power[msg.sender] = power_used
    assert (power_used >= 0) and (power_used <= 10000), 'Used too much power'

    ## Remove old and schedule new slope changes
    # Remove slope changes for old slopes
    # Schedule recording of initial slope for next_time
    old_weight_bias: uint256 = self._get_weight(_gauge_addr)
    old_weight_slope: uint256 = self.points_weight[_gauge_addr][next_time].slope
    old_sum_bias: uint256 = self._get_sum(gauge_type)
    old_sum_slope: uint256 = self.points_sum[gauge_type][next_time].slope

    self.points_weight[_gauge_addr][next_time].bias = max(old_weight_bias + new_bias, old_bias) - old_bias
    self.points_sum[gauge_type][next_time].bias = max(old_sum_bias + new_bias, old_bias) - old_bias
    if old_slope.end > next_time:
        self.points_weight[_gauge_addr][next_time].slope = max(old_weight_slope + new_slope.slope, old_slope.slope) - old_slope.slope
        self.points_sum[gauge_type][next_time].slope = max(old_sum_slope + new_slope.slope, old_slope.slope) - old_slope.slope
    else:
        self.points_weight[_gauge_addr][next_time].slope += new_slope.slope
        self.points_sum[gauge_type][next_time].slope += new_slope.slope
    if old_slope.end > block.timestamp:
        # Cancel old slope changes if they still didn't happen
        self.changes_weight[_gauge_addr][old_slope.end] -= old_slope.slope
        self.changes_sum[gauge_type][old_slope.end] -= old_slope.slope
    # Add slope changes for new slopes
    self.changes_weight[_gauge_addr][new_slope.end] += new_slope.slope
    self.changes_sum[gauge_type][new_slope.end] += new_slope.slope

    self._get_total()

    self.vote_user_slopes[msg.sender][_gauge_addr] = new_slope

    # Record last action time
    self.last_user_vote[msg.sender][_gauge_addr] = block.timestamp

    log VoteForGauge(block.timestamp, msg.sender, _gauge_addr, _user_weight)


@external
@view
def get_gauge_weight(addr: address) -> uint256:
    """
    @notice Get current gauge weight
    @param addr Gauge address
    @return Gauge weight
    """
    return self.points_weight[addr][self.time_weight[addr]].bias


@external
@view
def get_type_weight(type_id: int128) -> uint256:
    """
    @notice Get current type weight
    @param type_id Type id
    @return Type weight
    """
    return self.points_type_weight[type_id][self.time_type_weight[type_id]]


@external
@view
def get_total_weight() -> uint256:
    """
    @notice Get current total (type-weighted) weight
    @return Total weight
    """
    return self.points_total[self.time_total]


@external
@view
def get_weights_sum_per_type(type_id: int128) -> uint256:
    """
    @notice Get sum of gauge weights per type
    @param type_id Type id
    @return Sum of gauge weights
    """
    return self.points_sum[type_id][self.time_sum[type_id]].bias

Contract Security Audit

Contract ABI

[{"name":"CommitOwnership","inputs":[{"name":"admin","type":"address","indexed":false}],"anonymous":false,"type":"event"},{"name":"ApplyOwnership","inputs":[{"name":"admin","type":"address","indexed":false}],"anonymous":false,"type":"event"},{"name":"AddType","inputs":[{"name":"name","type":"string","indexed":false},{"name":"type_id","type":"int128","indexed":false}],"anonymous":false,"type":"event"},{"name":"NewTypeWeight","inputs":[{"name":"type_id","type":"int128","indexed":false},{"name":"time","type":"uint256","indexed":false},{"name":"weight","type":"uint256","indexed":false},{"name":"total_weight","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"NewGaugeWeight","inputs":[{"name":"gauge_address","type":"address","indexed":false},{"name":"time","type":"uint256","indexed":false},{"name":"weight","type":"uint256","indexed":false},{"name":"total_weight","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"VoteForGauge","inputs":[{"name":"time","type":"uint256","indexed":false},{"name":"user","type":"address","indexed":false},{"name":"gauge_addr","type":"address","indexed":false},{"name":"weight","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"NewGauge","inputs":[{"name":"addr","type":"address","indexed":false},{"name":"gauge_type","type":"int128","indexed":false},{"name":"weight","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"KilledGauge","inputs":[{"name":"addr","type":"address","indexed":false}],"anonymous":false,"type":"event"},{"stateMutability":"nonpayable","type":"constructor","inputs":[{"name":"_token","type":"address"},{"name":"_voting_escrow","type":"address"},{"name":"_admin","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"commit_transfer_ownership","inputs":[{"name":"addr","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"accept_transfer_ownership","inputs":[],"outputs":[]},{"stateMutability":"view","type":"function","name":"gauge_types","inputs":[{"name":"_addr","type":"address"}],"outputs":[{"name":"","type":"int128"}]},{"stateMutability":"nonpayable","type":"function","name":"add_gauge","inputs":[{"name":"addr","type":"address"},{"name":"gauge_type","type":"int128"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"add_gauge","inputs":[{"name":"addr","type":"address"},{"name":"gauge_type","type":"int128"},{"name":"weight","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"checkpoint","inputs":[],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"checkpoint_gauge","inputs":[{"name":"addr","type":"address"}],"outputs":[]},{"stateMutability":"view","type":"function","name":"gauge_relative_weight","inputs":[{"name":"addr","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"gauge_relative_weight","inputs":[{"name":"addr","type":"address"},{"name":"time","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"gauge_relative_weight_write","inputs":[{"name":"addr","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"gauge_relative_weight_write","inputs":[{"name":"addr","type":"address"},{"name":"time","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"add_type","inputs":[{"name":"_name","type":"string"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"add_type","inputs":[{"name":"_name","type":"string"},{"name":"weight","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"change_type_weight","inputs":[{"name":"type_id","type":"int128"},{"name":"weight","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"change_gauge_weight","inputs":[{"name":"addr","type":"address"},{"name":"weight","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"vote_for_gauge_weights","inputs":[{"name":"_gauge_addr","type":"address"},{"name":"_user_weight","type":"uint256"}],"outputs":[]},{"stateMutability":"view","type":"function","name":"get_gauge_weight","inputs":[{"name":"addr","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"get_type_weight","inputs":[{"name":"type_id","type":"int128"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"get_total_weight","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"get_weights_sum_per_type","inputs":[{"name":"type_id","type":"int128"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"admin","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"future_admin","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"token","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"voting_escrow","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"n_gauge_types","inputs":[],"outputs":[{"name":"","type":"int128"}]},{"stateMutability":"view","type":"function","name":"n_gauges","inputs":[],"outputs":[{"name":"","type":"int128"}]},{"stateMutability":"view","type":"function","name":"gauge_type_names","inputs":[{"name":"arg0","type":"int128"}],"outputs":[{"name":"","type":"string"}]},{"stateMutability":"view","type":"function","name":"gauges","inputs":[{"name":"arg0","type":"uint256"}],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"vote_user_slopes","inputs":[{"name":"arg0","type":"address"},{"name":"arg1","type":"address"}],"outputs":[{"name":"","type":"tuple","components":[{"name":"slope","type":"uint256"},{"name":"power","type":"uint256"},{"name":"end","type":"uint256"}]}]},{"stateMutability":"view","type":"function","name":"vote_user_power","inputs":[{"name":"arg0","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"last_user_vote","inputs":[{"name":"arg0","type":"address"},{"name":"arg1","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"points_weight","inputs":[{"name":"arg0","type":"address"},{"name":"arg1","type":"uint256"}],"outputs":[{"name":"","type":"tuple","components":[{"name":"bias","type":"uint256"},{"name":"slope","type":"uint256"}]}]},{"stateMutability":"view","type":"function","name":"time_weight","inputs":[{"name":"arg0","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"points_sum","inputs":[{"name":"arg0","type":"int128"},{"name":"arg1","type":"uint256"}],"outputs":[{"name":"","type":"tuple","components":[{"name":"bias","type":"uint256"},{"name":"slope","type":"uint256"}]}]},{"stateMutability":"view","type":"function","name":"time_sum","inputs":[{"name":"arg0","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"points_total","inputs":[{"name":"arg0","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"time_total","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"points_type_weight","inputs":[{"name":"arg0","type":"int128"},{"name":"arg1","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"time_type_weight","inputs":[{"name":"arg0","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]}]

602061221c6000396000518060a01c61221757604052602061223c6000396000518060a01c61221757606052602061225c6000396000518060a01c6122175760805234612217576040511561221757606051156122175760805115612217576080516000556040516002556060516003554262093a808104905062093a8081028162093a808204186122175790506377359411556121716100a561000039612171610000f36003361161000c576116d1565b60003560e01c3461216157636b441a40811861007d5760243618612161576004358060a01c6121615760405260005433186121615760405115612161576040516001557f2f56810a6bf40af059b96d3aea4db54081f378029a518390491093a7b67032e960405160605260206060a1005b63e5ea47b881186100d35760043618612161576001546040526040513318612161576040516000557febee2d5739011062cb4f14113f3b36bf0ffe3da5c0568f64189d1012a118910560405160605260206060a1005b633f9095b7811861012f5760243618612161576004358060a01c61216157604052633b9aca0760405160205260005260406000205460605260605115612161576060516001810380600f0b811861216157905060805260206080f35b633a04f900811861014d576044361861216157600061024052610168565b6318dfe9218118610408576064361861216157604435610240525b6004358060a01c612161576102005260243580600f0b8118612161576102205260005433186121615760006102205112156101a45760006101ad565b60045461022051125b1561216157633b9aca07610200516020526000526040600020546121615760055461026052610260516001810180600f0b81186121615790506005556102005161026051633b9ac9ff81116121615760070155610220516001810180600f0b8118612161579050633b9aca07610200516020526000526040600020554262093a80810181811061216157905062093a808104905062093a8081028162093a8082041861216157905061028052610240511561037957610220516040526102746102c06116d7565b6102c0516102a0526102205160405261028e6102e06117bd565b6102e0516102c0526102a1610300611940565b610300516102e052610240516102c0518082018281106121615790509050633b9aca0e610220516020526000526040600020806102805160205260005260406000209050556102805161022051633b9ac9ff811161216157633b9aca1001556102e0516102a05161024051808202811583838304141715612161579050905080820182811061216157905090506377359410610280516020526000526040600020556102805163773594115561024051633b9aca0b610200516020526000526040600020806102805160205260005260406000209050555b61022051633b9ac9ff811161216157633b9aca1001546103ae576102805161022051633b9ac9ff811161216157633b9aca1001555b61028051633b9aca0d610200516020526000526040600020557ffd55b3191f9c9dd92f4f134dd700e7d76f6a0c836a08687023d6d38f03ebd877610200516102a052610220516102c052610240516102e05260606102a0a1005b63c2c4c5c1811861042c576004361861216157610426610200611940565b61020050005b63615e523781186104755760243618612161576004358060a01c612161576102005261020051604052610460610220611b13565b6102205061046f610220611940565b61022050005b636207d866811861049257602436186121615742610140526104ad565b63d3078c9481186104dc576044361861216157602435610140525b6004358060a01c6121615761012052602061012051604052610140516060526104d7610160611c94565b610160f35b6395cfcec381186104f95760243618612161574261022052610514565b636472eee18118610568576044361861216157602435610220525b6004358060a01c612161576102005261020051604052610535610240611b13565b61024050610544610240611940565b6102405060206102005160405261022051606052610563610240611c94565b610240f35b6326e56d5e811861058657604436106121615760006103a0526105a1565b6392d0d23281186106e65760643610612161576024356103a0525b60043560040160408135116121615780358061034052602082018181610360375050506000543318612161576004546103c052610340518060066103c051602052600052604060002055600160066103c051602052600052604060002001600082601f0160051c6002811161216157801561063057905b8060051b610360015181840155600101818118610618575b505050506103c0516001810180600f0b81186121615790506004556103a051156106e4576103c051610200526103a0516102205261066c611daa565b7f6fbe76157c712f16b5a3c44ed48baa04e3450bc3fab0c020e848aca72bbccc846040806103e052806103e001610340518082526020820181818361036060045afa5050508051806020830101601f82600003163682375050601f19601f825160200101169050810190506103c051610400526103e0a15b005b63db1ca260811861072c57604436186121615760043580600f0b8118612161576103405260005433186121615761034051610200526024356102205261072a611daa565b005b63d4d2646e81186107705760443618612161576004358060a01c612161576103a0526000543318612161576103a051610200526024356102205261076e611f2d565b005b63d713632881186110e35760443618612161576004358060a01c61216157610200526003546102205261022051637c74a1746102605233610280526020610260602461027c845afa6107c7573d600060003e3d6000fd5b60203d10612161576102605180600f0b8118612161576102a0526102a09050516000811261216157610240526102205163adc6358961028052336102a0526020610280602461029c845afa610821573d600060003e3d6000fd5b60203d106121615761028090505161026052600554610280524262093a80810181811061216157905062093a808104905062093a8081028162093a808204186121615790506102a0526102a05161026051116108dd5760206102c0527f596f757220746f6b656e206c6f636b206578706972657320746f6f20736f6f6e6102e0526102c0506102c051806102e001601f826000031636823750506308c379a06102805260206102a052601f19601f6102c051011660440161029cfd5b600060243510156108ef5760006108f8565b61271060243511155b61096257601e6102c0527f596f75207573656420616c6c20796f757220766f74696e6720706f77657200006102e0526102c0506102c051806102e001601f826000031636823750506308c379a06102805260206102a052601f19601f6102c051011660440161029cfd5b633b9aca0a33602052600052604060002080610200516020526000526040600020905054620d2f008101818110612161579050421015610a025760146102c0527f43616e6e6f7420766f746520736f206f6674656e0000000000000000000000006102e0526102c0506102c051806102e001601f826000031636823750506308c379a06102805260206102a052601f19601f6102c051011660440161029cfd5b633b9aca07610200516020526000526040600020546001810380600f0b81186121615790506102c05260006102c0511215610a9d57600f6102e0527f4761756765206e6f742061646465640000000000000000000000000000000000610300526102e0506102e0518061030001601f826000031636823750506308c379a06102a05260206102c052601f19601f6102e05101166044016102bcfd5b633b9aca0833602052600052604060002080610200516020526000526040600020905080546102e052600181015461030052600281015461032052506000610340526102a051610320511115610b0857610320516102a0518082038281116121615790509050610340525b6102e0516103405180820281158383830414171561216157905090506103605261024051602435808202811583838304141715612161579050905061271081049050610380526024356103a052610260516103c052610260516102a05180820382811161216157905090506103e052610380516103e051808202811583838304141715612161579050905061040052633b9aca093360205260005260406000205461042052610420516103a05180820182811061216157905090506103005180820382811161216157905090506104205261042051633b9aca09336020526000526040600020556000610420511015610c02576000610c0c565b6127106104205111155b610c76576013610440527f5573656420746f6f206d75636820706f776572000000000000000000000000006104605261044050610440518061046001601f826000031636823750506308c379a061040052602061042052601f19601f61044051011660440161041cfd5b61020051604052610c88610460611b13565b6104605161044052633b9aca0b610200516020526000526040600020806102a0516020526000526040600020905060018101905054610460526102c051604052610cd36104a06117bd565b6104a05161048052633b9aca0e6102c0516020526000526040600020806102a05160205260005260406000209050600181019050546104a052610440516104005180820182811061216157905090506103605180828118828411021890509050610360518082038281116121615790509050633b9aca0b610200516020526000526040600020806102a0516020526000526040600020905055610480516104005180820182811061216157905090506103605180828118828411021890509050610360518082038281116121615790509050633b9aca0e6102c0516020526000526040600020806102a05160205260005260406000209050556102a0516103205111610e6457633b9aca0b610200516020526000526040600020806102a051602052600052604060002090506001810190508054610380518082018281106121615790509050815550633b9aca0e6102c0516020526000526040600020806102a051602052600052604060002090506001810190508054610380518082018281106121615790509050815550610f31565b610460516103805180820182811061216157905090506102e051808281188284110218905090506102e0518082038281116121615790509050633b9aca0b610200516020526000526040600020806102a05160205260005260406000209050600181019050556104a0516103805180820182811061216157905090506102e051808281188284110218905090506102e0518082038281116121615790509050633b9aca0e6102c0516020526000526040600020806102a05160205260005260406000209050600181019050555b42610320511115610fb757633b9aca0c61020051602052600052604060002080610320516020526000526040600020905080546102e0518082038281116121615790509050815550633b9aca0f6102c051602052600052604060002080610320516020526000526040600020905080546102e05180820382811161216157905090508155505b633b9aca0c610200516020526000526040600020806103c051602052600052604060002090508054610380518082018281106121615790509050815550633b9aca0f6102c0516020526000526040600020806103c05160205260005260406000209050805461038051808201828110612161579050905081555061103c6104c0611940565b6104c050633b9aca083360205260005260406000208061020051602052600052604060002090506103805181556103a05160018201556103c05160028201555042633b9aca0a336020526000526040600020806102005160205260005260406000209050557f45ca9a4c8d0119eb329e580d28fe689e484e1be230da8037ade9547d2d25cc91426104c052336104e05261020051610500526024356105205260806104c0a1005b634e791a3a81186111435760243618612161576004358060a01c61216157604052633b9aca0b604051602052600052604060002080633b9aca0d604051602052600052604060002054602052600052604060002090505460605260206060f35b6372fdccfa81186111a657602436186121615760043580600f0b8118612161576040526377359412604051602052600052604060002080604051633b9ac9ff81116121615763773594130154602052600052604060002090505460605260206060f35b636977ff9281186111d9576004361861216157637735941063773594115460205260005260406000205460405260206040f35b636f214a6a811861123c57602436186121615760043580600f0b811861216157604052633b9aca0e604051602052600052604060002080604051633b9ac9ff811161216157633b9aca100154602052600052604060002090505460605260206060f35b63f851a440811861125b57600436186121615760005460405260206040f35b6317f7182a811861127a57600436186121615760015460405260206040f35b63fc0c546a811861129957600436186121615760025460405260206040f35b63dfe0503181186112b857600436186121615760035460405260206040f35b639fba03a181186112d757600436186121615760045460405260206040f35b63e93841d081186112f657600436186121615760055460405260206040f35b63d958a8fc81186113a057602436186121615760043580600f0b811861216157604052602080606052600660405160205260005260406000208160600181548082526001830160208301600083601f0160051c6002811161216157801561136f57905b808401548160051b840152600101818118611359575b50505050508051806020830101601f82600003163682375050601f19601f8251602001011690509050810190506060f35b63b053918781186113ce576024361861216157600435633b9ac9ff8111612161576007015460405260206040f35b630f467f98811861143d5760443618612161576004358060a01c612161576040526024358060a01c61216157606052633b9aca08604051602052600052604060002080606051602052600052604060002090508054608052600181015460a052600281015460c0525060606080f35b63411e74b5811861147b5760243618612161576004358060a01c61216157604052633b9aca0960405160205260005260406000205460605260206060f35b637e418fa081186114d85760443618612161576004358060a01c612161576040526024358060a01c61216157606052633b9aca0a604051602052600052604060002080606051602052600052604060002090505460805260206080f35b63edba527381186115315760443618612161576004358060a01c61216157604052633b9aca0b60405160205260005260406000208060243560205260005260406000209050805460605260018101546080525060406060f35b63a4d7a250811861156f5760243618612161576004358060a01c61216157604052633b9aca0d60405160205260005260406000205460605260206060f35b63a9b48c0181186115ca57604436186121615760043580600f0b811861216157604052633b9aca0e60405160205260005260406000208060243560205260005260406000209050805460605260018101546080525060406060f35b635a54915881186115fb576024361861216157600435633b9ac9ff811161216157633b9aca10015460405260206040f35b631142916b811861162b576024361861216157637735941060043560205260005260406000205460405260206040f35b63513872bd811861164d57600436186121615763773594115460405260206040f35b63afd2bb49811861169e57604436186121615760043580600f0b8118612161576040526377359412604051602052600052604060002080602435602052600052604060002090505460605260206060f35b6351ce6b5981186116cf576024361861216157600435633b9ac9ff8111612161576377359413015460405260206040f35b505b60006000fd5b604051633b9ac9ff81116121615763773594130154606052606051156117b5576377359412604051602052600052604060002080606051602052600052604060002090505460805260006101f4905b8060a052426060511115611739576117a4565b60605162093a8081018181106121615790506060526080516377359412604051602052600052604060002080606051602052600052604060002090505542606051111561179957606051604051633b9ac9ff811161216157637735941301555b600101818118611726575b50506080518152506117bb566117bb565b60008152505b565b604051633b9ac9ff811161216157633b9aca1001546060526060511561193857633b9aca0e604051602052600052604060002080606051602052600052604060002090508054608052600181015460a0525060006101f4905b8060c05242606051111561182957611927565b60605162093a80810181811061216157905060605260a05162093a8081028162093a8082041861216157905060e05260e0516080511161186e576040366080376118c7565b60805160e0518082038281116121615790509050608052633b9aca0f60405160205260005260406000208060605160205260005260406000209050546101005260a05161010051808203828111612161579050905060a0525b633b9aca0e60405160205260005260406000208060605160205260005260406000209050608051815560a05160018201555042606051111561191c57606051604051633b9ac9ff811161216157633b9aca1001555b600101818118611816575b505060805181525061193e5661193e565b60008152505b565b637735941154610120526004546101405242610120511115611974576101205162093a808103818111612161579050610120525b6377359410610120516020526000526040600020546101605260006064905b80610180526101405161018051186119aa576119e1565b610180516040526119bc6101a06117bd565b6101a050610180516040526119d26101a06116d7565b6101a050600101818118611993575b505060006101f4905b8061018052426101205111156119ff57611b08565b6101205162093a8081018181106121615790506101205260006101605260006064905b806101a052610140516101a05118611a3957611acc565b633b9aca0e6101a0516020526000526040600020806101205160205260005260406000209050546101c05263773594126101a0516020526000526040600020806101205160205260005260406000209050546101e052610160516101c0516101e0518082028115838383041417156121615790509050808201828110612161579050905061016052600101818118611a22575b50506101605163773594106101205160205260005260406000205542610120511115611afd57610120516377359411555b6001018181186119ea575b505061016051815250565b633b9aca0d60405160205260005260406000205460605260605115611c8c57633b9aca0b604051602052600052604060002080606051602052600052604060002090508054608052600181015460a0525060006101f4905b8060c052426060511115611b7e57611c7b565b60605162093a80810181811061216157905060605260a05162093a8081028162093a8082041861216157905060e05260e05160805111611bc357604036608037611c1c565b60805160e0518082038281116121615790509050608052633b9aca0c60405160205260005260406000208060605160205260005260406000209050546101005260a05161010051808203828111612161579050905060a0525b633b9aca0b60405160205260005260406000208060605160205260005260406000209050608051815560a051600182015550426060511115611c7057606051633b9aca0d6040516020526000526040600020555b600101818118611b6b575b5050608051815250611c9256611c92565b60008152505b565b60605162093a808104905062093a8081028162093a80820418612161579050608052637735941060805160205260005260406000205460a05260a05115611da257633b9aca076040516020526000526040600020546001810380600f0b811861216157905060c052637735941260c051602052600052604060002080608051602052600052604060002090505460e052633b9aca0b60405160205260005260406000208060805160205260005260406000209050546101005260e051670de0b6b3a7640000810281670de0b6b3a764000082041861216157905061010051808202811583838304141715612161579050905060a05180156121615780820490509050815250611da856611da8565b60008152505b565b61020051604052611dbc6102606116d7565b610260516102405261020051604052611dd66102806117bd565b6102805161026052611de96102a0611940565b6102a051610280524262093a80810181811061216157905062093a808104905062093a8081028162093a808204186121615790506102a05261028051610260516102205180820281158383830414171561216157905090508082018281106121615790509050610260516102405180820281158383830414171561216157905090508082038281116121615790509050610280526102805163773594106102a051602052600052604060002055610220516377359412610200516020526000526040600020806102a05160205260005260406000209050556102a0516377359411556102a05161020051633b9ac9ff811161216157637735941301557e170bcdc909b6ac6e12d020fe8942256312cdcd555fb6d712899eba56d2f901610200516102c0526102a0516102e0526102205161030052610280516103205260806102c0a1565b633b9aca07610200516020526000526040600020546001810380600f0b81186121615790506102405261020051604052611f68610280611b13565b610280516102605261024051604052611f826102a06116d7565b6102a0516102805261024051604052611f9c6102c06117bd565b6102c0516102a052611faf6102e0611940565b6102e0516102c0524262093a80810181811061216157905062093a808104905062093a8081028162093a808204186121615790506102e05261022051633b9aca0b610200516020526000526040600020806102e05160205260005260406000209050556102e051633b9aca0d610200516020526000526040600020556102a0516102205180820182811061216157905090506102605180820382811161216157905090506103005261030051633b9aca0e610240516020526000526040600020806102e05160205260005260406000209050556102e05161024051633b9ac9ff811161216157633b9aca1001556102c0516103005161028051808202811583838304141715612161579050905080820182811061216157905090506102a05161028051808202811583838304141715612161579050905080820382811161216157905090506102c0526102c05163773594106102e0516020526000526040600020556102e0516377359411557f54c0cf3647e6cdb2fc0a7876e60ba77563fceedf2e06c01c597f8dccb9e6bd726102005161032052426103405261022051610360526102c051610380526080610320a1565b600080fda165767970657283000304005b600080fd000000000000000000000000e7804d91dfcde7f776c90043e03eaa6df87e6395000000000000000000000000e7804d91dfcde7f776c90043e03eaa6df87e63950000000000000000000000004210b1803f7cb057435ff1135f5dfdfbee086c27

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000e7804d91dfcde7f776c90043e03eaa6df87e6395000000000000000000000000e7804d91dfcde7f776c90043e03eaa6df87e63950000000000000000000000004210b1803f7cb057435ff1135f5dfdfbee086c27

-----Decoded View---------------
Arg [0] : _token (address): 0xe7804d91dfcde7f776c90043e03eaa6df87e6395
Arg [1] : _voting_escrow (address): 0xe7804d91dfcde7f776c90043e03eaa6df87e6395
Arg [2] : _admin (address): 0x4210b1803f7cb057435ff1135f5dfdfbee086c27

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000e7804d91dfcde7f776c90043e03eaa6df87e6395
Arg [1] : 000000000000000000000000e7804d91dfcde7f776c90043e03eaa6df87e6395
Arg [2] : 0000000000000000000000004210b1803f7cb057435ff1135f5dfdfbee086c27


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.