Data replication, renewal and repair (RaaS)
Replicate, Renew, and Repair your storage deals with a service
Introduction
RaaS modules
Tutorial
Interacting with the Smart Contract
// contractInstance is the address of the contract you deployed or the FullInterface address above.
const dealStatus = await ethers.getContractAt("DealStatus", contractInstance);
// Submit the CID of the file you want to upload to the Filecoin network in the following way.
await dealStatus.submit(ethers.utils.toUtf8Bytes(newJob.cid));Replicate, renew, and repair
// Initialize the listener for the Deal Creation event
async function initializeDealCreationListener() {
const dealStatus = await ethers.getContractAt(contractName, contractInstance);
/// Logic for handling SubmitAggregatorRequest events
function handleEvent(transactionId, cid) {
console.log(`Received SubmitAggregatorRequest event: (Transaction ID: ${transactionId}, CID: ${cid})`);
// ... other code to handle the event emission
(async () => {
// ... other code
// After processing this event, reattach the event listener
if (dealStatus.listenerCount("SubmitAggregatorRequest") === 0) {
dealStatus.once("SubmitAggregatorRequest", handleEvent);
}
})();
}
// Start listening to the first event and recursively handle the next events
if (dealStatus.listenerCount("SubmitAggregatorRequest") === 0) {
dealStatus.once("SubmitAggregatorRequest", handleEvent);
}
}Last updated