[UNI-V2-DAI-ETH] ERC20 Token Smart Contract Technical Assessment

[UNI-V2-DAI-ETH] ERC20 Token Smart Contract Technical Assessment

General Information

Risk Summary

  • Does the contract implement the ERC20 token standards? Yes.
  • Risk analysis : LOW.

Technical Information

  • Compiler version : v0.5.16+commit.9c3226ce
  • Decimals : 18
  • Overflow checks : Yes, the contract uses the SafeMath library for uint operations.
  • Mitigation against allowance race-condition : No.
  • Upgradeable contract patterns : No.
  • Access control or restriction lists : No.
  • Non-standard features or behaviors : No.

Formal Verification Considerations:

  • Does transfer have simple semantics? Yes.
  • Does transferFrom have simple semantics? Yes.
  • Can balances be arbitrarily modified by some actor? No.
  • Are there any external calls? No.

Testnet Information

  • Uniswap is deployed on Ropsten, Rinkeby, Gorli and Kovan. List of relevant addresses here.

Contract Logic Summary

Administrative Addresses

  • Fee Setter: 0x5e4be8Bc9637f0EAA1A755019e06A68ce081D58F
    • Fee setter can turn fees on and off and set the target address that recieves fees. This address is controlled by Uniswap Governance and is behind a time lock of 48 hours.

Inheritance Structure

UNI-V2-DAI-ETH uses custom minting/burning logic in UniswapV2Pair which extends UniswapV2ERC20.

Other

UniswapV2ERC20 also implements permit for gasless transactions.

Contract Risk Summary

This is a low risk contract. The ERC20 functions are implemented to industry standard, there are checks to prevent over/underflows, and the contract is non-upgradeable. Uniswap LP tokens are very safe by themselves. The risk comes from the underlying tokens. Both ETH and DAI are safe from a smart contract point of view.

Supporting Materials

Architecture Diagram

Inheritance Diagram

Sūrya’s Description Report

Files Description Table

File Name SHA-1 Hash
UniswapV2Pair-All.sol f5e7366252c794b5fe2bf7bd2c1ce82240138de2

Contracts Description Table

Contract Type Bases
Function Name Visibility Mutability Modifiers
IUniswapV2Pair Interface
name External :exclamation: NO❗️
symbol External :exclamation: NO❗️
decimals External :exclamation: NO❗️
totalSupply External :exclamation: NO❗️
balanceOf External :exclamation: NO❗️
allowance External :exclamation: NO❗️
approve External :exclamation: :stop_sign: NO❗️
transfer External :exclamation: :stop_sign: NO❗️
transferFrom External :exclamation: :stop_sign: NO❗️
DOMAIN_SEPARATOR External :exclamation: NO❗️
PERMIT_TYPEHASH External :exclamation: NO❗️
nonces External :exclamation: NO❗️
permit External :exclamation: :stop_sign: NO❗️
MINIMUM_LIQUIDITY External :exclamation: NO❗️
factory External :exclamation: NO❗️
token0 External :exclamation: NO❗️
token1 External :exclamation: NO❗️
getReserves External :exclamation: NO❗️
price0CumulativeLast External :exclamation: NO❗️
price1CumulativeLast External :exclamation: NO❗️
kLast External :exclamation: NO❗️
mint External :exclamation: :stop_sign: NO❗️
burn External :exclamation: :stop_sign: NO❗️
swap External :exclamation: :stop_sign: NO❗️
skim External :exclamation: :stop_sign: NO❗️
sync External :exclamation: :stop_sign: NO❗️
initialize External :exclamation: :stop_sign: NO❗️
IUniswapV2ERC20 Interface
name External :exclamation: NO❗️
symbol External :exclamation: NO❗️
decimals External :exclamation: NO❗️
totalSupply External :exclamation: NO❗️
balanceOf External :exclamation: NO❗️
allowance External :exclamation: NO❗️
approve External :exclamation: :stop_sign: NO❗️
transfer External :exclamation: :stop_sign: NO❗️
transferFrom External :exclamation: :stop_sign: NO❗️
DOMAIN_SEPARATOR External :exclamation: NO❗️
PERMIT_TYPEHASH External :exclamation: NO❗️
nonces External :exclamation: NO❗️
permit External :exclamation: :stop_sign: NO❗️
SafeMath Library
add Internal :lock:
sub Internal :lock:
mul Internal :lock:
UniswapV2ERC20 Implementation IUniswapV2ERC20
Public :exclamation: :stop_sign: NO❗️
_mint Internal :lock: :stop_sign:
_burn Internal :lock: :stop_sign:
_approve Private :closed_lock_with_key: :stop_sign:
_transfer Private :closed_lock_with_key: :stop_sign:
approve External :exclamation: :stop_sign: NO❗️
transfer External :exclamation: :stop_sign: NO❗️
transferFrom External :exclamation: :stop_sign: NO❗️
permit External :exclamation: :stop_sign: NO❗️
Math Library
min Internal :lock:
sqrt Internal :lock:
UQ112x112 Library
encode Internal :lock:
uqdiv Internal :lock:
IERC20 Interface
name External :exclamation: NO❗️
symbol External :exclamation: NO❗️
decimals External :exclamation: NO❗️
totalSupply External :exclamation: NO❗️
balanceOf External :exclamation: NO❗️
allowance External :exclamation: NO❗️
approve External :exclamation: :stop_sign: NO❗️
transfer External :exclamation: :stop_sign: NO❗️
transferFrom External :exclamation: :stop_sign: NO❗️
IUniswapV2Factory Interface
feeTo External :exclamation: NO❗️
feeToSetter External :exclamation: NO❗️
getPair External :exclamation: NO❗️
allPairs External :exclamation: NO❗️
allPairsLength External :exclamation: NO❗️
createPair External :exclamation: :stop_sign: NO❗️
setFeeTo External :exclamation: :stop_sign: NO❗️
setFeeToSetter External :exclamation: :stop_sign: NO❗️
IUniswapV2Callee Interface
uniswapV2Call External :exclamation: :stop_sign: NO❗️
UniswapV2Pair Implementation IUniswapV2Pair, UniswapV2ERC20
getReserves Public :exclamation: NO❗️
_safeTransfer Private :closed_lock_with_key: :stop_sign:
Public :exclamation: :stop_sign: NO❗️
initialize External :exclamation: :stop_sign: NO❗️
_update Private :closed_lock_with_key: :stop_sign:
_mintFee Private :closed_lock_with_key: :stop_sign:
mint External :exclamation: :stop_sign: lock
burn External :exclamation: :stop_sign: lock
swap External :exclamation: :stop_sign: lock
skim External :exclamation: :stop_sign: lock
sync External :exclamation: :stop_sign: lock

Legend

Symbol Meaning
:stop_sign: Function can modify state
:dollar: Function is payable
5 Likes