Define contract duration in number of blocks

This makes calculation with duration in Solidity simpler
and less prone to errors.
This commit is contained in:
Mark Spanbroek 2021-11-03 11:10:42 +01:00
parent 65c3cacb66
commit e7f3dc3dae
2 changed files with 2 additions and 2 deletions

View File

@ -6,7 +6,7 @@ import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
contract Contracts {
mapping(bytes32=>bool) private ids; // contract id, equal to hash of bid
mapping(bytes32=>uint) private durations; // contract duration in seconds
mapping(bytes32=>uint) private durations; // contract duration in blocks
mapping(bytes32=>uint) private sizes; // storage size in bytes
mapping(bytes32=>bytes32) private contentHashes; // hash of data to be stored
mapping(bytes32=>uint) private prices; // price in coins

View File

@ -1,7 +1,7 @@
const { ethers } = require("hardhat")
const exampleRequest = () => ({
duration: 31 * 24 * 60 * 60, // 31 days
duration: 200000, // 200,000 blocks ≈ 1 month
size: 1 * 1024 * 1024 * 1024, // 1 Gigabyte
contentHash: ethers.utils.sha256("0xdeadbeef"),
proofPeriod: 8, // 8 blocks ≈ 2 minutes