/**
* Find the `value` stored in the contract
*
* @param {ethers.Contract} contract - ethers.js contract instance
* @return {promise} a promise which resolves with the `value`
*/functiongetValue(contract) {
let value =contract.value();
return value;
}
module.exports = getValue;
/**
* Modify the `value` stored in the contract
*
* @param {ethers.Contract} contract - ethers.js contract instance
* @return {promise} a promise of transaction
*/functionsetValue(contract) {
returncontract.modify(6);
}
module.exports = setValue;
/**
* Transfer funds on the contract from the current signer
* to the friends address
*
* @param {ethers.Contract} contract - ethers.js contract instance
* @param {string} friend - a string containing a hexadecimal ethereum address
* @return {promise} a promise of the transfer transaction
*/functiontransfer(contract, friend) {
returncontract.transfer(friend, 1000);
}
module.exports = transfer;
/**
* Set the message on the contract using the signer passed in
*
* @param {ethers.Contract} contract - ethers.js contract instance
* @param {ethers.types.Signer} signer - ethers.js signer instance
* @return {promise} a promise of transaction modifying the `message`
*/functionsetMessage(contract, signer) {
returncontract.connect(signer).modify("abc");
}
module.exports = setMessage;
const ethers =require('ethers');
/**
* Deposit at least 1 ether into the contract
*
* @param {ethers.Contract} contract - ethers.js contract instance
* @return {promise} a promise of the deposit transaction
*/functiondeposit(contract) {
returncontract.deposit({ value: ethers.utils.parseEther("3") });
}
module.exports = deposit;
pragmasolidity ^0.8.4;contractContract{
functionsumAndAverage(uint a, uint b, uint c, uint d) externalpurereturns(uint,uint) {
uint sum = a + b + c + d;
uint average = sum /4;
return (sum, average);
}
}