From 9452711359807242c2f15624ea8b16092a8b7551 Mon Sep 17 00:00:00 2001 From: portuu3 Date: Thu, 26 Jan 2023 20:54:04 +0100 Subject: [PATCH 1/4] proxy contracts deployment --- CONTRACTS_LIST.md | 117 +++++++++++++++++++++--- packages/core/README.md | 24 +++++ packages/core/hardhat.config.ts | 2 +- packages/core/package.json | 1 + packages/core/scripts/deploy-proxies.ts | 79 ++++++++++++++++ packages/core/scripts/deploy.ts | 1 - 6 files changed, 210 insertions(+), 14 deletions(-) create mode 100644 packages/core/scripts/deploy-proxies.ts diff --git a/CONTRACTS_LIST.md b/CONTRACTS_LIST.md index 7b66787487..38b8b58a75 100644 --- a/CONTRACTS_LIST.md +++ b/CONTRACTS_LIST.md @@ -1,14 +1,107 @@ # 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 | +|--------------------------|----------------|--------------------------------------------|--------------------------------------------| +| | HMToken | 0xc748B2A084F8eFc47E086ccdDD9b7e67aEb571BF | N/A | +| | EscrowFactory | 0x45eBc3eAE6DA485097054ae10BA1A0f8e8c7f794 | | +| | Staking | | | +| | RewardPool | | | +| | EthKVStore | 0x6334dB76037bb6d4bc21901433E870b22ACa1F9a | N/A | +| | RewardPool | | | + +| Polygon Mumbai (Testnet) | Contract | Address | Proxy | +|--------------------------|----------------|--------------------------------------------|--------------------------------------------| +| | HMToken | 0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4 | N/A | +| | EscrowFactory | 0xd319e761b632E39234E68247D307818a20158890 | 0xA8D927C4DA17A6b71675d2D49dFda4E9eBE58f2d | +| | Staking | 0x19Fc3e859C1813ac9427a7a78BeB9ae102CE96d3 | 0x7Fd3dF914E7b6Bd96B4c744Df32183b51368Bfac | +| | RewardPool | 0x295514FC4C812Db24C3277d6D3175956AdEA273C | 0xf0145eD99AC3c4f877aDa7dA4D1E059ec9116BAE | +| | EthKVStore | 0xD7F61E812e139a5a02eDae9Dfec146E1b8eA3807 | N/A | +| | RewardPool | 0x7B9f9Dc6c157899C1Eb1c6B86f94855cC2F537dF | 0xC522463d36f76b881bE66484e3068F11e7038Ace | + +| Goerli (Testnet) | Contract | Address | Proxy | +|--------------------------|----------------|--------------------------------------------|--------------------------------------------| +| | HMToken | 0xd3A31D57FDD790725d0F6B78095F62E8CD4ab317 | N/A | +| | EscrowFactory | 0xaAe6a2646C1F88763E62e0cD08aD050Ea66AC46F | | +| | Staking | | | +| | RewardPool | | | +| | EthKVStore | | N/A | +| | RewardPool | | | + +| Rinkeby (Testnet) | Contract | Address | Proxy | +|--------------------------|----------------|--------------------------------------------|--------------------------------------------| +| | HMToken | 0x4dCf5ac4509888714dd43A5cCc46d7ab389D9c23 | N/A | +| | EscrowFactory | 0x925B24444511c86F4d4E63141D8Be0A025E2dca4 | | +| | Staking | | | +| | RewardPool | | | +| | EthKVStore | | N/A | +| | RewardPool | | | + +| Binance SC (Mainnet) | Contract | Address | Proxy | +|--------------------------|----------------|--------------------------------------------|--------------------------------------------| +| | HMToken | 0x0d501B743F22b641B8C8dfe00F1AAb881D57DDC7 | N/A | +| | EscrowFactory | 0xc88bC422cAAb2ac8812de03176402dbcA09533f4 | | +| | Staking | | | +| | RewardPool | | | +| | EthKVStore | 0x8340412Ed68BcF53a7Da72BFFc1E2E74CfdE74D0 | N/A | +| | RewardPool | | | + +| Binance SC (Testnet) | Contract | Address | Proxy | +|--------------------------|----------------|--------------------------------------------|--------------------------------------------| +| | HMToken | 0xd3a31d57fdd790725d0f6b78095f62e8cd4ab317 | N/A | +| | EscrowFactory | 0xaae6a2646c1f88763e62e0cd08ad050ea66ac46f | | +| | Staking | | | +| | RewardPool | | | +| | EthKVStore | 0x7676F326f1e30E96a76B7F1a860d56A9ac988a7d | N/A | +| | RewardPool | | | + +| Moonbeam (Mainnet) | Contract | Address | Proxy | +|--------------------------|----------------|--------------------------------------------|--------------------------------------------| +| | HMToken | 0x3b25BC1dC591D24d60560d0135D6750A561D4764 | N/A | +| | EscrowFactory | 0x98108c28B7767a52BE38B4860832dd4e11A7ecad | | +| | Staking | | | +| | RewardPool | | | +| | EthKVStore | 0x6617d21ab0f16A7079e2811Cf9306CAe7018bDd9 | N/A | +| | RewardPool | | | + +| Moonbeam Alpha (Testnet) | Contract | Address | Proxy | +|--------------------------|----------------|--------------------------------------------|--------------------------------------------| +| | HMToken | 0xe4C8eC5d057EacF40060b2174627a4941a5c8127 | N/A | +| | EscrowFactory | 0x3Cd0B117Be4CC1e31c8d7d1eD8b32208a2820902 | | +| | Staking | | | +| | RewardPool | | | +| | EthKVStore | 0x64009ca5fb4b34769F7240c6073FEc34bf5b64E3 | N/A | +| | RewardPool | | | + +| Avalanche (Mainnet) | Contract | Address | Proxy | +|--------------------------|----------------|--------------------------------------------|--------------------------------------------| +| | HMToken | 0x12365293cb6477d4fc2686e46bb97e3fb64f1550 | N/A | +| | EscrowFactory | 0x9767a578ba7a5FA1563c8229943cB01cd8446BB4 | | +| | Staking | | | +| | RewardPool | | | +| | EthKVStore | 0x4B79eaD28F52eD5686bf0e379717e85fc7aD10Df | N/A | +| | RewardPool | | | + +| Avalanche Fuji (Testnet) | Contract | Address | Proxy | +|--------------------------|----------------|--------------------------------------------|--------------------------------------------| +| | HMToken | 0x9406d5c635AD22b0d76c75E52De57A2177919ca3 | N/A | +| | EscrowFactory | 0xfb4469201951C3B9a7F1996c477cb7BDBEcE0A88 | | +| | Staking | | | +| | RewardPool | | | +| | EthKVStore | 0xd232c1426CF0653cE8a71DC98bCfDf10c471c114 | N/A | +| | RewardPool | | | + + + + +# Old contracts + +## Outdated since 2023/01/26 +| Polygon Mumbai (Testnet) | Contract | Address | Proxy | +|--------------------------|----------------|--------------------------------------------|--------------------------------------------| +| | HMToken | 0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4 | N/A | +| | EscrowFactory | 0x558cd800f9F0B02f3B149667bDe003284c867E94 | | +| | Staking | | | +| | RewardPool | | | +| | EthKVStore | 0x32e27177BA6Ea91cf28dfd91a0Da9822A4b74EcF | N/A | +| | RewardPool | | | \ No newline at end of file diff --git a/packages/core/README.md b/packages/core/README.md index 7af89160dd..c08207c94a 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -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. \ No newline at end of file diff --git a/packages/core/hardhat.config.ts b/packages/core/hardhat.config.ts index 4a63495ed2..7b5016e442 100644 --- a/packages/core/hardhat.config.ts +++ b/packages/core/hardhat.config.ts @@ -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: { diff --git a/packages/core/package.json b/packages/core/package.json index 66c358434b..d1da61301a 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -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'", diff --git a/packages/core/scripts/deploy-proxies.ts b/packages/core/scripts/deploy-proxies.ts new file mode 100644 index 0000000000..e7e84bbca3 --- /dev/null +++ b/packages/core/scripts/deploy-proxies.ts @@ -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; +}); diff --git a/packages/core/scripts/deploy.ts b/packages/core/scripts/deploy.ts index 439b6b2fd5..f56230c412 100644 --- a/packages/core/scripts/deploy.ts +++ b/packages/core/scripts/deploy.ts @@ -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: ', From 5be2e3038a8c915c6b8d48d2e1c96591a7de123f Mon Sep 17 00:00:00 2001 From: portuu3 Date: Fri, 27 Jan 2023 09:15:19 +0100 Subject: [PATCH 2/4] add date of contract deployment --- CONTRACTS_LIST.md | 70 +++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/CONTRACTS_LIST.md b/CONTRACTS_LIST.md index 38b8b58a75..8cc20fdde3 100644 --- a/CONTRACTS_LIST.md +++ b/CONTRACTS_LIST.md @@ -3,26 +3,26 @@ | Polygon (Mainnet) | Contract | Address | Proxy | |--------------------------|----------------|--------------------------------------------|--------------------------------------------| -| | HMToken | 0xc748B2A084F8eFc47E086ccdDD9b7e67aEb571BF | N/A | -| | EscrowFactory | 0x45eBc3eAE6DA485097054ae10BA1A0f8e8c7f794 | | +|2021/10/13 | HMToken | 0xc748B2A084F8eFc47E086ccdDD9b7e67aEb571BF | N/A | +|2022/02/28 | EscrowFactory | 0x45eBc3eAE6DA485097054ae10BA1A0f8e8c7f794 | | | | Staking | | | | | RewardPool | | | -| | EthKVStore | 0x6334dB76037bb6d4bc21901433E870b22ACa1F9a | N/A | +|2022/03/01 | EthKVStore | 0x6334dB76037bb6d4bc21901433E870b22ACa1F9a | N/A | | | RewardPool | | | | Polygon Mumbai (Testnet) | Contract | Address | Proxy | |--------------------------|----------------|--------------------------------------------|--------------------------------------------| -| | HMToken | 0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4 | N/A | -| | EscrowFactory | 0xd319e761b632E39234E68247D307818a20158890 | 0xA8D927C4DA17A6b71675d2D49dFda4E9eBE58f2d | -| | Staking | 0x19Fc3e859C1813ac9427a7a78BeB9ae102CE96d3 | 0x7Fd3dF914E7b6Bd96B4c744Df32183b51368Bfac | -| | RewardPool | 0x295514FC4C812Db24C3277d6D3175956AdEA273C | 0xf0145eD99AC3c4f877aDa7dA4D1E059ec9116BAE | -| | EthKVStore | 0xD7F61E812e139a5a02eDae9Dfec146E1b8eA3807 | N/A | -| | RewardPool | 0x7B9f9Dc6c157899C1Eb1c6B86f94855cC2F537dF | 0xC522463d36f76b881bE66484e3068F11e7038Ace | +|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 | RewardPool | 0x7B9f9Dc6c157899C1Eb1c6B86f94855cC2F537dF | 0xC522463d36f76b881bE66484e3068F11e7038Ace | | Goerli (Testnet) | Contract | Address | Proxy | |--------------------------|----------------|--------------------------------------------|--------------------------------------------| -| | HMToken | 0xd3A31D57FDD790725d0F6B78095F62E8CD4ab317 | N/A | -| | EscrowFactory | 0xaAe6a2646C1F88763E62e0cD08aD050Ea66AC46F | | +|2022/10/12 | HMToken | 0xd3A31D57FDD790725d0F6B78095F62E8CD4ab317 | N/A | +|2022/10/12 | EscrowFactory | 0xaAe6a2646C1F88763E62e0cD08aD050Ea66AC46F | | | | Staking | | | | | RewardPool | | | | | EthKVStore | | N/A | @@ -30,8 +30,8 @@ | Rinkeby (Testnet) | Contract | Address | Proxy | |--------------------------|----------------|--------------------------------------------|--------------------------------------------| -| | HMToken | 0x4dCf5ac4509888714dd43A5cCc46d7ab389D9c23 | N/A | -| | EscrowFactory | 0x925B24444511c86F4d4E63141D8Be0A025E2dca4 | | +|2020/09/15 | HMToken | 0x4dCf5ac4509888714dd43A5cCc46d7ab389D9c23 | N/A | +|2021/03/05 | EscrowFactory | 0x925B24444511c86F4d4E63141D8Be0A025E2dca4 | | | | Staking | | | | | RewardPool | | | | | EthKVStore | | N/A | @@ -39,56 +39,56 @@ | Binance SC (Mainnet) | Contract | Address | Proxy | |--------------------------|----------------|--------------------------------------------|--------------------------------------------| -| | HMToken | 0x0d501B743F22b641B8C8dfe00F1AAb881D57DDC7 | N/A | -| | EscrowFactory | 0xc88bC422cAAb2ac8812de03176402dbcA09533f4 | | +|2022/08/18 | HMToken | 0x0d501B743F22b641B8C8dfe00F1AAb881D57DDC7 | N/A | +|2022/08/23 | EscrowFactory | 0xc88bC422cAAb2ac8812de03176402dbcA09533f4 | | | | Staking | | | | | RewardPool | | | -| | EthKVStore | 0x8340412Ed68BcF53a7Da72BFFc1E2E74CfdE74D0 | N/A | +|2022/08/23 | EthKVStore | 0x8340412Ed68BcF53a7Da72BFFc1E2E74CfdE74D0 | N/A | | | RewardPool | | | | Binance SC (Testnet) | Contract | Address | Proxy | |--------------------------|----------------|--------------------------------------------|--------------------------------------------| -| | HMToken | 0xd3a31d57fdd790725d0f6b78095f62e8cd4ab317 | N/A | -| | EscrowFactory | 0xaae6a2646c1f88763e62e0cd08ad050ea66ac46f | | +|2022/10/12 | HMToken | 0xd3a31d57fdd790725d0f6b78095f62e8cd4ab317 | N/A | +|2022/10/12 | EscrowFactory | 0xaae6a2646c1f88763e62e0cd08ad050ea66ac46f | | | | Staking | | | | | RewardPool | | | -| | EthKVStore | 0x7676F326f1e30E96a76B7F1a860d56A9ac988a7d | N/A | +|2022/08/12 | EthKVStore | 0x7676F326f1e30E96a76B7F1a860d56A9ac988a7d | N/A | | | RewardPool | | | | Moonbeam (Mainnet) | Contract | Address | Proxy | |--------------------------|----------------|--------------------------------------------|--------------------------------------------| -| | HMToken | 0x3b25BC1dC591D24d60560d0135D6750A561D4764 | N/A | -| | EscrowFactory | 0x98108c28B7767a52BE38B4860832dd4e11A7ecad | | +|2022/05/26 | HMToken | 0x3b25BC1dC591D24d60560d0135D6750A561D4764 | N/A | +|2022/06/01 | EscrowFactory | 0x98108c28B7767a52BE38B4860832dd4e11A7ecad | | | | Staking | | | | | RewardPool | | | -| | EthKVStore | 0x6617d21ab0f16A7079e2811Cf9306CAe7018bDd9 | N/A | +|2022/06/01 | EthKVStore | 0x6617d21ab0f16A7079e2811Cf9306CAe7018bDd9 | N/A | | | RewardPool | | | | Moonbeam Alpha (Testnet) | Contract | Address | Proxy | |--------------------------|----------------|--------------------------------------------|--------------------------------------------| -| | HMToken | 0xe4C8eC5d057EacF40060b2174627a4941a5c8127 | N/A | -| | EscrowFactory | 0x3Cd0B117Be4CC1e31c8d7d1eD8b32208a2820902 | | +|2022/05/31 | HMToken | 0xe4C8eC5d057EacF40060b2174627a4941a5c8127 | N/A | +|2022/05/31 | EscrowFactory | 0x3Cd0B117Be4CC1e31c8d7d1eD8b32208a2820902 | | | | Staking | | | | | RewardPool | | | -| | EthKVStore | 0x64009ca5fb4b34769F7240c6073FEc34bf5b64E3 | N/A | +|2022/05/31 | EthKVStore | 0x64009ca5fb4b34769F7240c6073FEc34bf5b64E3 | N/A | | | RewardPool | | | | Avalanche (Mainnet) | Contract | Address | Proxy | |--------------------------|----------------|--------------------------------------------|--------------------------------------------| -| | HMToken | 0x12365293cb6477d4fc2686e46bb97e3fb64f1550 | N/A | -| | EscrowFactory | 0x9767a578ba7a5FA1563c8229943cB01cd8446BB4 | | +|2022/09/29 | HMToken | 0x12365293cb6477d4fc2686e46bb97e3fb64f1550 | N/A | +|2022/12/03 | EscrowFactory | 0x9767a578ba7a5FA1563c8229943cB01cd8446BB4 | | | | Staking | | | | | RewardPool | | | -| | EthKVStore | 0x4B79eaD28F52eD5686bf0e379717e85fc7aD10Df | N/A | +|2022/11/17 | EthKVStore | 0x4B79eaD28F52eD5686bf0e379717e85fc7aD10Df | N/A | | | RewardPool | | | | Avalanche Fuji (Testnet) | Contract | Address | Proxy | |--------------------------|----------------|--------------------------------------------|--------------------------------------------| -| | HMToken | 0x9406d5c635AD22b0d76c75E52De57A2177919ca3 | N/A | -| | EscrowFactory | 0xfb4469201951C3B9a7F1996c477cb7BDBEcE0A88 | | +|2022/10/23 | HMToken | 0x9406d5c635AD22b0d76c75E52De57A2177919ca3 | N/A | +|2022/10/24 | EscrowFactory | 0xfb4469201951C3B9a7F1996c477cb7BDBEcE0A88 | | | | Staking | | | | | RewardPool | | | -| | EthKVStore | 0xd232c1426CF0653cE8a71DC98bCfDf10c471c114 | N/A | +|2022/10/24 | EthKVStore | 0xd232c1426CF0653cE8a71DC98bCfDf10c471c114 | N/A | | | RewardPool | | | @@ -96,12 +96,12 @@ # Old contracts -## Outdated since 2023/01/26 + | Polygon Mumbai (Testnet) | Contract | Address | Proxy | |--------------------------|----------------|--------------------------------------------|--------------------------------------------| -| | HMToken | 0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4 | N/A | -| | EscrowFactory | 0x558cd800f9F0B02f3B149667bDe003284c867E94 | | +|2022/04/25 | HMToken | 0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4 | N/A | +|2022/04/25 | EscrowFactory | 0x558cd800f9F0B02f3B149667bDe003284c867E94 | | | | Staking | | | | | RewardPool | | | -| | EthKVStore | 0x32e27177BA6Ea91cf28dfd91a0Da9822A4b74EcF | N/A | +|2022/04/29 | EthKVStore | 0x32e27177BA6Ea91cf28dfd91a0Da9822A4b74EcF | N/A | | | RewardPool | | | \ No newline at end of file From 7ad5f80949adb062969531f935dfd911c2302f29 Mon Sep 17 00:00:00 2001 From: portuu3 Date: Fri, 27 Jan 2023 09:49:25 +0100 Subject: [PATCH 3/4] fix wording --- CONTRACTS_LIST.md | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/CONTRACTS_LIST.md b/CONTRACTS_LIST.md index 8cc20fdde3..1f83f8322c 100644 --- a/CONTRACTS_LIST.md +++ b/CONTRACTS_LIST.md @@ -8,7 +8,7 @@ | | Staking | | | | | RewardPool | | | |2022/03/01 | EthKVStore | 0x6334dB76037bb6d4bc21901433E870b22ACa1F9a | N/A | -| | RewardPool | | | +| | Reputation | | | | Polygon Mumbai (Testnet) | Contract | Address | Proxy | |--------------------------|----------------|--------------------------------------------|--------------------------------------------| @@ -17,7 +17,7 @@ |2023/01/26 | Staking | 0x19Fc3e859C1813ac9427a7a78BeB9ae102CE96d3 | 0x7Fd3dF914E7b6Bd96B4c744Df32183b51368Bfac | |2023/01/26 | RewardPool | 0x295514FC4C812Db24C3277d6D3175956AdEA273C | 0xf0145eD99AC3c4f877aDa7dA4D1E059ec9116BAE | |2023/01/26 | EthKVStore | 0xD7F61E812e139a5a02eDae9Dfec146E1b8eA3807 | N/A | -|2023/01/26 | RewardPool | 0x7B9f9Dc6c157899C1Eb1c6B86f94855cC2F537dF | 0xC522463d36f76b881bE66484e3068F11e7038Ace | +|2023/01/26 | Reputation | 0x7B9f9Dc6c157899C1Eb1c6B86f94855cC2F537dF | 0xC522463d36f76b881bE66484e3068F11e7038Ace | | Goerli (Testnet) | Contract | Address | Proxy | |--------------------------|----------------|--------------------------------------------|--------------------------------------------| @@ -26,7 +26,7 @@ | | Staking | | | | | RewardPool | | | | | EthKVStore | | N/A | -| | RewardPool | | | +| | Reputation | | | | Rinkeby (Testnet) | Contract | Address | Proxy | |--------------------------|----------------|--------------------------------------------|--------------------------------------------| @@ -35,7 +35,7 @@ | | Staking | | | | | RewardPool | | | | | EthKVStore | | N/A | -| | RewardPool | | | +| | Reputation | | | | Binance SC (Mainnet) | Contract | Address | Proxy | |--------------------------|----------------|--------------------------------------------|--------------------------------------------| @@ -44,7 +44,7 @@ | | Staking | | | | | RewardPool | | | |2022/08/23 | EthKVStore | 0x8340412Ed68BcF53a7Da72BFFc1E2E74CfdE74D0 | N/A | -| | RewardPool | | | +| | Reputation | | | | Binance SC (Testnet) | Contract | Address | Proxy | |--------------------------|----------------|--------------------------------------------|--------------------------------------------| @@ -53,7 +53,7 @@ | | Staking | | | | | RewardPool | | | |2022/08/12 | EthKVStore | 0x7676F326f1e30E96a76B7F1a860d56A9ac988a7d | N/A | -| | RewardPool | | | +| | Reputation | | | | Moonbeam (Mainnet) | Contract | Address | Proxy | |--------------------------|----------------|--------------------------------------------|--------------------------------------------| @@ -62,7 +62,7 @@ | | Staking | | | | | RewardPool | | | |2022/06/01 | EthKVStore | 0x6617d21ab0f16A7079e2811Cf9306CAe7018bDd9 | N/A | -| | RewardPool | | | +| | Reputation | | | | Moonbeam Alpha (Testnet) | Contract | Address | Proxy | |--------------------------|----------------|--------------------------------------------|--------------------------------------------| @@ -71,7 +71,7 @@ | | Staking | | | | | RewardPool | | | |2022/05/31 | EthKVStore | 0x64009ca5fb4b34769F7240c6073FEc34bf5b64E3 | N/A | -| | RewardPool | | | +| | Reputation | | | | Avalanche (Mainnet) | Contract | Address | Proxy | |--------------------------|----------------|--------------------------------------------|--------------------------------------------| @@ -80,7 +80,7 @@ | | Staking | | | | | RewardPool | | | |2022/11/17 | EthKVStore | 0x4B79eaD28F52eD5686bf0e379717e85fc7aD10Df | N/A | -| | RewardPool | | | +| | Reputation | | | | Avalanche Fuji (Testnet) | Contract | Address | Proxy | |--------------------------|----------------|--------------------------------------------|--------------------------------------------| @@ -89,7 +89,7 @@ | | Staking | | | | | RewardPool | | | |2022/10/24 | EthKVStore | 0xd232c1426CF0653cE8a71DC98bCfDf10c471c114 | N/A | -| | RewardPool | | | +| | Reputation | | | @@ -101,7 +101,4 @@ |--------------------------|----------------|--------------------------------------------|--------------------------------------------| |2022/04/25 | HMToken | 0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4 | N/A | |2022/04/25 | EscrowFactory | 0x558cd800f9F0B02f3B149667bDe003284c867E94 | | -| | Staking | | | -| | RewardPool | | | -|2022/04/29 | EthKVStore | 0x32e27177BA6Ea91cf28dfd91a0Da9822A4b74EcF | N/A | -| | RewardPool | | | \ No newline at end of file +|2022/04/29 | EthKVStore | 0x32e27177BA6Ea91cf28dfd91a0Da9822A4b74EcF | N/A | \ No newline at end of file From 927fc4d3664cb0c41f1515e44d39ca5ff7bc7212 Mon Sep 17 00:00:00 2001 From: portuu3 Date: Fri, 27 Jan 2023 14:35:58 +0100 Subject: [PATCH 4/4] update addresses and create new subgraph version --- CONTRACTS_LIST.md | 4 ++- .../escrow-dashboard/src/constants/index.ts | 5 +-- .../launcher/server/src/constants/networks.ts | 2 +- packages/sdk/typescript/subgraph/README.md | 32 ++++++++++--------- .../config/{mumbai.json => mumbai-v1.json} | 12 +++---- 5 files changed, 30 insertions(+), 25 deletions(-) rename packages/sdk/typescript/subgraph/config/{mumbai.json => mumbai-v1.json} (69%) diff --git a/CONTRACTS_LIST.md b/CONTRACTS_LIST.md index 1f83f8322c..423914ee39 100644 --- a/CONTRACTS_LIST.md +++ b/CONTRACTS_LIST.md @@ -101,4 +101,6 @@ |--------------------------|----------------|--------------------------------------------|--------------------------------------------| |2022/04/25 | HMToken | 0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4 | N/A | |2022/04/25 | EscrowFactory | 0x558cd800f9F0B02f3B149667bDe003284c867E94 | | -|2022/04/29 | EthKVStore | 0x32e27177BA6Ea91cf28dfd91a0Da9822A4b74EcF | N/A | \ No newline at end of file +|2022/04/29 | EthKVStore | 0x32e27177BA6Ea91cf28dfd91a0Da9822A4b74EcF | N/A | +|2023/01/17 | Staking | 0x76E2EF2E177097E0b296E1e305d69Fe8Bae5f774 | 0xf421fD3eB97982C205966ebB514Ab2E435c6d5B7 | +|2023/01/17 | EthKVStore | 0x459EE403d060B84b5014605D6739cCFed32AFb96 | N/A | \ No newline at end of file diff --git a/packages/apps/escrow-dashboard/src/constants/index.ts b/packages/apps/escrow-dashboard/src/constants/index.ts index 0b50c0d1c1..2c488cd993 100644 --- a/packages/apps/escrow-dashboard/src/constants/index.ts +++ b/packages/apps/escrow-dashboard/src/constants/index.ts @@ -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]: { diff --git a/packages/examples/fortune/launcher/server/src/constants/networks.ts b/packages/examples/fortune/launcher/server/src/constants/networks.ts index 7844b722f7..b2341ee68d 100644 --- a/packages/examples/fortune/launcher/server/src/constants/networks.ts +++ b/packages/examples/fortune/launcher/server/src/constants/networks.ts @@ -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]: { diff --git a/packages/sdk/typescript/subgraph/README.md b/packages/sdk/typescript/subgraph/README.md index bf043be41e..d32f3275d5 100644 --- a/packages/sdk/typescript/subgraph/README.md +++ b/packages/sdk/typescript/subgraph/README.md @@ -32,7 +32,6 @@ You can access it on `http://localhost:8020/` The deployment of the graph on each network is automatically triggered by the github CI when mofications are made on the subgraph. - ### Tests To run tests next commands should be executed: @@ -53,21 +52,24 @@ Following networks are supported : - Goerli - Polygon Mumbai (testnet) -### Add a new network +# Add a new network You can find networks configuration in the directory `config`. Each JSON file is use to generate the `subgraph.yaml` file for each network. 1. Add your network configuration as `config/NETWORK.json` -2. On the `package.json` file add the command `npm run quickstart:{NETWORK}` -3. On the `./.github/workflows/deploy.yaml` file add these 3command at the end of the file - - run: node ./scripts/generatenetworkssubgraphs.js {yourNetworkName} - - run: npm run codegen - - run: graph deploy --product hosted-service humanprotocol/{yourNetworkName} - -Currently deploying to: - -- main branch -> https://thegraph.com/hosted-service/subgraph/humanprotocol/polygon - -- goerli branch -> https://thegraph.com/hosted-service/subgraph/humanprotocol/goerli - -- mumbai branch -> https://thegraph.com/hosted-service/subgraph/humanprotocol/mumbai +2. Run authentication command: `npx graph auth --product hosted-service [AUTH_TOKEN]` +3. Generate `cross-env NETWORK=[NETWORK] yarn generate` +4. Go to you hosted [service dashboard](https://thegraph.com/hosted-service/dashboard) and create the new subgraph +5. Deploy the subgraph `npx graph deploy --product hosted-service humanprotocol/[SUBGRAPH_NAME]` +6. On the `./.github/workflows/cd-subgraph.yaml` add your network name and graph name. + +# Existing subgraphs + +- https://api.thegraph.com/subgraphs/name/humanprotocol/mumbai-v1 +- https://api.thegraph.com/subgraphs/name/humanprotocol/mumbai +- https://api.thegraph.com/subgraphs/name/humanprotocol/polygon +- https://api.thegraph.com/subgraphs/name/humanprotocol/moonbeam +- https://api.thegraph.com/subgraphs/name/humanprotocol/rinkeby +- https://api.thegraph.com/subgraphs/name/humanprotocol/goerli +- https://api.thegraph.com/subgraphs/name/humanprotocol/bsctest +- https://api.thegraph.com/subgraphs/name/humanprotocol/bsc diff --git a/packages/sdk/typescript/subgraph/config/mumbai.json b/packages/sdk/typescript/subgraph/config/mumbai-v1.json similarity index 69% rename from packages/sdk/typescript/subgraph/config/mumbai.json rename to packages/sdk/typescript/subgraph/config/mumbai-v1.json index fb2517d478..fc2d844bff 100644 --- a/packages/sdk/typescript/subgraph/config/mumbai.json +++ b/packages/sdk/typescript/subgraph/config/mumbai-v1.json @@ -2,8 +2,8 @@ "network": "mumbai", "description": "Human subgraph on Polygon Mumbai testnet", "EscrowFactory": { - "address": "0x558cd800f9F0B02f3B149667bDe003284c867E94", - "startBlock": 26086172, + "address": "0xA8D927C4DA17A6b71675d2D49dFda4E9eBE58f2d", + "startBlock": 31433945, "abi": "./node_modules/@human-protocol/core/abis/EscrowFactory.json" }, "HMToken": { @@ -15,13 +15,13 @@ "abi": "./node_modules/@human-protocol/core/abis/Escrow.json" }, "Staking": { - "address": "0xf421fD3eB97982C205966ebB514Ab2E435c6d5B7", - "startBlock": 31060831, + "address": "0x7Fd3dF914E7b6Bd96B4c744Df32183b51368Bfac", + "startBlock": 31433938, "abi": "./node_modules/@human-protocol/core/abis/Staking.json" }, "KVStore": { - "address": "0x459EE403d060B84b5014605D6739cCFed32AFb96", - "startBlock": 31059244, + "address": "0xD7F61E812e139a5a02eDae9Dfec146E1b8eA3807", + "startBlock": 31433948, "abi": "./node_modules/@human-protocol/core/abis/KVStore.json" } }