2021-11-02 08:04:51 +00:00
|
|
|
const { ethers } = require("hardhat")
|
2022-02-15 16:01:54 +00:00
|
|
|
const { now, hours } = require("./time")
|
2022-02-16 09:50:00 +00:00
|
|
|
const { sha256, hexlify, randomBytes } = ethers.utils
|
2021-11-02 08:04:51 +00:00
|
|
|
|
2021-11-02 08:45:49 +00:00
|
|
|
const exampleRequest = () => ({
|
2021-11-04 09:19:23 +00:00
|
|
|
duration: 150, // 150 blocks ≈ half an hour
|
2021-11-02 08:04:51 +00:00
|
|
|
size: 1 * 1024 * 1024 * 1024, // 1 Gigabyte
|
2022-02-16 09:50:00 +00:00
|
|
|
contentHash: sha256("0xdeadbeef"),
|
2021-11-02 08:04:51 +00:00
|
|
|
proofPeriod: 8, // 8 blocks ≈ 2 minutes
|
|
|
|
proofTimeout: 4, // 4 blocks ≈ 1 minute
|
2022-02-16 09:50:00 +00:00
|
|
|
maxPrice: 42,
|
|
|
|
nonce: hexlify(randomBytes(32)),
|
2021-11-02 08:45:49 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
const exampleBid = () => ({
|
2021-11-02 08:04:51 +00:00
|
|
|
price: 42,
|
2022-02-15 16:01:54 +00:00
|
|
|
bidExpiry: now() + hours(1),
|
2021-11-02 08:04:51 +00:00
|
|
|
})
|
|
|
|
|
2022-02-16 13:38:19 +00:00
|
|
|
const exampleOffer = () => ({
|
|
|
|
price: 42,
|
|
|
|
expiry: now() + hours(1),
|
|
|
|
})
|
|
|
|
|
2022-02-15 16:01:54 +00:00
|
|
|
const exampleLock = () => ({
|
2022-02-16 09:50:00 +00:00
|
|
|
id: hexlify(randomBytes(32)),
|
2022-02-15 16:01:54 +00:00
|
|
|
expiry: now() + hours(1),
|
|
|
|
})
|
|
|
|
|
2022-02-16 13:38:19 +00:00
|
|
|
module.exports = { exampleRequest, exampleOffer, exampleBid, exampleLock }
|