2021-11-02 09:04:51 +01:00
|
|
|
const { ethers } = require("hardhat")
|
2022-02-15 17:01:54 +01:00
|
|
|
const { now, hours } = require("./time")
|
2022-04-06 14:26:56 +02:00
|
|
|
const { hexlify, randomBytes } = ethers.utils
|
2021-11-02 09:04:51 +01:00
|
|
|
|
2021-11-02 09:45:49 +01:00
|
|
|
const exampleRequest = () => ({
|
2022-02-17 11:00:18 +01:00
|
|
|
client: hexlify(randomBytes(20)),
|
2022-04-06 14:26:56 +02:00
|
|
|
ask: {
|
|
|
|
size: 1 * 1024 * 1024 * 1024, // 1 Gigabyte
|
|
|
|
duration: hours(10),
|
|
|
|
proofProbability: 4, // require a proof roughly once every 4 periods
|
|
|
|
maxPrice: 84,
|
|
|
|
},
|
|
|
|
content: {
|
|
|
|
cid: "zb2rhheVmk3bLks5MgzTqyznLu1zqGH5jrfTA1eAZXrjx7Vob",
|
|
|
|
erasure: {
|
|
|
|
totalChunks: 12,
|
|
|
|
totalNodes: 4,
|
|
|
|
nodeId: 3,
|
|
|
|
},
|
|
|
|
por: {
|
|
|
|
u: Array.from(randomBytes(480)),
|
|
|
|
publicKey: Array.from(randomBytes(96)),
|
|
|
|
name: Array.from(randomBytes(512)),
|
|
|
|
},
|
|
|
|
},
|
2022-02-17 12:24:27 +01:00
|
|
|
expiry: now() + hours(1),
|
2022-02-16 10:50:00 +01:00
|
|
|
nonce: hexlify(randomBytes(32)),
|
2021-11-02 09:45:49 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
const exampleBid = () => ({
|
2021-11-02 09:04:51 +01:00
|
|
|
price: 42,
|
2022-02-15 17:01:54 +01:00
|
|
|
bidExpiry: now() + hours(1),
|
2021-11-02 09:04:51 +01:00
|
|
|
})
|
|
|
|
|
2022-02-16 14:38:19 +01:00
|
|
|
const exampleOffer = () => ({
|
2022-02-21 11:31:37 +01:00
|
|
|
requestId: hexlify(randomBytes(32)),
|
2022-02-17 11:06:14 +01:00
|
|
|
host: hexlify(randomBytes(20)),
|
2022-02-16 14:38:19 +01:00
|
|
|
price: 42,
|
|
|
|
expiry: now() + hours(1),
|
|
|
|
})
|
|
|
|
|
2022-02-15 17:01:54 +01:00
|
|
|
const exampleLock = () => ({
|
2022-02-16 10:50:00 +01:00
|
|
|
id: hexlify(randomBytes(32)),
|
2022-02-15 17:01:54 +01:00
|
|
|
expiry: now() + hours(1),
|
|
|
|
})
|
|
|
|
|
2022-02-16 14:38:19 +01:00
|
|
|
module.exports = { exampleRequest, exampleOffer, exampleBid, exampleLock }
|