我已经成功地在 MEW 上部署了一个用 vyper 编写的智能合约(来源如下)。当我尝试向合约发送资金时,交易被撤销。我已经尝试尽可能简化代码,但它仍然被挂断。我在想我的 assert 调用把它绊倒了,所以我也删除了它们,但仍然遇到了问题。最后,我尝试了一个超级简单的“Hello World”合约,并且在部署后也恢复了。我在这一点上不知所措。任何人都知道为什么我会收到还原错误?
struct Funder:
sender: address
value: wei_value
funders: map(int128, Funder)
nextFunderIndex: int128
beneficiary: address
prizeAcc: address
deadline: public(timestamp)
refundIndex: int128
timelimit: public(timedelta)
@public
def __init__(_beneficiary: address, _prizeAcc: address, _timelimit: timedelta):
self.beneficiary = _beneficiary
self.prizeAcc = _prizeAcc
self.timelimit = _timelimit
self.deadline = block.timestamp +_timelimit
# Participate in this crowdfunding campaign
@public
@payable
def participate():
assert block.timestamp < self.deadline, "Participation deadline has passed"
assert msg.value == 10**16, 'Must send exactly 0.01 ETH to participate'
# place funder's info in to struct (address & contributed amt)
nfi: int128 = self.nextFunderIndex
self.funders[nfi] = Funder({sender: msg.sender, value: msg.value})
self.nextFunderIndex = nfi + 1
send(self.prizeAcc, 5*10**15)
# deadline passed Send funds to the beneficiary
@public
def finalize():
assert block.timestamp >= self.deadline, "deadline has passed"
# this conditions must be met to finalize
selfdestruct(self.prizeAcc)