From 14d80bf1d59315c1fac54bd09c3851f29525b546 Mon Sep 17 00:00:00 2001 From: Ladd Hoffman Date: Sun, 17 Mar 2024 13:24:49 -0500 Subject: [PATCH] deploy --- client/src/App.jsx | 10 +++++----- {contract-config => client/src/assets}/DAO.json | 0 {contract-config => client/src/assets}/Work1.json | 0 contract-config/addresses.json | 8 ++++---- ethereum/scripts/automatic-staking.js | 5 ++--- ethereum/scripts/deploy.js | 5 +++-- 6 files changed, 14 insertions(+), 14 deletions(-) rename {contract-config => client/src/assets}/DAO.json (100%) rename {contract-config => client/src/assets}/Work1.json (100%) diff --git a/client/src/App.jsx b/client/src/App.jsx index 4be04e3..385ce98 100644 --- a/client/src/App.jsx +++ b/client/src/App.jsx @@ -11,11 +11,10 @@ import Row from 'react-bootstrap/Row'; import Col from 'react-bootstrap/Col'; import Stack from 'react-bootstrap/Stack'; -import DAOArtifact from 'contract-config/DAO.json'; -import work1Artifact from 'contract-config/Work1.json'; - import { getContractByChainId } from './contract-config'; import Web3Context from './Web3Context'; +import DAOArtifact from './assets/DAO.json'; +import work1Artifact from './assets/Work1.json'; import AvailabilityStakes from './AvailabilityStakes'; import WorkRequests from './WorkRequests'; @@ -231,9 +230,10 @@ function App() { fetchReputation(); }); - work1Contract.events.WorkAssigned({ fromBlock: 'latest' }).on('data', (event) => { + work1Contract.events.WorkAssigned({ fromBlock: 'latest' }).on('data', async (event) => { console.log('event: work assigned', event); - const r = fetchWorkRequest(event.returnValues.requestIndex); + const r = await fetchWorkRequest(event.returnValues.requestIndex); + console.log('work request', r); fetchAvailabilityStake(r.stakeIndex); }); diff --git a/contract-config/DAO.json b/client/src/assets/DAO.json similarity index 100% rename from contract-config/DAO.json rename to client/src/assets/DAO.json diff --git a/contract-config/Work1.json b/client/src/assets/Work1.json similarity index 100% rename from contract-config/Work1.json rename to client/src/assets/Work1.json diff --git a/contract-config/addresses.json b/contract-config/addresses.json index c548200..cc35870 100644 --- a/contract-config/addresses.json +++ b/contract-config/addresses.json @@ -1,10 +1,10 @@ { "localhost": { - "DAO": "0xee46C48314Db1cd91DfaDc4f2f2cb12DE3B0Ec54", - "Work1": "0x37C7d46CC4Ae5a12402811B763998db4248C7069" + "DAO": "0xfc7E3bdF321821fF045Dde1586909AbBCC8D5d44", + "Work1": "0x89D456aF8A192B3D305007E1e94bFC2153Ead86B" }, "sepolia": { - "DAO": "0x39B7522Ee1A5B13aE5580C40114239D4cE0e7D29", - "Work1": "0xC0Bb36820Ba891DE4ed6D60f75066805361dbeB8" + "DAO": "0xA4Cb4d99be0Fef3e59dCaE909D6E8ef46EF07257", + "Work1": "0xdB3b37B555c980617140C8d8687a19B8381F374d" } } \ No newline at end of file diff --git a/ethereum/scripts/automatic-staking.js b/ethereum/scripts/automatic-staking.js index 5d38fa1..3b996bb 100644 --- a/ethereum/scripts/automatic-staking.js +++ b/ethereum/scripts/automatic-staking.js @@ -87,14 +87,13 @@ async function main() { // Listen for new validation pools dao.on('ValidationPoolInitiated', async (poolIndex) => { console.log(`pool ${poolIndex} started`); - await fetchValidationPool(poolIndex); + const pool = await fetchValidationPool(poolIndex); await fetchReputation(); - const pool = validationPools[poolIndex]; if (poolIsValid(pool)) { // Stake half of available reputation on this validation pool const amount = reputation / BigInt(2); - await stake(poolIndex, amount, true); + await stake(pool, amount, true); } else { console.log(`pool sender ${pool.sender} is not recognized`); } diff --git a/ethereum/scripts/deploy.js b/ethereum/scripts/deploy.js index 0eb3be5..45517c9 100644 --- a/ethereum/scripts/deploy.js +++ b/ethereum/scripts/deploy.js @@ -23,8 +23,9 @@ async function main() { fs.writeFileSync(contractAddressesWritePath, JSON.stringify(contractAddresses, null, 2)); console.log('Wrote file', fs.realpathSync(contractAddressesWritePath)); - fs.copyFileSync('./artifacts/contracts/DAO.sol/DAO.json', '../contract-config/DAO.json'); - fs.copyFileSync('./artifacts/contracts/Work1.sol/Work1.json', '../contract-config/Work1.json'); + fs.copyFileSync('./artifacts/contracts/DAO.sol/DAO.json', '../client/src/assets/DAO.json'); + fs.copyFileSync('./artifacts/contracts/Work1.sol/Work1.json', '../client/src/assets/Work1.json'); + console.log('Copied ABIs to', fs.realpathSync('../client/src/assets')); } // We recommend this pattern to be able to use async/await everywhere