Rename: StorageContracts -> Storage

This commit is contained in:
Mark Spanbroek 2021-11-01 16:34:01 +01:00
parent eefa23ff02
commit 7b6c6c2fc5
3 changed files with 29 additions and 34 deletions

View File

@ -4,7 +4,7 @@ pragma solidity ^0.8.0;
import "./Contracts.sol";
import "./Proofs.sol";
contract StorageContracts is Contracts, Proofs {
contract Storage is Contracts, Proofs {
function newContract(
uint _duration,

View File

@ -2,7 +2,7 @@ const { expect } = require("chai")
const { ethers } = require("hardhat")
const { hashRequest, hashBid, sign } = require("./marketplace")
describe("Storage Contracts", function () {
describe("Contracts", function () {
const duration = 31 * 24 * 60 * 60 // 31 days
const size = 1 * 1024 * 1024 * 1024 // 1 Gigabyte

View File

@ -2,7 +2,9 @@ const { expect } = require("chai")
const { ethers } = require("hardhat")
const { hashRequest, hashBid, sign } = require("./marketplace")
describe("Storage Contracts", function () {
describe("Storage", function () {
describe("creating a new storage contract", function () {
const duration = 31 * 24 * 60 * 60 // 31 days
const size = 1 * 1024 * 1024 * 1024 // 1 Gigabyte
@ -12,17 +14,15 @@ describe("Storage Contracts", function () {
const price = 42
const nonce = ethers.utils.randomBytes(32)
var contracts
var client, host
var bidExpiry
var requestHash, bidHash
var id
let contracts
let client, host
let id
beforeEach(async function () {
[client, host] = await ethers.getSigners()
let StorageContracts = await ethers.getContractFactory("StorageContracts")
let StorageContracts = await ethers.getContractFactory("Storage")
contracts = await StorageContracts.deploy()
requestHash = hashRequest(
let requestHash = hashRequest(
duration,
size,
contentHash,
@ -30,14 +30,9 @@ describe("Storage Contracts", function () {
proofTimeout,
nonce
)
bidExpiry = Math.round(Date.now() / 1000) + 60 * 60 // 1 hour from now
bidHash = hashBid(requestHash, bidExpiry, price)
let bidExpiry = Math.round(Date.now() / 1000) + 60 * 60 // 1 hour from now
let bidHash = hashBid(requestHash, bidExpiry, price)
id = bidHash
})
describe("when properly instantiated", function () {
beforeEach(async function () {
await contracts.newContract(
duration,
size,
@ -53,7 +48,7 @@ describe("Storage Contracts", function () {
)
})
it("created a contract", async function () {
it("created the contract", async function () {
expect(await contracts.duration(id)).to.equal(duration)
expect(await contracts.size(id)).to.equal(size)
expect(await contracts.contentHash(id)).to.equal(contentHash)