Skip to content

Commit

Permalink
update to solc@0.5.16
Browse files Browse the repository at this point in the history
update waffle version and fix deprecations

move CI from circle to github actions
  • Loading branch information
NoahZinsmeister committed Jan 22, 2020
1 parent 0781322 commit b972227
Show file tree
Hide file tree
Showing 20 changed files with 729 additions and 238 deletions.
25 changes: 0 additions & 25 deletions .circleci/config.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

jobs:
test:
strategy:
matrix:
node: ['10.x', '12.x']
os: [ubuntu-latest, macOS-latest]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- run: npm install -g yarn

- id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ matrix.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ matrix.os }}-yarn-
- run: yarn

- run: yarn lint
- run: yarn compile
- run: yarn test
5 changes: 0 additions & 5 deletions waffle.json → .waffle.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,5 @@
"enabled": true,
"runs": 999999
}
},
"ganacheOptions": {
"hardfork": "istanbul",
"mnemonic": "horn horn horn horn horn horn horn horn horn horn horn horn",
"gasLimit": "0x989680"
}
}
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

## The contents of this GitHub repo are confidential until this disclaimer is removed and the repo is made public

# UniswapV2

[![CircleCI](https://circleci.com/gh/Uniswap/uniswap-v2-core.svg?style=svg)](https://circleci.com/gh/Uniswap/uniswap-v2-core)
[![Actions Status](https://github.com/Uniswap/uniswap-v2-core/workflows/CI/badge.svg)](https://github.com/Uniswap/uniswap-v2-core/actions)

## Local Development

Expand All @@ -28,11 +27,3 @@ yarn
yarn compile
yarn test
```

## Implementation References

- [dapphub math](https://github.com/dapphub/ds-math/blob/de4576712dcf2c5152d16a04e677002d51d46e60/src/math.sol)
- [dapp-bin math](https://github.com/ethereum/dapp-bin/pull/50)
- [OpenZeppelin ECDSA](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/81b1e4810761b088922dbd19a0642873ea581176/contracts/cryptography/ECDSA.sol)
- [OpenZeppelin SafeERC20](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/81b1e4810761b088922dbd19a0642873ea581176/contracts/token/ERC20/SafeERC20.sol)
- [DAI](https://github.com/makerdao/dss/blob/17be7db1c663d8069308c6b78fa5c5f9d71134a3/src/dai.sol)
2 changes: 1 addition & 1 deletion contracts/UniswapV2ERC20.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.5.15;
pragma solidity =0.5.16;

import "./interfaces/IUniswapV2ERC20.sol";
import "./libraries/SafeMath.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/UniswapV2Exchange.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.5.15;
pragma solidity =0.5.16;

import "./interfaces/IUniswapV2Exchange.sol";
import "./UniswapV2ERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/UniswapV2Factory.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.5.15;
pragma solidity =0.5.16;

import "./interfaces/IUniswapV2Factory.sol";
import "./UniswapV2Exchange.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IERC20.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.5.15;
pragma solidity =0.5.16;

interface IERC20 {
event Transfer(address indexed from, address indexed to, uint value);
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IUniswapV2ERC20.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.5.15;
pragma solidity =0.5.16;

interface IUniswapV2ERC20 {
event Transfer(address indexed from, address indexed to, uint value);
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IUniswapV2Exchange.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.5.15;
pragma solidity =0.5.16;

interface IUniswapV2Exchange {
event Mint(address indexed sender, uint amount0, uint amount1);
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IUniswapV2Factory.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.5.15;
pragma solidity =0.5.16;

interface IUniswapV2Factory {
event ExchangeCreated(address indexed token0, address indexed token1, address exchange, uint256);
Expand Down
2 changes: 1 addition & 1 deletion contracts/libraries/Math.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.5.15;
pragma solidity =0.5.16;

library Math {
function min(uint x, uint y) internal pure returns (uint z) {
Expand Down
2 changes: 1 addition & 1 deletion contracts/libraries/SafeMath.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.5.15;
pragma solidity =0.5.16;

library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) {
Expand Down
2 changes: 1 addition & 1 deletion contracts/libraries/UQ112x112.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.5.15;
pragma solidity =0.5.16;

library UQ112x112 {
uint224 constant Q112 = 2**112;
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/GenericERC20.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity 0.5.15;
pragma solidity =0.5.16;

import "../UniswapV2ERC20.sol";

Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"node": ">=10"
},
"dependencies": {
"solc": "0.5.15"
"solc": "0.5.16"
},
"devDependencies": {
"@types/chai": "^4.2.6",
"@types/mocha": "^5.2.7",
"chai": "^4.2.0",
"ethereum-waffle": "2.3.0-istanbul.0",
"ethereum-waffle": "^2.3.1",
"ethereumjs-util": "^6.2.0",
"mocha": "^6.2.2",
"prettier": "^1.19.1",
Expand All @@ -18,9 +18,8 @@
"typescript": "^3.7.3"
},
"scripts": {
"prettier:check": "yarn prettier ./test/*.ts --check",
"prettier:write": "yarn prettier ./test/*.ts --write",
"compile": "rimraf ./build/ && waffle waffle.json",
"lint": "yarn prettier ./test/*.ts --check",
"compile": "rimraf ./build/ && waffle .waffle.json",
"test": "mocha"
},
"license": "GPL-3.0-or-later"
Expand Down
11 changes: 7 additions & 4 deletions test/UniswapV2ERC20.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import path from 'path'
import chai from 'chai'
import { solidity, createMockProvider, getWallets, deployContract } from 'ethereum-waffle'
import { solidity, MockProvider, deployContract } from 'ethereum-waffle'
import { Contract } from 'ethers'
import { MaxUint256 } from 'ethers/constants'
import { bigNumberify, hexlify, keccak256, defaultAbiCoder, toUtf8Bytes } from 'ethers/utils'
Expand All @@ -17,8 +16,12 @@ const TOTAL_SUPPLY = expandTo18Decimals(10000)
const TEST_AMOUNT = expandTo18Decimals(10)

describe('UniswapV2ERC20 via GenericERC20', () => {
const provider = createMockProvider(path.join(__dirname, '..', 'waffle.json'))
const [wallet, other] = getWallets(provider)
const provider = new MockProvider({
hardfork: 'istanbul',
mnemonic: 'horn horn horn horn horn horn horn horn horn horn horn horn',
gasLimit: 9999999
})
const [wallet, other] = provider.getWallets()

let token: Contract
beforeEach(async () => {
Expand Down
11 changes: 7 additions & 4 deletions test/UniswapV2Exchange.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import path from 'path'
import chai from 'chai'
import { solidity, createMockProvider, getWallets, createFixtureLoader } from 'ethereum-waffle'
import { solidity, MockProvider, createFixtureLoader } from 'ethereum-waffle'
import { Contract } from 'ethers'
import { BigNumber, bigNumberify } from 'ethers/utils'

Expand All @@ -16,8 +15,12 @@ const overrides = {
}

describe('UniswapV2Exchange', () => {
const provider = createMockProvider(path.join(__dirname, '..', 'waffle.json'))
const [wallet] = getWallets(provider)
const provider = new MockProvider({
hardfork: 'istanbul',
mnemonic: 'horn horn horn horn horn horn horn horn horn horn horn horn',
gasLimit: 9999999
})
const [wallet] = provider.getWallets()
const loadFixture = createFixtureLoader(provider, [wallet])

let token0: Contract
Expand Down
11 changes: 7 additions & 4 deletions test/UniswapV2Factory.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import path from 'path'
import chai from 'chai'
import { solidity, createMockProvider, getWallets, createFixtureLoader } from 'ethereum-waffle'
import { solidity, MockProvider, createFixtureLoader } from 'ethereum-waffle'
import { Contract } from 'ethers'
import { bigNumberify } from 'ethers/utils'

Expand All @@ -19,8 +18,12 @@ const TEST_ADDRESSES = {
}

describe('UniswapV2Factory', () => {
const provider = createMockProvider(path.join(__dirname, '..', 'waffle.json'))
const [wallet, other] = getWallets(provider)
const provider = new MockProvider({
hardfork: 'istanbul',
mnemonic: 'horn horn horn horn horn horn horn horn horn horn horn horn',
gasLimit: 9999999
})
const [wallet, other] = provider.getWallets()
const loadFixture = createFixtureLoader(provider, [wallet])

let factory: Contract
Expand Down
Loading

0 comments on commit b972227

Please sign in to comment.