我目前正在使用 Brownie 学习智能合约和区块链开发。我无法理解如何使用 python 脚本从智能合约中调用函数和检查变量的值。我怎么能做到这一点?
下面我有一个合同DutchAuction
,我在其中定义了一个函数,该函数仅出于测试目的bid()
而返回'Hello world'
,我试图调用它。
pragma solidity ^0.8.10;
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
contract DutchAuction {
uint public startTime;
uint public endTime;
uint public price;
uint public startPrice;
address public assetOwner;
constructor(uint _startPrice, uint _endTime) public {
startTime = block.timestamp;
price = _startPrice;
startPrice = _startPrice;
endTime = _endTime;
assetOwner = msg.sender;
}
function bid() public returns (string calldata) {
return 'hello world';
}
}