Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HELP WITH SOLIDITY AND SMART CONTRACTS!!! Im new to SMART CONTRACT and trying to write to code please help!!!! it shouldn't take long but because

HELP WITH SOLIDITY AND SMART CONTRACTS!!!

Im new to SMART CONTRACT and trying to write to code please help!!!! it shouldn't take long but because i'm new i'm stumped.

  • 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Xxviii Special Issue On Database And Expert Systems Applications Lncs 9940

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Qimin Chen

1st Edition

3662534541, 978-3662534540

More Books

Students also viewed these Databases questions

Question

Describe how you could purify iodine by sublimation.

Answered: 1 week ago

Question

Explain the strength of acid and alkali solutions with examples

Answered: 1 week ago

Question

Introduce and define metals and nonmetals and explain with examples

Answered: 1 week ago

Question

understand the meaning of the terms discipline and grievance

Answered: 1 week ago