go to  ForumEasy.com   
JavaPro
Home » Archive » Message


[Email To Friend][View in Live Context][prev topic « prev post | next post » next topic]
  Step 3. Compile the contract
 
Subject: Step 3. Compile the contract
Author: WebSpider
In response to: Step 2. Code the contract
Posted on: 06/07/2021 06:52:49 AM


  • Click on the compiler icon on the very left panel
  • Click the button Compile Account.sol
  • Make sure the compiler icon is green checked

    After successful compilation, a file named Account.json is generated under folder artifacts

    Account.json
    {
    	"deploy": {
    	},
    	"data": {
    		"bytecode": {
    			"generatedSources": [],
    			"linkReferences": {},
    			"object": "6080604...",
    			"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE ... ",
    			"sourceMap": "141:574:0:-:0;;;;;;;;;;;;;;;;;;;"
    		},
    		"deployedBytecode": {
    			"generatedSources": [
    				{ ... }
    			],
    			"immutableReferences": {},
    			"linkReferences": {},
    			"object": "60806040... ",
    			"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE ... ",
    			"sourceMap": "141:574:0:-:0; ... "
    		},
    		"gasEstimates": {
    			"creation": {
    				"codeDepositCost": "108600",
    				"executionCost": "153",
    				"totalCost": "108753"
    			},
    			"external": {
    				"deposite(uint256)": "infinite",
    				"getBalance()": "1115",
    				"withdraw(uint256)": "infinite"
    			}
    		},
    		"methodIdentifiers": {
    			"deposite(uint256)": "3104562b",
    			"getBalance()": "12065fe0",
    			"withdraw(uint256)": "2e1a7d4d"
    		}
    	},
    	"abi": [
    		{
    			"inputs": [
    				{
    					"internalType": "uint256",
    					"name": "amount",
    					"type": "uint256"
    				}
    			],
    			"name": "deposite",
    			"outputs": [],
    			"stateMutability": "nonpayable",
    			"type": "function"
    		},
    		{
    			"inputs": [],
    			"name": "getBalance",
    			"outputs": [
    				{
    					"internalType": "uint256",
    					"name": "",
    					"type": "uint256"
    				}
    			],
    			"stateMutability": "view",
    			"type": "function"
    		},
    		{
    			"inputs": [
    				{
    					"internalType": "uint256",
    					"name": "amount",
    					"type": "uint256"
    				}
    			],
    			"name": "withdraw",
    			"outputs": [],
    			"stateMutability": "nonpayable",
    			"type": "function"
    		}
    	]
    }
    


    It should be noted that two critical items abi and bytecode are listed, also present is gasEstimates.

     

    > On 06/07/2021 06:48:49 AM WebSpider wrote:

    Account.sol
    pragma solidity >=0.7.0 <0.9.0;
    
    /**
     * @title Account
     * @dev Store & retrieve value in a variable
     */
    contract Account {
    
        uint256 balance;
    
        /**
         * @dev Deposit amount into account
         * @param amount value to deposit
         */
        function deposite(uint256 amount) public {
            balance += amount;
        }
    
        /**
         * @dev Withdraw amount from account
         * @param amount value to withdraw
         */
        function withdraw(uint256 amount) public {
            balance += amount;
        }
    
        /**
         * @dev Return balance 
         * @return balance value of 'number'
         */
        function getBalance() public view returns (uint256){
            return balance;
        }
        
    }
    





    References:

  •  


     
    Powered by ForumEasy © 2002-2022, All Rights Reserved. | Privacy Policy | Terms of Use
     
    Get your own forum today. It's easy and free.