Arnaud dee3d7b654
feat: move to hardhat ignition for deployments (#231)
* Move to ethers 6 and use hardhat ignition for deployments

* Update prettier to the last version

* Remove comment

* Remove npx call in package.json

* Remove useless comment

* Add localhost configuration for hardhat ignition

* Use contract initial balance instead of const value

* Update dependencies and use extract mining to a script in order to use hardhat ignition deploy command

* Fix deployment modules for local env

* Remove unused function

* Export contract deployment custom error assert into a function

* Refactoring

* Remove old deployments folder

* Add process names when running concurrently

* Remove conditional allowBlocksWithSameTimestamp, set true everytime

* Update dependencies

* Update Vault tests for ignition

* Update token description

* Add vault ignition module

* Remove old .tool-versions

* Fix formatting

* Remove deployments folder and add README for previous files references

* Put back the comment related to hardhat automine

* Set hardhat gas limit to auto and restore manual mining for Vault tests

* Apply prettier formatting and bug test with ignition syntax

* Add deployments artifacts

* Fix build-info ignore

* Use HARDHAT_NETWORK env variable to deploy marketplace contract

* Add guard to check that configs has tags

* Add testnet deployment addresses

* Add TOKEN_ADDRESS to reuse the token contract deployed

* Fix token deployment with contractAt

* Remove localhost deployment artifacts

* Add section in README for deployments

* Ignore localhost deployments in git

* Set mine script for localhost deployment only and add deploy reset command

* Remove previous deployment scripts

* Fix typo in documentation

* Add log when reusing token address

* Update testnet artifact reference

* Remove HARDHAT_NETWORK and update documentation

* fix md format

* Npm audit fix

* Update dependencies

* Remove default deployer

* Update commit for last testnet artifacts

* Remove deployments files from linea and testnet and update the last commit hashes to those artifacts
2025-06-20 16:05:57 +02:00

63 lines
1.3 KiB
JavaScript

const { hours } = require("./time")
const { hexlify, randomBytes } = require("hardhat").ethers
const exampleConfiguration = () => ({
collateral: {
repairRewardPercentage: 10,
maxNumberOfSlashes: 5,
slashPercentage: 10,
validatorRewardPercentage: 20,
},
proofs: {
period: 10,
timeout: 5,
downtime: 64,
downtimeProduct: 67,
zkeyHash: "",
},
reservations: {
maxReservations: 3,
},
requestDurationLimit: 60 * 60 * 24 * 30, // 30 days
})
const exampleRequest = async () => {
return {
client: hexlify(randomBytes(20)),
ask: {
slots: 4,
slotSize: 1 * 1024 * 1024 * 1024, // 1 Gigabyte
duration: hours(10),
proofProbability: 4, // require a proof roughly once every 4 periods
pricePerBytePerSecond: 1,
maxSlotLoss: 2,
collateralPerByte: 1,
},
content: {
cid: Buffer.from("zb2rhheVmk3bLks5MgzTqyznLu1zqGH5jrfTA1eAZXrjx7Vob"),
merkleRoot: randomBytes(32),
},
expiry: hours(1),
nonce: hexlify(randomBytes(32)),
}
}
const exampleProof = () => ({
a: { x: 1, y: 2 },
b: { x: [3, 4], y: [5, 6] },
c: { x: 7, y: 8 },
})
const invalidProof = () => ({
a: { x: 0, y: 0 },
b: { x: [0, 0], y: [0, 0] },
c: { x: 0, y: 0 },
})
module.exports = {
exampleConfiguration,
exampleRequest,
exampleProof,
invalidProof,
}