Ether

布朗尼合約互動

  • December 31, 2021

如果我在帶有巧克力蛋糕的 ganache 上部署公開拍賣合約,我如何使用 brownie 命令將出價發送到合約中?

**>>> Openauction[0].bid(Wei(1e18))**給我一個錯誤,如何將 eth 發送到沒有參數的函式?

收到此錯誤:

文件“brownie/convert/normalize.py”,第 15 行,在 format_input raise TypeError(f"{abi[’name’]} requires no arguments") TypeError:bid requires no arguments

@public
@payable
def bid():
# Check if bidding period is over.
assert block.timestamp < self.auctionEnd
# Check if bid is high enough
assert msg.value > self.highestBid
# Track the refund for the previous high bidder
self.pendingReturns[self.highestBidder] += self.highestBid
# Track new high bid
self.highestBidder = msg.sender
self.highestBid = msg.value

完整合約來源:https ://kauri.io/#collections/Getting%20Started/an-introduction-to-smart-contracts-with-vyper/#introductory-open-auction-example

我很感激任何幫助,謝謝。

Openauction[0].bid({‘from’:accounts[0], ‘amount’: 1e18})

引用自:https://ethereum.stackexchange.com/questions/117440