codex-contracts-eth/test/examples.js

24 lines
621 B
JavaScript
Raw Normal View History

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