【发布时间】:2019-11-20 13:56:45
【问题描述】:
这是一个很难解释的问题,我会尽力而为:
我写了一份更新房地产所有权的合同。我有卖家(所有者)、买家和其他一些功能。
但我希望这份合同是临时合同。由于卖方部署它,买方有 30 秒(例如)签署合同。 如果买方不及时签订合同,合同就会做一些事情(例如自毁)。签名是将 bool 属性从 false 更改为 true。
我写了一个修饰符来解释我的目标:
modifier upTo30Seconds
{
if( now-timeOfContractCreation > 30)
{
if(isContractPayed && buyerSign == false)
{
emit notifyCancelOffer(address(this), buyerAddress , oldOwnerAddress); //notifyCancelOffer
selfdestruct(buyerAddress); //Destruct the contract and return ether to the buyer
}
}
_;
}
//'timeOfContractCreation' is another property, initialized in the constructor, and its means the time of deployment (since 01/01/1970)
//'now' is a solidity method which returns the time passed in seconds since 01/01/1970
这个修饰符在函数调用中效果很好,但我希望这些动作能够自动执行。
我的要求有点类似于线程运行。 是否可以使用solidity来做到这一点?
【问题讨论】:
标签: solidity