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:
parent
65c3cacb66
commit
e7f3dc3dae
|
@ -6,7 +6,7 @@ import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
|
||||||
contract Contracts {
|
contract Contracts {
|
||||||
|
|
||||||
mapping(bytes32=>bool) private ids; // contract id, equal to hash of bid
|
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=>uint) private sizes; // storage size in bytes
|
||||||
mapping(bytes32=>bytes32) private contentHashes; // hash of data to be stored
|
mapping(bytes32=>bytes32) private contentHashes; // hash of data to be stored
|
||||||
mapping(bytes32=>uint) private prices; // price in coins
|
mapping(bytes32=>uint) private prices; // price in coins
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const { ethers } = require("hardhat")
|
const { ethers } = require("hardhat")
|
||||||
|
|
||||||
const exampleRequest = () => ({
|
const exampleRequest = () => ({
|
||||||
duration: 31 * 24 * 60 * 60, // 31 days
|
duration: 200000, // 200,000 blocks ≈ 1 month
|
||||||
size: 1 * 1024 * 1024 * 1024, // 1 Gigabyte
|
size: 1 * 1024 * 1024 * 1024, // 1 Gigabyte
|
||||||
contentHash: ethers.utils.sha256("0xdeadbeef"),
|
contentHash: ethers.utils.sha256("0xdeadbeef"),
|
||||||
proofPeriod: 8, // 8 blocks ≈ 2 minutes
|
proofPeriod: 8, // 8 blocks ≈ 2 minutes
|
||||||
|
|
Loading…
Reference in New Issue