Blockwell

Uniswap

ERC20

This contract is an ERC20 token.

Name Uniswap
Symbol UNI
Decimals 18
Total Supply 1,000,000,000 UNI

About link

Uniswap (UNI) is a cryptocurrency token and operates on the Ethereum platform. Uniswap has a current supply of 1,000,000,000 with 96,866,285 in circulation. The last known price of Uniswap is $4.12 USD and is down -4.67% over the last 24 hours. It is currently trading on 116 active market(s) with $234,194,979.825 traded over the last 24 hours. More information can be found at https://uniswap.org/blog/uni/.

Stats

Public Functions 12
Event Types 5
Code Size 23,858 bytes

Approval Event

Parameters help
owner
address help
spender
address help
amount
uint256 help

DelegateChanged Event

Parameters help
delegator
address help
fromDelegate
address help
toDelegate
address help

DelegateVotesChanged Event

Parameters help
delegate
address help
previousBalance
uint help
newBalance
uint help

MinterChanged Event

Parameters help
minter
address help
newMinter
address help

Transfer Event

Parameters help
from
address help
to
address help
amount
uint256 help

Checkpoint Event

Members
fromBlock
uint32 help
votes
uint96 help

Functions Expand All Collapse All

setMinter keyboard_arrow_up

Parameters help

Name Type
minter_
address help

Properties

Visibility help public
Mutability help transaction
Source Code
    function setMinter(address minter_) external {
        require(msg.sender == minter, "Uni::setMinter: only the minter can change the minter address");
        emit MinterChanged(minter, minter_);
        minter = minter_;
    }

mint keyboard_arrow_up

Parameters help

Name Type
dst
address help
rawAmount
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
    function mint(address dst, uint rawAmount) external {
        require(msg.sender == minter, "Uni::mint: only the minter can mint");
        require(block.timestamp >= mintingAllowedAfter, "Uni::mint: minting not allowed yet");
        require(dst != address(0), "Uni::mint: cannot transfer to the zero address");

        // record the mint
        mintingAllowedAfter = SafeMath.add(block.timestamp, minimumTimeBetweenMints);

        // mint the amount
        uint96 amount = safe96(rawAmount, "Uni::mint: amount exceeds 96 bits");
        require(amount <= SafeMath.div(SafeMath.mul(totalSupply, mintCap), 100), "Uni::mint: exceeded mint cap");
        totalSupply = safe96(SafeMath.add(totalSupply, amount), "Uni::mint: totalSupply exceeds 96 bits");

        // transfer the amount to the recipient
        balances[dst] = add96(balances[dst], amount, "Uni::mint: transfer amount overflows");
        emit Transfer(address(0), dst, amount);

        // move delegates
        _moveDelegates(address(0), delegates[dst], amount);
    }

allowance keyboard_arrow_up

Parameters help

Name Type
account
address help
spender
address help

Properties

Visibility help public
Mutability help view
Source Code
    function allowance(address account, address spender) external view returns (uint) {
        return allowances[account][spender];
    }

approve keyboard_arrow_up

Parameters help

Name Type
spender
address help
rawAmount
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
    function approve(address spender, uint rawAmount) external returns (bool) {
        uint96 amount;
        if (rawAmount == uint(-1)) {
            amount = uint96(-1);
        } else {
            amount = safe96(rawAmount, "Uni::approve: amount exceeds 96 bits");
        }

        allowances[msg.sender][spender] = amount;

        emit Approval(msg.sender, spender, amount);
        return true;
    }

permit keyboard_arrow_up

Parameters help

Name Type
owner
address help
spender
address help
rawAmount
uint help
deadline
uint help
v
uint8 help
r
bytes32 help
s
bytes32 help

Properties

Visibility help public
Mutability help transaction
Source Code
    function permit(address owner, address spender, uint rawAmount, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
        uint96 amount;
        if (rawAmount == uint(-1)) {
            amount = uint96(-1);
        } else {
            amount = safe96(rawAmount, "Uni::permit: amount exceeds 96 bits");
        }

        bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
        bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, rawAmount, nonces[owner]++, deadline));
        bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
        address signatory = ecrecover(digest, v, r, s);
        require(signatory != address(0), "Uni::permit: invalid signature");
        require(signatory == owner, "Uni::permit: unauthorized");
        require(now <= deadline, "Uni::permit: signature expired");

        allowances[owner][spender] = amount;

        emit Approval(owner, spender, amount);
    }

balanceOf keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
    function balanceOf(address account) external view returns (uint) {
        return balances[account];
    }

transfer keyboard_arrow_up

Parameters help

Name Type
dst
address help
rawAmount
uint help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
    function transfer(address dst, uint rawAmount) external returns (bool) {
        uint96 amount = safe96(rawAmount, "Uni::transfer: amount exceeds 96 bits");
        _transferTokens(msg.sender, dst, amount);
        return true;
    }

transferFrom keyboard_arrow_up

Parameters help

Name Type
src
address help
dst
address help
rawAmount
uint help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
    function transferFrom(address src, address dst, uint rawAmount) external returns (bool) {
        address spender = msg.sender;
        uint96 spenderAllowance = allowances[src][spender];
        uint96 amount = safe96(rawAmount, "Uni::approve: amount exceeds 96 bits");

        if (spender != src && spenderAllowance != uint96(-1)) {
            uint96 newAllowance = sub96(spenderAllowance, amount, "Uni::transferFrom: transfer amount exceeds spender allowance");
            allowances[src][spender] = newAllowance;

            emit Approval(src, spender, newAllowance);
        }

        _transferTokens(src, dst, amount);
        return true;
    }

delegate keyboard_arrow_up

Parameters help

Name Type
delegatee
address help

Properties

Visibility help public
Mutability help transaction
Source Code
    function delegate(address delegatee) public {
        return _delegate(msg.sender, delegatee);
    }

delegateBySig keyboard_arrow_up

Parameters help

Name Type
delegatee
address help
nonce
uint help
expiry
uint help
v
uint8 help
r
bytes32 help
s
bytes32 help

Properties

Visibility help public
Mutability help transaction
Source Code
    function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {
        bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
        bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
        bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
        address signatory = ecrecover(digest, v, r, s);
        require(signatory != address(0), "Uni::delegateBySig: invalid signature");
        require(nonce == nonces[signatory]++, "Uni::delegateBySig: invalid nonce");
        require(now <= expiry, "Uni::delegateBySig: signature expired");
        return _delegate(signatory, delegatee);
    }

getCurrentVotes keyboard_arrow_up

Parameters help

Name Type
account
address help

Properties

Visibility help public
Mutability help view
Source Code
    function getCurrentVotes(address account) external view returns (uint96) {
        uint32 nCheckpoints = numCheckpoints[account];
        return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
    }

getPriorVotes keyboard_arrow_up

Parameters help

Name Type
account
address help
blockNumber
uint help

Properties

Visibility help public
Mutability help view

Requirements help

Source Code
    function getPriorVotes(address account, uint blockNumber) public view returns (uint96) {
        require(blockNumber < block.number, "Uni::getPriorVotes: not yet determined");

        uint32 nCheckpoints = numCheckpoints[account];
        if (nCheckpoints == 0) {
            return 0;
        }

        // First check most recent balance
        if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
            return checkpoints[account][nCheckpoints - 1].votes;
        }

        // Next check implicit zero balance
        if (checkpoints[account][0].fromBlock > blockNumber) {
            return 0;
        }

        uint32 lower = 0;
        uint32 upper = nCheckpoints - 1;
        while (upper > lower) {
            uint32 center = upper - (upper - lower) / 2; // ceil, avoiding overflow
            Checkpoint memory cp = checkpoints[account][center];
            if (cp.fromBlock == blockNumber) {
                return cp.votes;
            } else if (cp.fromBlock < blockNumber) {
                lower = center;
            } else {
                upper = center - 1;
            }
        }
        return checkpoints[account][lower].votes;
    }