-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestcode.js
More file actions
126 lines (117 loc) · 3.48 KB
/
testcode.js
File metadata and controls
126 lines (117 loc) · 3.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
Some test code instances.
*/
exports.assemblyfunc1 = `contract c1 {
function addAssembly(uint x, uint y) public pure returns (uint) {
assembly {
let y := add(x, 3)
let z := add(keccak256(0x0, 0x20), div(slength, 32))
let n // an initial empty 0 value is assigned
}
}}`
exports.assemblyfunc = `contract c1 {
function at(address _addr) {
address x = 0xdCad3a6d3569DF655070DEd06cb7A1b2Ccd1D3AF;
assembly {
mstore(0x80, add(mload(0x80), 3))
=: abcde
function power(base, exponent) -> result {
switch exponent
case 0 { result := 1 }
case 1 { result := base }
default {
result := power(mul(base, base), div(exponent, 2))
switch mod(exponent, 2)
case 1 { result := mul(base, result) }
}
return(res, 0x20)
}
for { let i := 0 } lt(i, 0x100) { i := add(i, 0x20) } {
x := add(x, mload(i))
}
// retrieve the size of the code, this needs assembly
let size := extcodesize(_addr)
ab :
if slt(x, 0) { x := sub(0, x) }
}
}
}`
exports.modifiercode = `
contract c7172{
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
uint _;
require(msg.sender == owner);
_;
}
}`
exports.functioncode1 = `contract c7053{
function Ownable(uint a) public payable returns (unit a) {
landsPurchased();
uint x;
require(newOwner != address(this),'Something bad happened');
mapping (address => uint32) lands;
abc x;
string data = "test";
owner = msg.sender;
stateVar = new uint[](2);
stateVar[0] = 1;
a>1 ? a=2 : a=1;
return (7, true, 2);
if (a > 2) {
a = 2;
if(i==5){
break;
}
else{
continue;
}
}
}
}`
exports.functioncode = `contract c7053{
//checks that the player is not already in the game
// modifier notPlayingAlready()
// {
// //one not resolved duel per player only
// uint progress = player_progress[msg.sender];
// uint position = player_bet_position[msg.sender];
//
// if (progress == 2 ) throw;
// if (progress == 1 ) throw; //no selfdueling
// _;
// }
function transferOwnership(address newOwner) internal view onlyOwner(5) {
return (uint256)(a - b);
proposals[proposal].voteCount += sender.weight;
uint[] stateVar;
uint b = 0x123456789ffaa;
b = 6;
revert();
require(newOwner != address(this));
uint d = testd(b);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
for (uint i=0; i<5; i++) {
if ( progress==3 && position==1 ) throw;
}
do{
newOwner--;
} while(newOwner>0);
}
}`
exports.functioncode2 = `
contract yx {
function withdrawOnce (int amount) public {
if (amount >1 ether || transferred [msg.sender]) {
revert();
}
else {
msg.sender.transfer(uint(amount));
transferred[msg.sender]=true;
}
log("execution time", now);
}
}`