UNPKG

gray-market-js

Version:

Utility library for the Gray Market rental marketplace

22 lines (20 loc) 907 B
const { BigNumber, ethers } = require("ethers"); const grayMarketABI = require("./abi/GrayMarket.json"); class RentalListingFulfiller { constructor() {} async fulfill(signerOrProvider, verifyingContract, listingData, custodyProviderData, rentalLength) { const order = { listing: listingData.params, lenderSignature: listingData.lenderSignature, custodyProviderData: custodyProviderData.data, custodyProviderSignature: custodyProviderData.signature, rentalLength } console.log("order:", order, "rental length:", rentalLength, "value:", listingData.params.costPerSecond.mul(rentalLength)); const contract = new ethers.Contract(verifyingContract, grayMarketABI, signerOrProvider); await contract.execute(order, { value: listingData.params.costPerSecond.mul(rentalLength) }); } } module.exports = RentalListingFulfiller;