-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from platon-uniswap/main
Add uniswap v2 doc
- Loading branch information
Showing
4 changed files
with
549 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
Community_Verification_Event(First)/UniswapV2_Migration_verification/contracts.md
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,55 @@ | ||
## 合约 | ||
|
||
环境 | ||
ubuntu 1804 | ||
|
||
|
||
## 准备条件 | ||
|
||
需要创建一个钱包,导出私钥,在每个合约仓库根目录有一个.env配置文件。修改私钥环境变量。去水龙头领测试的LAT | ||
|
||
### 部署uniswap核心合约 | ||
|
||
``` | ||
$ git clone https://github.com/platon-uniswap/uniswap-v2-core.git | ||
$ cd uniswap-v2-core | ||
$ npm i | ||
$ npx hardhat --network alaya_dev run scripts/01-deploy-factory.js // 部署工厂合约并得到地址 | ||
$ npx hardhat --network alaya_dev run scripts/02-init-code-hash.js // 得到initcodehash,用户计算pair的地址 | ||
$ npx hardhat --network alaya_dev run scripts/03-deploy-test-coin.js // 部署USDT测试合约地址 | ||
``` | ||
|
||
### 部署uniswap周边合约 | ||
|
||
``` | ||
$ git clone https://github.com/platon-uniswap/uniswap-v2-periphery.git | ||
$ cd uniswap-v2-periphery | ||
$ npm i | ||
$ npx hardhat --network alaya_dev run scripts/01-deploy-weth.js // 部署WETH合约 | ||
$ npx hardhat --network alaya_dev run scripts/02-deploy-router.js // 修改factory和weth合约地址,部署router02合约 | ||
``` | ||
|
||
### 部署UNI和治理合约 | ||
|
||
``` | ||
$ git clone https://github.com/platon-uniswap/governance.git | ||
$ cd governance | ||
$ npm i | ||
$ npx hardhat --network alaya_dev run scripts/01-deploy-uni.js | ||
$ npx hardhat --network alaya_dev run scripts/02-deploy-timelock.js // 部署时间锁合约,预计算治理合约地址 | ||
$ npx hardhat --network alaya_dev run scripts/03-deploy-gov.js // 修改文件,替换前一步timelock合约地址,部署治理合约地址,若部署失败,需要从上一步重新开始 | ||
$ npx hardhat --network alaya_dev run scripts/06-propose.js // 修改发起提案,如增发UNI,需要将uni的owner设置为timelock先 | ||
``` | ||
|
||
### 部署流动性挖矿合约 | ||
|
||
``` | ||
$ git clone https://github.com/platon-uniswap/liquidity-staker.git | ||
$ cd liquidity-staker | ||
$ npm i | ||
$ npx hardhat --network alaya_dev run scripts/01-deploy-factory.js // 编辑文件,修改奖励地址为上述UNI的地址 | ||
$ npx hardhat --network alaya_dev run scripts/02-deploy-staking.js // 编辑文件,替换factory合约地址为前一步生成的合约地址,替换stakingToken为WETHUSDT的pair地址。 | ||
$ npx hardhat --network alaya_dev run scripts/03-notify-reward.js // 给池子转UNI奖励代币。开始流动性挖矿 | ||
``` |
127 changes: 127 additions & 0 deletions
127
Community_Verification_Event(First)/UniswapV2_Migration_verification/info.md
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,127 @@ | ||
# PlatOn Uniswap Info (V2) | ||
|
||
website:https://devnet-info.ddex.cc/ | ||
|
||
code: https://github.com/platon-uniswap/info | ||
|
||
|
||
|
||
### To Start Development | ||
|
||
#### Git clone | ||
|
||
~~~bash | ||
$ git clone https://github.com/platon-uniswap/info.git | ||
~~~ | ||
|
||
#### Installing dependencies | ||
|
||
```bash | ||
$ yarn | ||
``` | ||
|
||
#### Running locally | ||
|
||
```bash | ||
$ yarn start | ||
``` | ||
|
||
|
||
|
||
### 部署 | ||
|
||
#### 修改自己部署的请求链接 | ||
|
||
**src/apollo/client.js 第7、15、39行** | ||
|
||
```javascript | ||
export const client = new ApolloClient({ | ||
link: new HttpLink({ | ||
uri: '自我部署链接', | ||
}), | ||
cache: new InMemoryCache(), | ||
shouldBatch: true, | ||
}) | ||
|
||
export const healthClient = new ApolloClient({ | ||
link: new HttpLink({ | ||
uri: '自我部署链接', | ||
}), | ||
cache: new InMemoryCache(), | ||
shouldBatch: true, | ||
}) | ||
|
||
export const blockClient = new ApolloClient({ | ||
link: new HttpLink({ | ||
uri: '自我部署链接', | ||
}), | ||
cache: new InMemoryCache(), | ||
}) | ||
``` | ||
|
||
**src/apollo/queres.js 第6行** | ||
|
||
~~~javascript | ||
export const SUBGRAPH_HEALTH = gql` | ||
query health { | ||
indexingStatusForCurrentVersion(subgraphName: "自我部署名称") { | ||
synced | ||
health | ||
chains { | ||
chainHeadBlock { | ||
number | ||
} | ||
latestBlock { | ||
number | ||
} | ||
} | ||
} | ||
} | ||
` | ||
~~~ | ||
|
||
#### 修改FACTORY_ADDRESS | ||
|
||
~~~javascript | ||
// src/constants/index.js 第一行 | ||
export const FACTORY_ADDRESS = '0x154b2f6202a5033Cb150931177B86a2B03E485dF' | ||
~~~ | ||
|
||
#### Installing dependencies | ||
|
||
```bash | ||
$ yarn | ||
``` | ||
|
||
#### Build | ||
|
||
```bash | ||
$ yarn build | ||
``` | ||
|
||
#### Nginx 部署 | ||
|
||
~~~ | ||
server { | ||
listen 8080; | ||
server_name localhost; | ||
location / { | ||
// 编译文件路径地址 | ||
root .../info/build; | ||
index index.html index.htm; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root html; | ||
} | ||
} | ||
~~~ | ||
|
||
nginx重新reload: | ||
|
||
```bash | ||
$ nginx -s reload | ||
``` |
Oops, something went wrong.