evm_setNextBlockTimestamp और evm_setNextBlockTimestamp।
सही समय प्राप्त करना
एक transaction याeth_call के execution के दौरान एक contract के अंदर block.timestamp को access किया जाता है, तो value इस पर निर्भर करेगी कि target block (latest या pending) block है या नहीं:
pendingblock के लिए:block.timestamp == time.now() + adjustment_offset। यह time-adjustment methods द्वारा adjusted current time को दर्शाता है।latestblock के लिए:block.timestamp == latest_block.timestamp। यह सबसे हाल ही में mined block का timestamp है।
adjustment_offset time-adjustment methods से आता है:
-
evm_setNextBlockTimestamp: अगले block के लिए timestamp पर time को skip करता है:adjustment_offset = timestamp - time.now()। -
evm_increaseTime: time को एक relative amount से आगे बढ़ाता है।adjustment_offset += increase_value
उदाहरण
एक offset से time बढ़ाएं
showLineNumbers
pending block के लिए timestamp सेट करें
showLineNumbers