Address Contract Partially Verified
Address
0x619eDEF2d18Ec9758E96D8FF2c7DcbFb58DD5A5C
Balance
0 ETH
Nonce
1
Code Size
3301 bytes
Creator
0x000755Fb...ff62 at tx 0x48b034ca...7eea7e
Indexed Transactions
0 (1 on-chain, 1.3% indexed)
Contract Bytecode
3301 bytes
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c806380599e4b1161005b57806380599e4b146101545780638a228f8c14610167578063e123cdb81461017a578063fc2525ab146101a557600080fd5b806336651211146100825780634dd52f2a146100975780636042ad61146100e6575b600080fd5b6100956100903660046107ed565b6101c5565b005b6100d36100a53660046108ee565b6002602090815260009283526040909220815180830184018051928152908401929093019190912091525481565b6040519081526020015b60405180910390f35b6101356100f436600461093c565b81516020818401810180516000808352938301958301959095209490529290925281526040902080546003909101546001600160a01b039091169060ff1682565b604080516001600160a01b0390931683529015156020830152016100dd565b6100956101623660046109c3565b61020c565b6100956101753660046109f9565b6102c1565b6100d3610188366004610a93565b805160208183018101805160018252928201919093012091525481565b6101b86101b3366004610ad0565b610569565b6040516100dd9190610b5e565b60005b81811015610207576101f78383838181106101e5576101e5610bfa565b90506020028101906101629190610c10565b61020081610c6d565b90506101c8565b505050565b33600090815260026020526040808220905161022b9085908590610c86565b90815260200160405180910390205490506000811161027b5760405162461bcd60e51b81526020600482015260076024820152664e6f20766f746560c81b60448201526064015b60405180910390fd5b60016000848460405161028f929190610c86565b90815260408051602092819003830190206000948552909152909120600301805460ff19169115159190911790555050565b808381146102fb5760405162461bcd60e51b815260206004820152600760248201526604298cadccee8d60cb1b6044820152606401610272565b6000805b828110156103355784848281811061031957610319610bfa565b905060200201358261032b9190610c96565b91506001016102ff565b81612710146103755760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c81dd95a59da1d60a21b6044820152606401610272565b336000908152600260205260408082209051610394908c908c90610c86565b90815260200160405180910390205490508060000361043657600060018b8b6040516103c1929190610c86565b9081526040519081900360200190205490506103de816001610c96565b91508160018c8c6040516103f3929190610c86565b908152604080516020928190038301812093909355336000908152600290925290208391610424908e908e90610c86565b90815260405190819003602001902055505b6040518060800160405280336001600160a01b0316815260200189898080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050509082525060408051602089810282810182019093528982529283019290918a918a918291850190849080828437600092018290525093855250505060209091018190526040516104d5908d908d90610c86565b9081526040805160209281900383019020600085815290835220825181546001600160a01b0319166001600160a01b039091161781558282015180519192610525926001850192909101906106ec565b5060408201518051610541916002840191602090910190610751565b50606091909101516003909101805460ff191691151591909117905550505050505050505050565b61059f604051806080016040528060006001600160a01b0316815260200160608152602001606081526020016000151581525090565b6001600160a01b03841660009081526002602052604080822090516105c79086908690610c86565b9081526020016040518091039020549050600084846040516105ea929190610c86565b908152604080519182900360209081018320600085815290825282902060808401835280546001600160a01b0316845260018101805484518185028101850190955280855291938584019390929083018282801561067157602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610653575b50505050508152602001600282018054806020026020016040519081016040528092919081815260200182805480156106c957602002820191906000526020600020905b8154815260200190600101908083116106b5575b50505091835250506003919091015460ff16151560209091015295945050505050565b828054828255906000526020600020908101928215610741579160200282015b8281111561074157825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019061070c565b5061074d92915061078c565b5090565b828054828255906000526020600020908101928215610741579160200282015b82811115610741578251825591602001919060010190610771565b5b8082111561074d576000815560010161078d565b60008083601f8401126107b357600080fd5b50813567ffffffffffffffff8111156107cb57600080fd5b6020830191508360208260051b85010111156107e657600080fd5b9250929050565b6000806020838503121561080057600080fd5b823567ffffffffffffffff81111561081757600080fd5b610823858286016107a1565b90969095509350505050565b80356001600160a01b038116811461084657600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261087257600080fd5b813567ffffffffffffffff8082111561088d5761088d61084b565b604051601f8301601f19908116603f011681019082821181831017156108b5576108b561084b565b816040528381528660208588010111156108ce57600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806040838503121561090157600080fd5b61090a8361082f565b9150602083013567ffffffffffffffff81111561092657600080fd5b61093285828601610861565b9150509250929050565b6000806040838503121561094f57600080fd5b823567ffffffffffffffff81111561096657600080fd5b61097285828601610861565b95602094909401359450505050565b60008083601f84011261099357600080fd5b50813567ffffffffffffffff8111156109ab57600080fd5b6020830191508360208285010111156107e657600080fd5b600080602083850312156109d657600080fd5b823567ffffffffffffffff8111156109ed57600080fd5b61082385828601610981565b60008060008060008060608789031215610a1257600080fd5b863567ffffffffffffffff80821115610a2a57600080fd5b610a368a838b01610981565b90985096506020890135915080821115610a4f57600080fd5b610a5b8a838b016107a1565b90965094506040890135915080821115610a7457600080fd5b50610a8189828a016107a1565b979a9699509497509295939492505050565b600060208284031215610aa557600080fd5b813567ffffffffffffffff811115610abc57600080fd5b610ac884828501610861565b949350505050565b600080600060408486031215610ae557600080fd5b610aee8461082f565b9250602084013567ffffffffffffffff811115610b0a57600080fd5b610b1686828701610981565b9497909650939450505050565b600081518084526020808501945080840160005b83811015610b5357815187529582019590820190600101610b37565b509495945050505050565b602080825282516001600160a01b03908116838301528382015160806040850152805160a08501819052600093929183019190849060c08701905b80831015610bbb57845184168252938501936001929092019190850190610b99565b506040880151878203601f190160608901529450610bd98186610b23565b9450505050506060840151610bf2608085018215159052565b509392505050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112610c2757600080fd5b83018035915067ffffffffffffffff821115610c4257600080fd5b6020019150368190038213156107e657600080fd5b634e487b7160e01b600052601160045260246000fd5b600060018201610c7f57610c7f610c57565b5060010190565b8183823760009101908152919050565b80820180821115610ca957610ca9610c57565b9291505056fea26469706673582212207b53f835d60be9f2d04e908f6399e39eb6ce04e70f02c7022b16693a96fed2b564736f6c63430008140033
Verified Source Code Partial Match
Compiler: v0.8.20+commit.a1b79de6
EVM: paris
Optimization: Yes (200 runs)
VoteWeightRegistry.sol 80 lines
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.20;
contract VoteWeightRegistry {
struct Vote {
// User address
address user;
// Gauge address
address[] gauges;
// Weight to allocate - 0 to 100
uint256[] weights;
bool killed;
}
mapping(string => mapping(uint256 => Vote)) public votes;
// Index start to one
mapping(string => uint256) public space_votes_index;
mapping(address => mapping(string => uint256)) public user_vote_index;
function set(string calldata space, address[] calldata _gauges, uint256[] calldata _weights) external {
uint256 weightLength = _weights.length;
require(_gauges.length == weightLength, "!Length");
uint256 sum = 0;
uint256 i = 0;
for(;i<weightLength;) {
sum += _weights[i];
unchecked {
++i;
}
}
require(sum == 10000, "Wrong weight");
uint256 userVoteIndex = user_vote_index[msg.sender][space];
if(userVoteIndex == 0) {
// New vote
uint256 currentIndex = space_votes_index[space];
userVoteIndex = currentIndex + 1;
space_votes_index[space] = userVoteIndex;
user_vote_index[msg.sender][space] = userVoteIndex;
}
votes[space][userVoteIndex] = Vote({
user: msg.sender,
gauges: _gauges,
weights: _weights,
killed: false
});
}
function remove(string calldata space) public {
uint256 index = user_vote_index[msg.sender][space];
require(index > 0, "No vote");
votes[space][index].killed = true;
}
function removeAll(string[] calldata spaces) public {
for(uint256 i = 0; i < spaces.length; ++i) {
remove(spaces[i]);
}
}
function get(address user, string calldata space) external view returns(Vote memory) {
uint256 index = user_vote_index[user][space];
return votes[space][index];
}
}
Read Contract
get 0xfc2525ab → tuple
space_votes_index 0xe123cdb8 → uint256
user_vote_index 0x4dd52f2a → uint256
votes 0x6042ad61 → address, bool
Write Contract 3 functions
These functions modify contract state and require a wallet transaction to execute.
remove 0x80599e4b
string space
removeAll 0x36651211
string[] spaces
set 0x8a228f8c
string space
address[] _gauges
uint256[] _weights
Recent Transactions
This address has 1 on-chain transactions, but only 1.3% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →