Home - second-state/uniswap-v2-core GitHub Wiki

Fix compile error after upgrade to solc 0.8.6

Major changes listed below

https://github.com/ethereum/solidity/blob/develop/Changelog.md#070-2020-07-28
Type checker: Disallow events with same name and parameter types in inheritance hierarchy.

Remove duplicate and conflict events

  • IUniswapV2Pair
    • Approval
    • Transfer
  • UniswapV2ERC20
    • Approval
    • Transfer
  • UniswapV2Factory
    • PairCreated
  • UniswapV2Pair
    • Mint
    • Burn
    • Swap
    • Sync

https://github.com/ethereum/solidity/blob/develop/Changelog.md#060-2019-12-17
General: New reserved keywords: override, receive, and virtual.
https://docs.soliditylang.org/en/latest/contracts.html#function-overriding
The overriding function must then use the override keyword in the function header.

Add override keyword into child contract's functions and state variables if need


1452_error, "Cannot override public state variable." Some functions inherit from bases both public function and public state variable two kinds. But second case couldn't be overridden.

Remove the conflict base contract's virtual functions.

  • IUniswapV2Pair
    • name
    • symbol
    • decimals
    • totalSupply
    • balanceOf
    • allowance
    • approve
    • transfer
    • transferFrom
    • DOMAIN_SEPARATOR
    • PERMIT_TYPEHASH
    • nonces
    • permit

Limitation

Currently SOLL couldn't generate EWASM for constructor with parameters.

Remove parameter in constructor.

  • UniswapV2Factory.sol

Minor changes listed below

  • chainid -> chainid()
  • Explicit type conversion
  • Use type(Type).max replace Type(-1)
⚠️ **GitHub.com Fallback** ⚠️