codex-contracts-eth/test/marketplace.js
Mark Spanbroek 6ef71f0419 Introduces StorageContract
A StorageContract can only be instantiated when a request
for storage and a bid have been signed.
2021-10-12 16:59:34 +02:00

22 lines
518 B
JavaScript

const { ethers } = require("hardhat")
function hashRequest(duration, size) {
return ethers.utils.solidityKeccak256(
["string", "uint", "uint"],
["[dagger.request.v1]", duration, size]
)
}
function hashBid(requestHash, price) {
return ethers.utils.solidityKeccak256(
["string", "bytes32", "uint"],
["[dagger.bid.v1]", requestHash, price]
)
}
async function sign(signer, hash) {
return await signer.signMessage(ethers.utils.arrayify(hash))
}
module.exports = { hashRequest, hashBid, sign }