ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Solidity balance Ex1
    Search: Blockchain Blockchain 2023. 1. 2. 15:06

     

    예제

    //SPDX-License-Identifier: UNLICENSED
    pragma solidity >=0.7.0 <0.9.0;
    
    contract GetBalance1 {
    	function getBalance(address _addr) public view returns(uint) {
    		return _addr.balance;
    	}
    }

     

    Deploy

    account: 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4

    creation of GetBalance1 pending...
    [vm]from: 0x5B3...eddC4to: GetBalance1.(constructor)value: 0 weidata: 0x608...70033logs: 0hash: 0x935...560f6
    status	true Transaction mined and execution succeed
    transaction hash	0x935e0cf9a60f8690312505262024c9555f55227c0245e56378b336b2f9a560f6
    from	0x5B38Da6a701c568545dCfcB03FcB875f56beddC4
    to	GetBalance1.(constructor)
    gas	155259 gas
    transaction cost	135007 gas 
    execution cost	135007 gas 
    input	0x608...70033
    decoded input	{}
    decoded output	 - 
    logs	[]
    val	0 wei

     

    getBalance함수실행

    account: 0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2

    call to GetBalance1.getBalance
    CALL
    [call]from: 0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2to: GetBalance1.getBalance(address)data: 0xf8b...c02db
    from	0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2
    to	GetBalance1.getBalance(address) 0xd9145CCE52D386f254917e481eB44e9943F39138
    execution cost	24667 gas (Cost only applies when called by a contract)
    input	0xf8b...c02db
    decoded input	{
    	"address _addr": "0x4B20993Bc481177ec7E8f571ceCaE8A9e22C02db"
    }
    decoded output	{
    	"0": "uint256: 100000000000000000000"
    }
    logs	[]

     

    'Blockchain' 카테고리의 다른 글

    ERC721 관련  (0) 2023.01.07
    Truffle 예제 'pet-shop'  (0) 2023.01.03
    Solidity send Ex1  (0) 2023.01.02
    Nodejs + Vsc에서 remixd 사용  (0) 2023.01.02
    Solidity Ether units (ether, gwei, wei) Ex1  (0) 2023.01.02
    Solidity 화폐 수신 - fallback, receive  (0) 2023.01.02
    Solidity 화폐 송신 - send, call, transfer  (0) 2023.01.02
    Solidity msg (msg.sender, msg.value)  (0) 2023.01.02

    댓글