{"id":20063,"date":"2022-10-02T18:14:46","date_gmt":"2022-10-02T18:14:46","guid":{"rendered":"https:\/\/mdr.foobrdigital.com\/?p=9176"},"modified":"2022-10-02T18:14:46","modified_gmt":"2022-10-02T18:14:46","slug":"interacting-with-the-contract","status":"publish","type":"post","link":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/2022\/10\/02\/interacting-with-the-contract\/","title":{"rendered":"Interacting with the Contract"},"content":{"rendered":"\n<p>When you click the deployed contract, you will see the various public methods provided by the contract. This is shown in the screenshot below.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.tutorialspoint.com\/ethereum\/images\/deploy_public_methods.jpg\" alt=\"Deploy Public Methods\"\/><\/figure>\n\n\n\n<p>The first method&nbsp;<strong>send<\/strong>&nbsp;contains an edit box in front of it. Here, you will type the parameters required by the contract method. The other two methods do not take any parameters.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Sending Money<\/h2>\n\n\n\n<p>Now, enter some amount such as 100 in front of the&nbsp;<strong>send<\/strong>&nbsp;function seen in the contract window. Click the&nbsp;<strong>send<\/strong>&nbsp;button. This will execute the contract&nbsp;<strong>send<\/strong>&nbsp;method, reducing the value of the contract&nbsp;<strong>value<\/strong>&nbsp;field and increasing the value of the&nbsp;<strong>amount<\/strong>&nbsp;field.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.tutorialspoint.com\/ethereum\/images\/sending_money.jpg\" alt=\"Sending Money\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Examining Contract Value<\/h2>\n\n\n\n<p>The previous&nbsp;<strong>send money<\/strong>&nbsp;action has reduced the contract value by 100. You can now examine this by invoking the&nbsp;<strong>getBalance<\/strong>&nbsp;method of the contract. You will see the output when you click on the&nbsp;<strong>getBalance<\/strong>&nbsp;button as shown in the screenshot below \u2212<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.tutorialspoint.com\/ethereum\/images\/examining_contract_value.jpg\" alt=\"Examining Contract Value\"\/><\/figure>\n\n\n\n<p>The contract&nbsp;<strong>value<\/strong>&nbsp;is now reduced to 900.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Examining Collected Amount<\/h2>\n\n\n\n<p>In this section, we will examine the amount of money collected so far on this contract. For this, click on the&nbsp;<strong>getAmount<\/strong>&nbsp;button. The following screen will appear.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.tutorialspoint.com\/ethereum\/images\/examining_collected_amount.jpg\" alt=\"Examining Collected Amount\"\/><\/figure>\n\n\n\n<p>The&nbsp;<strong>amount<\/strong>&nbsp;field value has changed from 0 to 100.<\/p>\n\n\n\n<p>Try a few&nbsp;<strong>send<\/strong>&nbsp;operations and examine the contract&nbsp;<strong>value<\/strong>&nbsp;and the&nbsp;<strong>amount<\/strong>&nbsp;fields to conclude that the deployed contract is executing as expected.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you click the deployed contract, you will see the various public methods provided by the contract. This is shown in the screenshot below. The first method&nbsp;send&nbsp;contains an edit box in front of it. Here, you will type the parameters required by the contract method. The other two methods do not take any parameters. Sending [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[71],"tags":[],"_links":{"self":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/20063"}],"collection":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/comments?post=20063"}],"version-history":[{"count":0,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/20063\/revisions"}],"wp:attachment":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/media?parent=20063"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/categories?post=20063"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/tags?post=20063"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}