/**
*submitted for verification at etherscan.io on 2019-06-10
*/pragma solidity >=
0.5.0
;pragma experimental abiencoderv2;
// spdx-license-identifier: gpl-3.0
/// @title multicall - aggregate results from multiple read-only function calls
/// @author michael elliot
/// @author joshua levine
/// @author nick johnson
contract multicall
function
aggregate
(call[
] memory calls)
public
returns
(uint256 blocknumber, bytes[
] memory returndata)
}// helper functions
function
getethbalance
(address addr)
public view returns
(uint256 balance)
function
getblockhash
(uint256 blocknumber)
public view returns
(bytes32 blockhash)
function
getlastblockhash()
public view returns
(bytes32 blockhash)
function
getcurrentblocktimestamp()
public view returns
(uint256 timestamp)
function
getcurrentblockdifficulty()
public view returns
(uint256 difficulty)
function
getcurrentblockgaslimit()
public view returns
(uint256 gaslimit)
function
getcurrentblockcoinbase()
public view returns
(address coinbase)
}
//引入web3
const web3 =
require
('web3');
const web3 =
newweb3
('');
//部署合約的abi
const abi =[,
],"internaltype"
:"struct multicall.call"
,"name"
:"calls"
,"type"
:"tuple"}]
,"name"
:"aggregate"
,"outputs":[
,],"payable"
:false
,"statemutability"
:"nonpayable"
,"type"
:"function"},
],"name"
:"getblockhash"
,"outputs":[
],"payable"
:false
,"statemutability"
:"view"
,"type"
:"function"},
],"payable"
:false
,"statemutability"
:"view"
,"type"
:"function"},
],"payable"
:false
,"statemutability"
:"view"
,"type"
:"function"},
],"payable"
:false
,"statemutability"
:"view"
,"type"
:"function"},
],"payable"
:false
,"statemutability"
:"view"
,"type"
:"function"},
],"name"
:"getethbalance"
,"outputs":[
],"payable"
:false
,"statemutability"
:"view"
,"type"
:"function"},
],"payable"
:false
,"statemutability"
:"view"
,"type"
:"function"}]
;//部署到鏈上的合約的位址
const address =
'0xd573a1f062751a4f947f1769b5d78c1815420bf9'
;//通過new web3.eth.contract(abi, address)動態建立乙個合約例項
let mycontract =
newweb3.eth.contract
(abi, address)
;//getethbalance方法是合約中的方法,methods為調取合約方法的內建方法
mycontract.methods.
getethbalance
('0x88ded3010c9e9b2b2d1914b07c0d674281952d19').
call()
.then
(console.log)
;
對函式的簡單呼叫
1.實現乙個函式,列印乘法口訣表,口訣表的行數和列數自己指定,輸入9,輸出9 9口訣表,輸出12,輸出12 12的乘法口訣表。define crt secure no warnings 1 include int main int a 0 scanf d a void table int x tab...
外設capsense的簡單呼叫
1.熟悉外設capsense的簡單使用,使用到了兩個button,乙個5元素的slide,cypress提供演算法供呼叫檢測外設capsense。2.jtag程式設計將micro usb連線在板子的j1口上 3.結果如圖所示 5.示例 1 include 23 define constants fo...
在C 中簡單呼叫FindWindow控制其他程式
c 本身是沒有findwindow這個函式的,為什麼沒有呢?很簡單,c 畢竟是微軟自家開發出來的。而win api中本來封裝了很多對視窗的操作,所以當然能重用的就要重用,這些封裝好的函式一般在系統dll中。那應該要怎麼在c 中呼叫封裝好的dll呢?這就要用到c 中的乙個屬性類 dllimport,d...