合约调用合约的三种方式
Blog iconfiveeth
May 20
第一种:接口形式调用合约为什么采用这种方式? 原因是因为被调用合约过于复杂的时候,全引入进来的话没有必要! 被调用合约:// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Counter { uint public count; function inc() external { count += 1; } function dec() external { count -= 1; } } 调用合约:// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // 这个接口名称叫什么不重要,规范建议首字母大写 interface ICounter { function count() external view returns(uint); function inc() external; } contract Interface { uint public count; // _counter为被调用合约的地址 function examples(a...

fiveeth

Written by
fiveeth

a little boy like crypto

Subscribe

2025 Paragraph Technologies Inc

PopularTrendingPrivacyTermsHome
Search...Ctrl+K

fiveeth

Subscribe