mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-30 15:17:58 +00:00
support the origin opcode (#103)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
/* runner.json
|
||||
{
|
||||
"differential": true,
|
||||
"actions": [
|
||||
{
|
||||
"Upload": {
|
||||
"code": {
|
||||
"Solidity": {
|
||||
"contract": "TransactionOrigin"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Instantiate": {
|
||||
"code": {
|
||||
"Solidity": {
|
||||
"contract": "TransactionTester"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"Call": {
|
||||
"dest": {
|
||||
"Instantiated": 0
|
||||
},
|
||||
"data": "f8a8fd6d"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
*/
|
||||
|
||||
contract TransactionTester {
|
||||
constructor() payable {
|
||||
assert(tx.origin == new TransactionOrigin().test());
|
||||
}
|
||||
|
||||
function test() public payable returns (address ret) {
|
||||
ret = tx.origin;
|
||||
}
|
||||
}
|
||||
|
||||
contract TransactionOrigin {
|
||||
function test() public payable returns (address ret) {
|
||||
assert(msg.sender != tx.origin);
|
||||
|
||||
ret = tx.origin;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user