Skip to content

Commit

Permalink
Merge pull request #199 from humanprotocol/feature/contracts-deployment
Browse files Browse the repository at this point in the history
Deploy contracts with proxies on Mumbai
  • Loading branch information
portuu3 authored Jan 27, 2023
2 parents 40c1385 + 927fc4d commit 17e2180
Show file tree
Hide file tree
Showing 10 changed files with 236 additions and 38 deletions.
116 changes: 104 additions & 12 deletions CONTRACTS_LIST.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,106 @@
# Contract addresses by network

| | Network Type | Status | HMTToken | Proxy | EscrowFactory | Staking | KVStore |
|---------------------|--------------|------------|--------------------------------------------|-------|--------------------------------------------|---------|--------------------------------------------|
| Polygon | Mainnet | Active | 0xc748B2A084F8eFc47E086ccdDD9b7e67aEb571BF | | 0x45eBc3eAE6DA485097054ae10BA1A0f8e8c7f794 | | 0x6334dB76037bb6d4bc21901433E870b22ACa1F9a |
| Mumbai | Testnet | Active | 0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4 | | 0x558cd800f9F0B02f3B149667bDe003284c867E94 | | 0x32e27177BA6Ea91cf28dfd91a0Da9822A4b74EcF |
| Goerli | Testnet | Active | 0xd3A31D57FDD790725d0F6B78095F62E8CD4ab317 | | 0xaAe6a2646C1F88763E62e0cD08aD050Ea66AC46F | | |
| Rinkeby | Testnet | Deprecated | 0x4dCf5ac4509888714dd43A5cCc46d7ab389D9c23 | | 0x925B24444511c86F4d4E63141D8Be0A025E2dca4 | | |
| Binance Smart Chain | Mainnet | Active | 0x0d501B743F22b641B8C8dfe00F1AAb881D57DDC7 | | 0xc88bC422cAAb2ac8812de03176402dbcA09533f4 | | 0x8340412Ed68BcF53a7Da72BFFc1E2E74CfdE74D0 |
| Binance Smart Chain | Testnet | Active | 0xd3a31d57fdd790725d0f6b78095f62e8cd4ab317 | | 0xaae6a2646c1f88763e62e0cd08ad050ea66ac46f | | 0x7676F326f1e30E96a76B7F1a860d56A9ac988a7d |
| Moonbeam | Mainnet | Active | 0x3b25BC1dC591D24d60560d0135D6750A561D4764 | | 0x98108c28B7767a52BE38B4860832dd4e11A7ecad | | 0x6617d21ab0f16A7079e2811Cf9306CAe7018bDd9 |
| Moonbeam Alpha | Testnet | Active | 0xe4C8eC5d057EacF40060b2174627a4941a5c8127 | | 0x3Cd0B117Be4CC1e31c8d7d1eD8b32208a2820902 | | 0x64009ca5fb4b34769F7240c6073FEc34bf5b64E3 |
| Avalanche | Mainnet | Active | 0x12365293cb6477d4fc2686e46bb97e3fb64f1550 | | 0x9767a578ba7a5FA1563c8229943cB01cd8446BB4 | | 0x4B79eaD28F52eD5686bf0e379717e85fc7aD10Df |
| Avalanche Fuji | Testnet | Active | 0x9406d5c635AD22b0d76c75E52De57A2177919ca3 | | 0xfb4469201951C3B9a7F1996c477cb7BDBEcE0A88 | | 0xd232c1426CF0653cE8a71DC98bCfDf10c471c114 |

| Polygon (Mainnet) | Contract | Address | Proxy |
|--------------------------|----------------|--------------------------------------------|--------------------------------------------|
|2021/10/13 | HMToken | 0xc748B2A084F8eFc47E086ccdDD9b7e67aEb571BF | N/A |
|2022/02/28 | EscrowFactory | 0x45eBc3eAE6DA485097054ae10BA1A0f8e8c7f794 | |
| | Staking | | |
| | RewardPool | | |
|2022/03/01 | EthKVStore | 0x6334dB76037bb6d4bc21901433E870b22ACa1F9a | N/A |
| | Reputation | | |

| Polygon Mumbai (Testnet) | Contract | Address | Proxy |
|--------------------------|----------------|--------------------------------------------|--------------------------------------------|
|2022/04/25 | HMToken | 0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4 | N/A |
|2023/01/26 | EscrowFactory | 0xd319e761b632E39234E68247D307818a20158890 | 0xA8D927C4DA17A6b71675d2D49dFda4E9eBE58f2d |
|2023/01/26 | Staking | 0x19Fc3e859C1813ac9427a7a78BeB9ae102CE96d3 | 0x7Fd3dF914E7b6Bd96B4c744Df32183b51368Bfac |
|2023/01/26 | RewardPool | 0x295514FC4C812Db24C3277d6D3175956AdEA273C | 0xf0145eD99AC3c4f877aDa7dA4D1E059ec9116BAE |
|2023/01/26 | EthKVStore | 0xD7F61E812e139a5a02eDae9Dfec146E1b8eA3807 | N/A |
|2023/01/26 | Reputation | 0x7B9f9Dc6c157899C1Eb1c6B86f94855cC2F537dF | 0xC522463d36f76b881bE66484e3068F11e7038Ace |

| Goerli (Testnet) | Contract | Address | Proxy |
|--------------------------|----------------|--------------------------------------------|--------------------------------------------|
|2022/10/12 | HMToken | 0xd3A31D57FDD790725d0F6B78095F62E8CD4ab317 | N/A |
|2022/10/12 | EscrowFactory | 0xaAe6a2646C1F88763E62e0cD08aD050Ea66AC46F | |
| | Staking | | |
| | RewardPool | | |
| | EthKVStore | | N/A |
| | Reputation | | |

| Rinkeby (Testnet) | Contract | Address | Proxy |
|--------------------------|----------------|--------------------------------------------|--------------------------------------------|
|2020/09/15 | HMToken | 0x4dCf5ac4509888714dd43A5cCc46d7ab389D9c23 | N/A |
|2021/03/05 | EscrowFactory | 0x925B24444511c86F4d4E63141D8Be0A025E2dca4 | |
| | Staking | | |
| | RewardPool | | |
| | EthKVStore | | N/A |
| | Reputation | | |

| Binance SC (Mainnet) | Contract | Address | Proxy |
|--------------------------|----------------|--------------------------------------------|--------------------------------------------|
|2022/08/18 | HMToken | 0x0d501B743F22b641B8C8dfe00F1AAb881D57DDC7 | N/A |
|2022/08/23 | EscrowFactory | 0xc88bC422cAAb2ac8812de03176402dbcA09533f4 | |
| | Staking | | |
| | RewardPool | | |
|2022/08/23 | EthKVStore | 0x8340412Ed68BcF53a7Da72BFFc1E2E74CfdE74D0 | N/A |
| | Reputation | | |

| Binance SC (Testnet) | Contract | Address | Proxy |
|--------------------------|----------------|--------------------------------------------|--------------------------------------------|
|2022/10/12 | HMToken | 0xd3a31d57fdd790725d0f6b78095f62e8cd4ab317 | N/A |
|2022/10/12 | EscrowFactory | 0xaae6a2646c1f88763e62e0cd08ad050ea66ac46f | |
| | Staking | | |
| | RewardPool | | |
|2022/08/12 | EthKVStore | 0x7676F326f1e30E96a76B7F1a860d56A9ac988a7d | N/A |
| | Reputation | | |

| Moonbeam (Mainnet) | Contract | Address | Proxy |
|--------------------------|----------------|--------------------------------------------|--------------------------------------------|
|2022/05/26 | HMToken | 0x3b25BC1dC591D24d60560d0135D6750A561D4764 | N/A |
|2022/06/01 | EscrowFactory | 0x98108c28B7767a52BE38B4860832dd4e11A7ecad | |
| | Staking | | |
| | RewardPool | | |
|2022/06/01 | EthKVStore | 0x6617d21ab0f16A7079e2811Cf9306CAe7018bDd9 | N/A |
| | Reputation | | |

| Moonbeam Alpha (Testnet) | Contract | Address | Proxy |
|--------------------------|----------------|--------------------------------------------|--------------------------------------------|
|2022/05/31 | HMToken | 0xe4C8eC5d057EacF40060b2174627a4941a5c8127 | N/A |
|2022/05/31 | EscrowFactory | 0x3Cd0B117Be4CC1e31c8d7d1eD8b32208a2820902 | |
| | Staking | | |
| | RewardPool | | |
|2022/05/31 | EthKVStore | 0x64009ca5fb4b34769F7240c6073FEc34bf5b64E3 | N/A |
| | Reputation | | |

| Avalanche (Mainnet) | Contract | Address | Proxy |
|--------------------------|----------------|--------------------------------------------|--------------------------------------------|
|2022/09/29 | HMToken | 0x12365293cb6477d4fc2686e46bb97e3fb64f1550 | N/A |
|2022/12/03 | EscrowFactory | 0x9767a578ba7a5FA1563c8229943cB01cd8446BB4 | |
| | Staking | | |
| | RewardPool | | |
|2022/11/17 | EthKVStore | 0x4B79eaD28F52eD5686bf0e379717e85fc7aD10Df | N/A |
| | Reputation | | |

| Avalanche Fuji (Testnet) | Contract | Address | Proxy |
|--------------------------|----------------|--------------------------------------------|--------------------------------------------|
|2022/10/23 | HMToken | 0x9406d5c635AD22b0d76c75E52De57A2177919ca3 | N/A |
|2022/10/24 | EscrowFactory | 0xfb4469201951C3B9a7F1996c477cb7BDBEcE0A88 | |
| | Staking | | |
| | RewardPool | | |
|2022/10/24 | EthKVStore | 0xd232c1426CF0653cE8a71DC98bCfDf10c471c114 | N/A |
| | Reputation | | |




# Old contracts


| Polygon Mumbai (Testnet) | Contract | Address | Proxy |
|--------------------------|----------------|--------------------------------------------|--------------------------------------------|
|2022/04/25 | HMToken | 0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4 | N/A |
|2022/04/25 | EscrowFactory | 0x558cd800f9F0B02f3B149667bDe003284c867E94 | |
|2022/04/29 | EthKVStore | 0x32e27177BA6Ea91cf28dfd91a0Da9822A4b74EcF | N/A |
|2023/01/17 | Staking | 0x76E2EF2E177097E0b296E1e305d69Fe8Bae5f774 | 0xf421fD3eB97982C205966ebB514Ab2E435c6d5B7 |
|2023/01/17 | EthKVStore | 0x459EE403d060B84b5014605D6739cCFed32AFb96 | N/A |
5 changes: 3 additions & 2 deletions packages/apps/escrow-dashboard/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ export const ESCROW_NETWORKS: {
title: 'Polygon Mumbai',
scanUrl: 'https://mumbai.polygonscan.com',
rpcUrl: 'https://rpc-mumbai.maticvigil.com',
subgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/mumbai',
factoryAddress: '0x558cd800f9F0B02f3B149667bDe003284c867E94',
subgraphUrl:
'https://api.thegraph.com/subgraphs/name/humanprotocol/mumbai-v1',
factoryAddress: '0xA8D927C4DA17A6b71675d2D49dFda4E9eBE58f2d',
hmtAddress: '0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4',
},
[ChainId.MOONBEAM]: {
Expand Down
24 changes: 24 additions & 0 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,27 @@
- Escrow

- EscrowFactory


# Deploy contracts with proxy to a live network

1. Create a .env file in the root folder of core package, with the following variables(this is an example for Polygon Mumbai, for other networks `check hardhat.config.ts`):

```bash
ETH_POLYGON_MUMBAI_URL=
PRIVATE_KEY=
HMT_ADDRESS=
POLYGONSCAN_API_KEY=
```
2. Open `./scripts/deploy-proxies.ts` and check if you actually need to deploy all the contracts this script deploys.

3. Deploy the contracts runing this ([NETWORK_NAME] = network name from `hardhat.config.ts`):

```bash
yarn deploy:proxy --network [NETWORK_NAME]
```
4. Verify every contract runing the following line for each contract address(have in mind that for contract with proxy, first you need to validate the implementation):
```bash
npx hardhat verify [CONTRACT_ADDRESS] --network [NETWORK_NAME]
```
5. Update the file `CONTRACTS_LIST.md` in the root of this monorepo.
2 changes: 1 addition & 1 deletion packages/core/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ task(
const config: HardhatUserConfig = {
solidity: {
version: '0.8.9',
settings: { optimizer: { enabled: true, runs: 4294967295 } },
settings: { optimizer: { enabled: true, runs: 1000000 } },
},
defaultNetwork: 'hardhat',
networks: {
Expand Down
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"local": "concurrently --hide 0 \"hardhat node\" \"yarn deploy:local\"",
"deploy": "hardhat run scripts/deploy.ts",
"deploy:local": "yarn deploy --network localhost",
"deploy:proxy": "hardhat run scripts/deploy-proxies.ts",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"format:contracts": "prettier --write '**/*.sol'",
Expand Down
79 changes: 79 additions & 0 deletions packages/core/scripts/deploy-proxies.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/* eslint-disable no-console */
import { Console } from 'console';
import { ethers, upgrades } from 'hardhat';

async function main() {
const hmtAddress = process.env.HMT_ADDRESS;
if (!hmtAddress) {
console.error('HMT_ADDRESS env variable missing');
return;
}

const Staking = await ethers.getContractFactory('Staking');
const stakingContract = await upgrades.deployProxy(
Staking,
[hmtAddress, 1, 1],
{ initializer: 'initialize', kind: 'uups' }
);
await stakingContract.deployed();
console.log('Staking Proxy Address: ', stakingContract.address);
console.log(
'Staking Implementation Address: ',
await upgrades.erc1967.getImplementationAddress(stakingContract.address)
);

const EscrowFactory = await ethers.getContractFactory('EscrowFactory');
const escrowFactoryContract = await upgrades.deployProxy(
EscrowFactory,
[stakingContract.address],
{ initializer: 'initialize', kind: 'uups' }
);
await escrowFactoryContract.deployed();
console.log('Escrow Factory Proxy Address: ', escrowFactoryContract.address);
console.log(
'Escrow Factory Implementation Address: ',
await upgrades.erc1967.getImplementationAddress(
escrowFactoryContract.address
)
);

const KVStore = await ethers.getContractFactory('KVStore');
const kvStoreContract = await KVStore.deploy();
await kvStoreContract.deployed();

console.log('KVStore Address: ', kvStoreContract.address);

const RewardPool = await ethers.getContractFactory('RewardPool');
const rewardPoolContract = await upgrades.deployProxy(
RewardPool,
[hmtAddress, stakingContract.address, 1],
{ initializer: 'initialize', kind: 'uups' }
);
await rewardPoolContract.deployed();
console.log('Reward Pool Proxy Address: ', rewardPoolContract.address);
console.log(
'Reward Pool Implementation Address: ',
await upgrades.erc1967.getImplementationAddress(rewardPoolContract.address)
);

// Configure RewardPool in Staking
await stakingContract.setRewardPool(rewardPoolContract.address);

const Reputation = await ethers.getContractFactory('Reputation');
const reputationContract = await upgrades.deployProxy(
Reputation,
[stakingContract.address, 1],
{ initializer: 'initialize', kind: 'uups' }
);
await reputationContract.deployed();
console.log('Reputation Proxy Address: ', reputationContract.address);
console.log(
'Reputation Implementation Address: ',
await upgrades.erc1967.getImplementationAddress(reputationContract.address)
);
}

main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
1 change: 0 additions & 1 deletion packages/core/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ async function main() {
{ initializer: 'initialize', kind: 'uups' }
);
await rewardPoolContract.deployed();
console.log('Reward Pool Contract Address:', rewardPoolContract.address);
console.log('Reward Pool Proxy Address: ', rewardPoolContract.address);
console.log(
'Reward Pool Implementation Address: ',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const ESCROW_NETWORKS: {
chainId: ChainId.POLYGON_MUMBAI,
title: 'Polygon Mumbai',
rpcUrl: 'https://rpc-mumbai.maticvigil.com',
factoryAddress: '0x558cd800f9F0B02f3B149667bDe003284c867E94',
factoryAddress: '0xA8D927C4DA17A6b71675d2D49dFda4E9eBE58f2d',
hmtAddress: '0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4',
},
[ChainId.LOCALHOST]: {
Expand Down
Loading

0 comments on commit 17e2180

Please sign in to comment.