Contract Address Details

0xD9d635123C7d254E0F853B57B6905488587920E2

Contract Name
BrightIDSnapshot
Creator
0xb9d52b–ab98c9 at 0x0fa278–17b0d1
Balance
0 Ether
Tokens
Fetching tokens...
Transactions
Fetching transactions...
Transfers
Fetching transfers...
Gas Used
Fetching gas used...
Last Balance Update
27234730
Contract name:
BrightIDSnapshot




Optimization enabled
false
Compiler version
v0.8.0+commit.c7dfd78e




EVM Version
default




Verified at
2022-01-23 04:18:06.461251Z

Constructor Arguments

000000000000000000000000f917c019349dd70be96dea78e75dc679dcd323f7736e617073686f74000000000000000000000000000000000000000000000000

Arg [0] (address) : 0xf917c019349dd70be96dea78e75dc679dcd323f7
Arg [1] (bytes32) : 736e617073686f74000000000000000000000000000000000000000000000000

              

Contract source code

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IBrightIDSnapshot {
event Verified(address indexed addr);
function isVerifiedUser(address _user) external view returns (bool);
function history(address addr) external view returns (address);
}
//-------------------Contracts-------------------------------
contract BrightIDSnapshot is Ownable, IBrightIDSnapshot {
//-------------------Storage-----------------------------
IERC20 public verifierToken; // Address of verification Token
bytes32 public app; // Registered BrightID app name
uint32 constant public REGISTRATION_PERIOD = 0; // A day
struct Verification {
uint256 time;
bool isVerified;
}
//-------------------Events-----------------------------
event VerifierTokenSet(IERC20 verifierToken);
event Sponsor(address indexed addr);
//-------------------Mappings---------------------------
mapping(address => Verification) public verifications;
mapping(address => address) override public history;
//-------------------Constructor-------------------------
/**
* @param _verifierToken verifier token
* @param _app BrightID app used for verifying users
*/
constructor(IERC20 _verifierToken, bytes32 _app) {
verifierToken = _verifierToken;
app = _app;
}
// emits a sponsor event for brightID nodes
function sponsor(address addr) public {
emit Sponsor(addr);
}
/**
* @notice Set verifier token
* @param _verifierToken verifier token
*/
function setVerifierToken(IERC20 _verifierToken) public onlyOwner {
verifierToken = _verifierToken;
emit VerifierTokenSet(_verifierToken);
}
/**
* @notice Register a user by BrightID verification
* @param addrs The history of addresses used by this user in the app
* @param timestamp The BrightID node's verification timestamp
* @param v Component of signature
* @param r Component of signature
* @param s Component of signature
*/
function verify(
address[] memory addrs,
uint timestamp,
uint8 v,
bytes32 r,
bytes32 s
) public {
require(verifications[addrs[0]].time < timestamp, "Newer verification registered before.");
require (timestamp > block.timestamp - REGISTRATION_PERIOD, "Verification too old. Try linking again.");
bytes32 message = keccak256(abi.encodePacked(app, addrs, timestamp));
address signer = ecrecover(message, v, r, s);
require(verifierToken.balanceOf(signer) > 0, "not authorized");
verifications[addrs[0]].time = timestamp;
verifications[addrs[0]].isVerified = true;
for(uint i = 1; i < addrs.length; i++) {
require(verifications[addrs[i]].time < block.timestamp - REGISTRATION_PERIOD * 2, "Address changed too recently. Wait for next registration period.");
verifications[addrs[i]].time = timestamp;
verifications[addrs[i]].isVerified = false;
history[addrs[i - 1]] = addrs[i];
}
emit Verified(addrs[0]);
}
/**
* @notice Check an address is verified or not
* @param _user The context id used for verifying users
*/
function isVerifiedUser(address _user) override external view returns (bool) {
return verifications[_user].isVerified;
}
}

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_verifierToken","internalType":"contract IERC20"},{"type":"bytes32","name":"_app","internalType":"bytes32"}]},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Sponsor","inputs":[{"type":"address","name":"addr","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Verified","inputs":[{"type":"address","name":"addr","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"VerifierTokenSet","inputs":[{"type":"address","name":"verifierToken","internalType":"contract IERC20","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint32","name":"","internalType":"uint32"}],"name":"REGISTRATION_PERIOD","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"app","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"history","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isVerifiedUser","inputs":[{"type":"address","name":"_user","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setVerifierToken","inputs":[{"type":"address","name":"_verifierToken","internalType":"contract IERC20"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"sponsor","inputs":[{"type":"address","name":"addr","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"time","internalType":"uint256"},{"type":"bool","name":"isVerified","internalType":"bool"}],"name":"verifications","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"verifierToken","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"verify","inputs":[{"type":"address[]","name":"addrs","internalType":"address[]"},{"type":"uint256","name":"timestamp","internalType":"uint256"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}]}]
            

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063867092b611610071578063867092b6146101785780638da5cb5b14610196578063931c7c68146101b4578063b76564bd146101e4578063e0f5409714610202578063f2fde38b14610220576100b4565b80630213c0c5146100b9578063080c98da146100d55780633da1c0c314610106578063715018a614610136578063766c4f371461014057806380d746b21461015c575b600080fd5b6100d360048036038101906100ce9190610f86565b61023c565b005b6100ef60048036038101906100ea9190610f5d565b6109a9565b6040516100fd929190611545565b60405180910390f35b610120600480360381019061011b9190610f5d565b6109da565b60405161012d91906113ef565b60405180910390f35b61013e610a33565b005b61015a60048036038101906101559190610f5d565b610abb565b005b61017660048036038101906101719190611015565b610b01565b005b610180610bf8565b60405161018d919061146a565b60405180910390f35b61019e610c1e565b6040516101ab91906113d4565b60405180910390f35b6101ce60048036038101906101c99190610f5d565b610c47565b6040516101db91906113d4565b60405180910390f35b6101ec610c7a565b6040516101f9919061140a565b60405180910390f35b61020a610c80565b604051610217919061156e565b60405180910390f35b61023a60048036038101906102359190610f5d565b610c85565b005b83600360008760008151811061027b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410610301576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102f8906114a5565b60405180910390fd5b600063ffffffff16426103149190611668565b8411610355576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161034c90611525565b60405180910390fd5b6000600254868660405160200161036e9392919061139b565b6040516020818303038152906040528051906020012090506000600182868686604051600081526020016040526040516103ab9493929190611425565b6020604051602081039080840390855afa1580156103cd573d6000803e3d6000fd5b5050506020604051035190506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b815260040161043691906113d4565b60206040518083038186803b15801561044e57600080fd5b505afa158015610462573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610486919061103e565b116104c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104bd906114e5565b60405180910390fd5b856003600089600081518110610505577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055506001600360008960008151811061058e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160006101000a81548160ff0219169083151502179055506000600190505b875181101561091b5760026000610608919061162a565b63ffffffff16426106199190611668565b600360008a8481518110610656577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154106106dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d3906114c5565b60405180910390fd5b86600360008a848151811061071a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055506000600360008a84815181106107a2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160006101000a81548160ff021916908315150217905550878181518110610837577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151600460008a6001856108519190611668565b81518110610888577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808061091390611741565b9150506105f1565b5086600081518110610956577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff167f6a6455914f452787eb3985452aceedc1000fb545e394eb3b370e3d08958e0a5b60405160405180910390a250505050505050565b60036020528060005260406000206000915090508060000154908060010160009054906101000a900460ff16905082565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900460ff169050919050565b610a3b610d7d565b73ffffffffffffffffffffffffffffffffffffffff16610a59610c1e565b73ffffffffffffffffffffffffffffffffffffffff1614610aaf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aa690611505565b60405180910390fd5b610ab96000610d85565b565b8073ffffffffffffffffffffffffffffffffffffffff167f45731ed8c44f9ae4a6da66b49b81184a6565962041a2485f62942faa4da6df6060405160405180910390a250565b610b09610d7d565b73ffffffffffffffffffffffffffffffffffffffff16610b27610c1e565b73ffffffffffffffffffffffffffffffffffffffff1614610b7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b7490611505565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f6ebcfc706686427d67aa7da746fbe1ac9454e8908eda7b346b4062fc1ab6759281604051610bed919061146a565b60405180910390a150565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60046020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60025481565b600081565b610c8d610d7d565b73ffffffffffffffffffffffffffffffffffffffff16610cab610c1e565b73ffffffffffffffffffffffffffffffffffffffff1614610d01576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf890611505565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610d71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d6890611485565b60405180910390fd5b610d7a81610d85565b50565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000610e5c610e57846115ba565b611589565b90508083825260208201905082856020860282011115610e7b57600080fd5b60005b85811015610eab5781610e918882610eb5565b845260208401935060208301925050600181019050610e7e565b5050509392505050565b600081359050610ec4816117fc565b92915050565b600082601f830112610edb57600080fd5b8135610eeb848260208601610e49565b91505092915050565b600081359050610f0381611813565b92915050565b600081359050610f188161182a565b92915050565b600081359050610f2d81611841565b92915050565b600081519050610f4281611841565b92915050565b600081359050610f5781611858565b92915050565b600060208284031215610f6f57600080fd5b6000610f7d84828501610eb5565b91505092915050565b600080600080600060a08688031215610f9e57600080fd5b600086013567ffffffffffffffff811115610fb857600080fd5b610fc488828901610eca565b9550506020610fd588828901610f1e565b9450506040610fe688828901610f48565b9350506060610ff788828901610ef4565b925050608061100888828901610ef4565b9150509295509295909350565b60006020828403121561102757600080fd5b600061103584828501610f09565b91505092915050565b60006020828403121561105057600080fd5b600061105e84828501610f33565b91505092915050565b6000611073838361108e565b60208301905092915050565b6110888161169c565b82525050565b6110978161169c565b82525050565b60006110a8826115f6565b6110b2818561160e565b93506110bd836115e6565b8060005b838110156110ee5781516110d58882611067565b97506110e083611601565b9250506001810190506110c1565b5085935050505092915050565b611104816116ae565b82525050565b611113816116ba565b82525050565b61112a611125826116ba565b61178a565b82525050565b6111398161171d565b82525050565b600061114c602683611619565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006111b2602583611619565b91507f4e6577657220766572696669636174696f6e207265676973746572656420626560008301527f666f72652e0000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000611218604083611619565b91507f41646472657373206368616e67656420746f6f20726563656e746c792e20576160008301527f697420666f72206e65787420726567697374726174696f6e20706572696f642e6020830152604082019050919050565b600061127e600e83611619565b91507f6e6f7420617574686f72697a65640000000000000000000000000000000000006000830152602082019050919050565b60006112be602083611619565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b60006112fe602883611619565b91507f566572696669636174696f6e20746f6f206f6c642e20547279206c696e6b696e60008301527f6720616761696e2e0000000000000000000000000000000000000000000000006020830152604082019050919050565b611360816116f6565b82525050565b611377611372826116f6565b611794565b82525050565b61138681611700565b82525050565b61139581611710565b82525050565b60006113a78286611119565b6020820191506113b7828561109d565b91506113c38284611366565b602082019150819050949350505050565b60006020820190506113e9600083018461107f565b92915050565b600060208201905061140460008301846110fb565b92915050565b600060208201905061141f600083018461110a565b92915050565b600060808201905061143a600083018761110a565b611447602083018661138c565b611454604083018561110a565b611461606083018461110a565b95945050505050565b600060208201905061147f6000830184611130565b92915050565b6000602082019050818103600083015261149e8161113f565b9050919050565b600060208201905081810360008301526114be816111a5565b9050919050565b600060208201905081810360008301526114de8161120b565b9050919050565b600060208201905081810360008301526114fe81611271565b9050919050565b6000602082019050818103600083015261151e816112b1565b9050919050565b6000602082019050818103600083015261153e816112f1565b9050919050565b600060408201905061155a6000830185611357565b61156760208301846110fb565b9392505050565b6000602082019050611583600083018461137d565b92915050565b6000604051905081810181811067ffffffffffffffff821117156115b0576115af6117cd565b5b8060405250919050565b600067ffffffffffffffff8211156115d5576115d46117cd565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b6000602082019050919050565b600081905092915050565b600082825260208201905092915050565b600061163582611700565b915061164083611700565b92508163ffffffff048311821515161561165d5761165c61179e565b5b828202905092915050565b6000611673826116f6565b915061167e836116f6565b9250828210156116915761169061179e565b5b828203905092915050565b60006116a7826116d6565b9050919050565b60008115159050919050565b6000819050919050565b60006116cf8261169c565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600063ffffffff82169050919050565b600060ff82169050919050565b60006117288261172f565b9050919050565b600061173a826116d6565b9050919050565b600061174c826116f6565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561177f5761177e61179e565b5b600182019050919050565b6000819050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6118058161169c565b811461181057600080fd5b50565b61181c816116ba565b811461182757600080fd5b50565b611833816116c4565b811461183e57600080fd5b50565b61184a816116f6565b811461185557600080fd5b50565b61186181611710565b811461186c57600080fd5b5056fea2646970667358221220be9019254da4073bbb9c7870a93770910bb29c24b46507317a440f351ec991c964736f6c63430008000033