zoukankan      html  css  js  c++  java
  • Solidity智能合约调用智能合约

    来源:https://medium.com/@blockchain101/calling-the-function-of-another-contract-in-solidity-f9edfa921f4c

    合约一:

    pragma solidity ^0.4.18;
    contract Deployed {
        uint public a = 1;
        
        function setA(uint _a) public returns (uint) {
            a = _a;
            return a;
        }
        
    }

    合约二调用合约一:

    pragma solidity ^0.4.18;
    contract Deployed {
        
        function setA(uint) public returns (uint) {}
        
        function a() public pure returns (uint) {}
        
    }
    contract Existing  {
        
        Deployed dc;
        
        function Existing(address _t) public {
            dc = Deployed(_t);
        }
     
        function getA() public view returns (uint result) {
            return dc.a();
        }
        
        function setA(uint _val) public returns (uint result) {
            dc.setA(_val);
            return _val;
        }
        
    }
  • 相关阅读:
    毕设(五)ListView
    毕设(四)ListBox
    毕设(三)NotifyIcon
    hdu 1.2.3
    ZOJ 1789 The Suspects
    ZOJ 2833 Friendship
    git
    yum wget rpm
    上传绕过
    LAMP 和 LNMP
  • 原文地址:https://www.cnblogs.com/huahuayu/p/8981068.html
Copyright © 2011-2022 走看看