Skip to content

Commit

Permalink
Update Deploy.js resolved iiitl#6
Browse files Browse the repository at this point in the history
calling addSeller and getAllSellers function in deploy.js
  • Loading branch information
salonii04 authored Mar 17, 2024
1 parent 79abb1f commit 15b71d0
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions scripts/Deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,33 @@ async function main() {

console.log('Contract address: ' + contract.address);

// Add sellers
await addSellers(contract);

// Call getAllSellers function
// Retrieve and display seller names
await displaySellerNames(contract);

console.log("Mining starting");
}

async function addSellers(contract) {
// addSeller function to add some sellers
await contract.addSeller("Seller1");
await contract.addSeller("Seller2");
await contract.addSeller("Seller3");
console.log('Sellers added successfully');
}

async function displaySellerNames(contract) {
// Call getAllSellers function in displaySellerNames function
const [sellerAddresses, sellerNames] = await contract.getAllSellers();
console.log('Retrieved seller addresses:', sellerAddresses);
console.log('Retrieved seller names:', sellerNames);

console.log('Displaying seller names:');
for (let i = 0; i < sellerNames.length; i++) {
console.log(`Seller ${i + 1}: ${sellerNames[i]}`);
}


}

Expand Down

0 comments on commit 15b71d0

Please sign in to comment.