Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions tasks/store-data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
task(
"store-data",
"Stores data on an Edge-UR Node, and Filecoin"
)
.addParam("contract", "The address of the deal client solidity")
.addParam("uri", "The uri of the data to store")
.setAction(async (taskArgs) => {
//store taskargs as useable variables
//convert piece CID string to hex bytes
const contractAddr = taskArgs.contract
const uri = taskArgs.uri

const networkId = network.name
console.log("Making deal proposal on network", networkId)

//create a new wallet instance
const wallet = new ethers.Wallet(network.config.accounts[0], ethers.provider)

//create a EdgeURContract contract factory
const EdgeURContract = await ethers.getContractFactory("EdgeURContract", wallet)
//create a EdgeURContract contract instance
//this is what you will call to interact with the deployed contract
const edgeURContract = await EdgeURContract.attach(contractAddr)

//send a transaction to call makeDealProposal() method
transaction = await edgeURContract.StoreURI(uri)
transactionReceipt = await transaction.wait()

//listen for DealProposalCreate event
//const event = transactionReceipt.events[0].topics[1]
console.log("Complete! Event Emitted. ProposalId is:", transactionReceipt)
})