Answered step by step
Verified Expert Solution
Question
1 Approved Answer
URGENT HELP WITH SOLIDITY !!!!!!! Im new to SMART CONTRACTS and trying to write to code please help!!!! it shouldn't take long but because i'm
URGENT HELP WITH SOLIDITY !!!!!!!
Im new to SMART CONTRACTS and trying to write to code please help!!!! it shouldn't take long but because i'm new i'm stumped.
pragma solidity ^0.4.0; contract Payments { uint256 public n1; uint256 public n2; uint256 public n3; uint256 public n4; ... }
- Adding a function set1 that takes a parameter x of type uint256. It should assign x to n1. Anyone should be able to call this function.
- Adding a function set2 that takes a parameter x of type uint256. It should assign x to n2. Anyone should be able to call this function as long as they pay a fixed fee (the amount is up to you). Your function should check that the fee has been sent by using msg.value in a require statement.
- Adding a function set3 that takes a parameter x of type uint256. It should assign x to n3. Anyone should be able to call this function. But in addition to the assignment to n3, the contract Payments should transfer some ether to the caller. The amount to transfer should be the lesser of 100 szabo (1 szabo = 1 microether) and 10% of the contract's current balance.
- Adding a function set4 that takes a parameter x of type uint256. It should assign x to n4. Only the address that deployed the contract should be able to call this function. That is, your function should check the sender using msg.sender in a require statement. Note that you will need to add a state variable and an appropriate constructor to your contract.
To transfer money to the caller of a contract
msg.sender.transfer(amount);
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started