Shorten work contract validation pool duration to 60s
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 36s Details

This commit is contained in:
Ladd Hoffman 2024-03-23 15:11:56 -05:00
parent 53e0745532
commit 041580f79d
14 changed files with 151 additions and 53 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,12 +1,12 @@
{
"localhost": {
"DAO": "0x691Bcb6a8378Cec103BE58Dfa037DC57E6FFf4d1",
"Work1": "0xC489CE618A049B413CE0AED9Fc7219a04510ddbb",
"Onboarding": "0x3477A098fBFe09aa26693012176baAEa16d9D2DA"
"DAO": "0x8d914D38dD301FC4606f5aa9fEcF8A76389020d3",
"Work1": "0x6c18eb38b7450F8DaE5A5928A40fcA3952493Ee4",
"Onboarding": "0xB8f0cd092979F273b752FDa060F82BF2745f192e"
},
"sepolia": {
"DAO": "0xc6b3b8A641c52F7bC13a9D444e1f0759CA3b87b4",
"Work1": "0x177bAcA9E50020F185551cDc43ce78bb840cfE7D",
"Onboarding": "0x635F46Ea745a14431B27c5dd5838306Be289B747"
"Work1": "0xd2845aE812Ee42cF024fB4C55c052365792aBd78",
"Onboarding": "0xf15aCe29E5e3e4bb31FCddF2C65DF7C440449a57"
}
}

View File

@ -1,12 +1,12 @@
{
"localhost": {
"DAO": "0x691Bcb6a8378Cec103BE58Dfa037DC57E6FFf4d1",
"Work1": "0xC489CE618A049B413CE0AED9Fc7219a04510ddbb",
"Onboarding": "0x3477A098fBFe09aa26693012176baAEa16d9D2DA"
"DAO": "0x8d914D38dD301FC4606f5aa9fEcF8A76389020d3",
"Work1": "0x6c18eb38b7450F8DaE5A5928A40fcA3952493Ee4",
"Onboarding": "0xB8f0cd092979F273b752FDa060F82BF2745f192e"
},
"sepolia": {
"DAO": "0xc6b3b8A641c52F7bC13a9D444e1f0759CA3b87b4",
"Work1": "0x177bAcA9E50020F185551cDc43ce78bb840cfE7D",
"Onboarding": "0x635F46Ea745a14431B27c5dd5838306Be289B747"
"Work1": "0xd2845aE812Ee42cF024fB4C55c052365792aBd78",
"Onboarding": "0xf15aCe29E5e3e4bb31FCddF2C65DF7C440449a57"
}
}

View File

@ -38,7 +38,7 @@ abstract contract WorkContract is IAcceptAvailability {
uint public requestCount;
// TODO: Make parameters configurable
uint constant POOL_DURATION = 1 days;
uint constant POOL_DURATION = 60;
event AvailabilityStaked(uint stakeIndex);
event WorkAssigned(uint requestIndex, uint stakeIndex);

View File

@ -8,7 +8,10 @@
"automatic-staking-local": "hardhat run --network localhost scripts/automatic-staking.js",
"automatic-staking-sepolia": "hardhat run --network sepolia scripts/automatic-staking.js",
"deploy-local": "hardhat run --network localhost scripts/deploy.js",
"deploy-sepolia": "hardhat run --network sepolia scripts/deploy.js"
"deploy-sepolia": "hardhat run --network sepolia scripts/deploy.js",
"deploy-work-contracts-local": "hardhat run --network localhost scripts/deploy-work-contracts.js",
"deploy-work-contracts-sepolia": "hardhat run --network sepolia scripts/deploy-work-contracts.js",
"verify-sepolia": "hardhat run --network sepolia scripts/verify.js"
},
"author": "",
"license": "ISC",

View File

@ -0,0 +1,10 @@
const deployWorkContract = require('./util/deploy-work-contract');
async function main() {
await deployWorkContract('Onboarding');
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});

View File

@ -0,0 +1,11 @@
const deployWorkContract = require('./util/deploy-work-contract');
async function main() {
await deployWorkContract('Work1');
await deployWorkContract('Onboarding');
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});

View File

@ -0,0 +1,10 @@
const deployWorkContract = require('./util/deploy-work-contract');
async function main() {
await deployWorkContract('Onboarding');
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});

View File

@ -1,44 +1,12 @@
const { ethers } = require('hardhat');
const fs = require('fs');
const contractAddresses = require('../contract-addresses.json');
require('dotenv').config();
const network = process.env.HARDHAT_NETWORK;
const work1Price = process.env.WORK1_PRICE || 0.001;
const onboardingPrice = process.env.ONBOARDING_PRICE || '0.001';
const deployWorkContract = require('./util/deploy-work-contract');
const deployContract = require('./util/deploy-contract');
async function main() {
const dao = await ethers.deployContract('DAO');
await dao.waitForDeployment();
console.log(`DAO deployed to ${dao.target}`);
contractAddresses[network].DAO = dao.target;
fs.copyFileSync('./artifacts/contracts/DAO.sol/DAO.json', '../client/src/assets/DAO.json');
const deployWorkContract = async (name, price) => {
const contract = await ethers.deployContract('Work1', [dao.target, price]);
await contract.waitForDeployment();
console.log(`${name} deployed to ${contract.target}`);
contractAddresses[network][name] = contract.target;
fs.copyFileSync(`./artifacts/contracts/${name}.sol/${name}.json`, `../client/src/assets/${name}.json`);
};
await deployWorkContract('Work1', ethers.parseEther(work1Price));
await deployWorkContract('Onboarding', ethers.parseEther(onboardingPrice));
fs.writeFileSync('../client/src/contract-addresses.json', JSON.stringify(contractAddresses, null, 2));
console.log('Wrote file', fs.realpathSync('../client/src/contract-addresses.json'));
fs.writeFileSync('./contract-addresses.json', JSON.stringify(contractAddresses, null, 2));
console.log('Wrote file', fs.realpathSync('./contract-addresses.json'));
console.log('Copied ABIs to', fs.realpathSync('../client/src/assets'));
await deployContract('DAO');
await deployWorkContract('Work1');
await deployWorkContract('Onboarding');
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;

View File

@ -0,0 +1,25 @@
const { ethers } = require('hardhat');
const fs = require('fs');
const contractAddresses = require('../../contract-addresses.json');
const writeContractAddresses = require('./write-contract-addresses');
require('dotenv').config();
const network = process.env.HARDHAT_NETWORK;
const deployContract = async (name, args = []) => {
const contract = await ethers.deployContract(name, args);
await contract.waitForDeployment();
console.log(`${name} deployed to ${contract.target}`);
contractAddresses[network][name] = contract.target;
const from = `./artifacts/contracts/${name}.sol/${name}.json`;
const to = `../client/src/assets/${name}.json`;
fs.copyFileSync(from, to);
console.log(`Copied ${fs.realpathSync(from)} to ${fs.realpathSync(to)}`);
writeContractAddresses(contractAddresses);
};
module.exports = deployContract;

View File

@ -0,0 +1,17 @@
const { ethers } = require('hardhat');
const deployContract = require('./deploy-contract');
const contractAddresses = require('../../contract-addresses.json');
require('dotenv').config();
const network = process.env.HARDHAT_NETWORK;
const deployWorkContract = async (name) => {
const priceEnvVar = `${name.toUpperCase()}_PRICE`;
const price = ethers.parseEther(process.env[priceEnvVar] || 0.001);
await deployContract(name, [contractAddresses[network].DAO, price]);
};
module.exports = deployWorkContract;

View File

@ -0,0 +1,11 @@
const fs = require('fs');
const writeContractAddresses = (contractAddresses) => {
fs.writeFileSync('../client/src/contract-addresses.json', JSON.stringify(contractAddresses, null, 2));
console.log('Wrote file', fs.realpathSync('../client/src/contract-addresses.json'));
fs.writeFileSync('./contract-addresses.json', JSON.stringify(contractAddresses, null, 2));
console.log('Wrote file', fs.realpathSync('./contract-addresses.json'));
};
module.exports = writeContractAddresses;

View File

@ -0,0 +1,43 @@
const { ethers, run } = require('hardhat');
const contractAddresses = require('../contract-addresses.json');
require('dotenv').config();
const network = process.env.HARDHAT_NETWORK;
const work1Price = ethers.parseEther(process.env.WORK1_PRICE || 0.001);
const onboardingPrice = ethers.parseEther(process.env.ONBOARDING_PRICE || '0.001');
async function main() {
// Unless deploying locally, run the verify task
if (network !== 'localhost') {
await run('verify:verify', {
address: contractAddresses[network].DAO,
});
console.log('Verified DAO contract');
await run('verify:verify', {
address: contractAddresses[network].Work1,
constructorArguments: [
contractAddresses[network].DAO,
work1Price,
],
});
console.log('Verified Work1 contract');
await run('verify:verify', {
address: contractAddresses[network].Onboarding,
constructorArguments: [
contractAddresses[network].DAO,
onboardingPrice,
],
});
console.log('Verified Onboarding contract');
}
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});