forked from Uniswap/v2-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test in typescript add GPL license pin solc version add CI
- Loading branch information
1 parent
9c4b7cc
commit f5c1963
Showing
15 changed files
with
1,008 additions
and
380 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
version: 2 | ||
jobs: | ||
build: | ||
docker: | ||
- image: circleci/node:10 | ||
steps: | ||
- checkout | ||
|
||
- restore_cache: | ||
keys: | ||
- v1-dependencies-{{ checksum "package.json" }} | ||
- v1-dependencies- | ||
|
||
- run: yarn | ||
|
||
- save_cache: | ||
key: v1-dependencies-{{ checksum "package.json" }} | ||
paths: | ||
- node_modules | ||
|
||
- run: yarn prettier:check | ||
|
||
- run: yarn compile | ||
|
||
- run: yarn test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
*.sol linguist-language=Solidity | ||
*.sol linguist-language=Solidity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
node_modules/ | ||
build/ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"extension": ["ts"], | ||
"spec": "./test/**/*.ts", | ||
"require": "ts-node/register" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"semi": false, | ||
"singleQuote": true, | ||
"printWidth": 120 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
## Installation: | ||
# Uniswap v2 Smart Contracts | ||
|
||
## Development | ||
|
||
### Clone | ||
|
||
1) Clone Uniswap | ||
``` | ||
$ git clone https://github.com/Uniswap/uniswap-v2 | ||
$ cd uniswap-v2 | ||
git clone https://github.com/Uniswap/uniswap-v2.git | ||
cd uniswap-v2 | ||
``` | ||
|
||
2) Install dependencies | ||
### Install Dependencies | ||
``` | ||
yarn | ||
``` | ||
|
||
3) Run tests | ||
### Compile Contracts and Run Tests | ||
``` | ||
yarn compile | ||
yarn test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
{ | ||
"engines": { | ||
"node": "^10" | ||
}, | ||
"dependencies": { | ||
"solc": "^0.5.11" | ||
"solc": "0.5.12" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^4.2.3", | ||
"@types/mocha": "^5.2.7", | ||
"chai": "^4.2.0", | ||
"ethereum-waffle": "^2.1.0", | ||
"mocha": "^6.2.0" | ||
"mocha": "^6.2.2", | ||
"prettier": "^1.18.2", | ||
"ts-node": "^8.4.1", | ||
"typescript": "^3.6.4" | ||
}, | ||
"scripts": { | ||
"test": "waffle && mocha" | ||
} | ||
"prettier:check": "yarn prettier ./test/*.ts --check", | ||
"prettier:write": "yarn prettier ./test/*.ts --write", | ||
"compile": "rm -rf ./build/ && waffle waffle.json", | ||
"test": "mocha" | ||
}, | ||
"license": "GPL-3.0-or-later" | ||
} |
Empty file.
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import chai from 'chai' | ||
import { createMockProvider, deployContract, getWallets, solidity } from 'ethereum-waffle' | ||
import { Contract } from 'ethers' | ||
|
||
import TestTokenMock from '../build/TestERC20.json' | ||
|
||
chai.use(solidity) | ||
const { expect } = chai | ||
|
||
describe('INTEGRATION: Example', () => { | ||
const provider = createMockProvider() | ||
const [wallet, walletTo] = getWallets(provider) | ||
let token: Contract | ||
|
||
beforeEach(async () => { | ||
token = await deployContract(wallet, TestTokenMock, ['HayCoin', 'HAY', 18, 1000]) | ||
}) | ||
|
||
it('Is named HayCoin', async () => { | ||
expect(await token.name()).to.eq('HayCoin') | ||
}) | ||
|
||
it('Assigns initial balance', async () => { | ||
expect(await token.balanceOf(wallet.address)).to.eq(1000) | ||
}) | ||
|
||
it('Transfer adds amount to destination account', async () => { | ||
await token.transfer(walletTo.address, 7) | ||
expect(await token.balanceOf(walletTo.address)).to.eq(7) | ||
}) | ||
|
||
it('Transfer emits event', async () => { | ||
await expect(token.transfer(walletTo.address, 7)) | ||
.to.emit(token, 'Transfer') | ||
.withArgs(wallet.address, walletTo.address, 7) | ||
}) | ||
|
||
it('Can not transfer above the amount', async () => { | ||
await expect(token.transfer(walletTo.address, 1007)).to.be.reverted | ||
}) | ||
|
||
it('Can not transfer from empty account', async () => { | ||
const tokenFromOtherWallet = token.connect(walletTo) | ||
await expect(tokenFromOtherWallet.transfer(wallet.address, 1)).to.be.reverted | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"module": "commonjs", | ||
"strict": true, | ||
"esModuleInterop": true, | ||
"resolveJsonModule": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"solcVersion": "./node_modules/solc" | ||
} |
Oops, something went wrong.