├── .gitignore ├── CODE_OF_CONDUCT.md ├── README.md ├── contracts ├── Migrations.sol ├── bounty │ └── BountyIndex.sol ├── shared │ └── strings.sol ├── token │ └── BasicERC20Token.sol └── zeppelin-solidity ├── docker-compose.yml ├── liscense.txt ├── migrations ├── 1_initial_migration.js └── 2_deploy_contracts.js ├── mnemonic.js.dist ├── package-lock.json ├── package.json ├── scripts ├── getabi.py ├── install.bash ├── prepTestRPC.bash ├── prepTestRPC │ ├── mint.js │ ├── sampleBounty.js │ └── sendETH.js └── stats │ ├── dilligence_scoping.bash │ └── get_coverage_num.bash ├── test ├── bounty │ └── bounty.js ├── token │ └── ERC20.js └── tools.js └── truffle.js /.gitignore: -------------------------------------------------------------------------------- 1 | build/contracts/* 2 | *.DS_Store* 3 | *.pyc 4 | mnemonic.js 5 | node_modules/* 6 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | Contributions to this project are governed by the Contributor Covenant version 1.4 (https://www.contributor-covenant.org/version/1/4/code-of-conduct.html). All contributors and participants agree to abide by its terms. To report violations, send an email to founders@gitcoin.co 2 | 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | DEPRECATED - PLS SEE THE NEW CONTRACTS HERE 2 | 3 | 1. https://github.com/gitcoinco/governance-docs 4 | 2. https://github.com/gitcoinco/merkle_payouts 5 | 3. https://github.com/gitcoinco/BulkTransactions 6 | -------------------------------------------------------------------------------- /contracts/Migrations.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.4; 2 | 3 | contract Migrations { 4 | address public owner; 5 | uint public last_completed_migration; 6 | 7 | modifier restricted() { 8 | if (msg.sender == owner) _; 9 | } 10 | 11 | function Migrations() { 12 | owner = msg.sender; 13 | } 14 | 15 | function setCompleted(uint completed) restricted { 16 | last_completed_migration = completed; 17 | } 18 | 19 | function upgrade(address new_address) restricted { 20 | Migrations upgraded = Migrations(new_address); 21 | upgraded.setCompleted(last_completed_migration); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /contracts/bounty/BountyIndex.sol: -------------------------------------------------------------------------------- 1 | // this contract is deprecated 2 | // instead, please see StandardBounties at 3 | // https://github.com/Bounties-Network/StandardBounties -------------------------------------------------------------------------------- /contracts/shared/strings.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.4.8; 2 | 3 | /* 4 | * @title String & slice utility library for Solidity contracts. 5 | * @author Nick Johnson 6 | * 7 | * @dev Functionality in this library is largely implemented using an 8 | * abstraction called a 'slice'. A slice represents a part of a string - 9 | * anything from the entire string to a single character, or even no 10 | * characters at all (a 0-length slice). Since a slice only has to specify 11 | * an offset and a length, copying and manipulating slices is a lot less 12 | * expensive than copying and manipulating the strings they reference. 13 | * 14 | * To further reduce gas costs, most functions on slice that need to return 15 | * a slice modify the original one instead of allocating a new one; for 16 | * instance, `s.split(".")` will return the text up to the first '.', 17 | * modifying s to only contain the remainder of the string after the '.'. 18 | * In situations where you do not want to modify the original slice, you 19 | * can make a copy first with `.copy()`, for example: 20 | * `s.copy().split(".")`. Try and avoid using this idiom in loops; since 21 | * Solidity has no memory management, it will result in allocating many 22 | * short-lived slices that are later discarded. 23 | * 24 | * Functions that return two slices come in two versions: a non-allocating 25 | * version that takes the second slice as an argument, modifying it in 26 | * place, and an allocating version that allocates and returns the second 27 | * slice; see `nextRune` for example. 28 | * 29 | * Functions that have to copy string data will return strings rather than 30 | * slices; these can be cast back to slices for further processing if 31 | * required. 32 | * 33 | * For convenience, some functions are provided with non-modifying 34 | * variants that create a new slice and return both; for instance, 35 | * `s.splitNew('.')` leaves s unmodified, and returns two values 36 | * corresponding to the left and right parts of the string. 37 | */ 38 | library strings { 39 | struct slice { 40 | uint _len; 41 | uint _ptr; 42 | } 43 | 44 | function memcpy(uint dest, uint src, uint len) private { 45 | // Copy word-length chunks while possible 46 | for(; len >= 32; len -= 32) { 47 | assembly { 48 | mstore(dest, mload(src)) 49 | } 50 | dest += 32; 51 | src += 32; 52 | } 53 | 54 | // Copy remaining bytes 55 | uint mask = 256 ** (32 - len) - 1; 56 | assembly { 57 | let srcpart := and(mload(src), not(mask)) 58 | let destpart := and(mload(dest), mask) 59 | mstore(dest, or(destpart, srcpart)) 60 | } 61 | } 62 | 63 | /* 64 | * @dev Returns a slice containing the entire string. 65 | * @param self The string to make a slice from. 66 | * @return A newly allocated slice containing the entire string. 67 | */ 68 | function toSlice(string self) internal returns (slice) { 69 | uint ptr; 70 | assembly { 71 | ptr := add(self, 0x20) 72 | } 73 | return slice(bytes(self).length, ptr); 74 | } 75 | 76 | /* 77 | * @dev Returns the length of a null-terminated bytes32 string. 78 | * @param self The value to find the length of. 79 | * @return The length of the string, from 0 to 32. 80 | */ 81 | function len(bytes32 self) internal returns (uint) { 82 | uint ret; 83 | if (self == 0) 84 | return 0; 85 | if (self & 0xffffffffffffffffffffffffffffffff == 0) { 86 | ret += 16; 87 | self = bytes32(uint(self) / 0x100000000000000000000000000000000); 88 | } 89 | if (self & 0xffffffffffffffff == 0) { 90 | ret += 8; 91 | self = bytes32(uint(self) / 0x10000000000000000); 92 | } 93 | if (self & 0xffffffff == 0) { 94 | ret += 4; 95 | self = bytes32(uint(self) / 0x100000000); 96 | } 97 | if (self & 0xffff == 0) { 98 | ret += 2; 99 | self = bytes32(uint(self) / 0x10000); 100 | } 101 | if (self & 0xff == 0) { 102 | ret += 1; 103 | } 104 | return 32 - ret; 105 | } 106 | 107 | /* 108 | * @dev Returns a slice containing the entire bytes32, interpreted as a 109 | * null-termintaed utf-8 string. 110 | * @param self The bytes32 value to convert to a slice. 111 | * @return A new slice containing the value of the input argument up to the 112 | * first null. 113 | */ 114 | function toSliceB32(bytes32 self) internal returns (slice ret) { 115 | // Allocate space for `self` in memory, copy it there, and point ret at it 116 | assembly { 117 | let ptr := mload(0x40) 118 | mstore(0x40, add(ptr, 0x20)) 119 | mstore(ptr, self) 120 | mstore(add(ret, 0x20), ptr) 121 | } 122 | ret._len = len(self); 123 | } 124 | 125 | /* 126 | * @dev Returns a new slice containing the same data as the current slice. 127 | * @param self The slice to copy. 128 | * @return A new slice containing the same data as `self`. 129 | */ 130 | function copy(slice self) internal returns (slice) { 131 | return slice(self._len, self._ptr); 132 | } 133 | 134 | /* 135 | * @dev Copies a slice to a new string. 136 | * @param self The slice to copy. 137 | * @return A newly allocated string containing the slice's text. 138 | */ 139 | function toString(slice self) internal returns (string) { 140 | var ret = new string(self._len); 141 | uint retptr; 142 | assembly { retptr := add(ret, 32) } 143 | 144 | memcpy(retptr, self._ptr, self._len); 145 | return ret; 146 | } 147 | 148 | /* 149 | * @dev Returns the length in runes of the slice. Note that this operation 150 | * takes time proportional to the length of the slice; avoid using it 151 | * in loops, and call `slice.empty()` if you only need to know whether 152 | * the slice is empty or not. 153 | * @param self The slice to operate on. 154 | * @return The length of the slice in runes. 155 | */ 156 | function len(slice self) internal returns (uint) { 157 | // Starting at ptr-31 means the LSB will be the byte we care about 158 | var ptr = self._ptr - 31; 159 | var end = ptr + self._len; 160 | for (uint len = 0; ptr < end; len++) { 161 | uint8 b; 162 | assembly { b := and(mload(ptr), 0xFF) } 163 | if (b < 0x80) { 164 | ptr += 1; 165 | } else if(b < 0xE0) { 166 | ptr += 2; 167 | } else if(b < 0xF0) { 168 | ptr += 3; 169 | } else if(b < 0xF8) { 170 | ptr += 4; 171 | } else if(b < 0xFC) { 172 | ptr += 5; 173 | } else { 174 | ptr += 6; 175 | } 176 | } 177 | return len; 178 | } 179 | 180 | /* 181 | * @dev Returns true if the slice is empty (has a length of 0). 182 | * @param self The slice to operate on. 183 | * @return True if the slice is empty, False otherwise. 184 | */ 185 | function empty(slice self) internal returns (bool) { 186 | return self._len == 0; 187 | } 188 | 189 | /* 190 | * @dev Returns a positive number if `other` comes lexicographically after 191 | * `self`, a negative number if it comes before, or zero if the 192 | * contents of the two slices are equal. Comparison is done per-rune, 193 | * on unicode codepoints. 194 | * @param self The first slice to compare. 195 | * @param other The second slice to compare. 196 | * @return The result of the comparison. 197 | */ 198 | function compare(slice self, slice other) internal returns (int) { 199 | uint shortest = self._len; 200 | if (other._len < self._len) 201 | shortest = other._len; 202 | 203 | var selfptr = self._ptr; 204 | var otherptr = other._ptr; 205 | for (uint idx = 0; idx < shortest; idx += 32) { 206 | uint a; 207 | uint b; 208 | assembly { 209 | a := mload(selfptr) 210 | b := mload(otherptr) 211 | } 212 | if (a != b) { 213 | // Mask out irrelevant bytes and check again 214 | uint mask = ~(2 ** (8 * (32 - shortest + idx)) - 1); 215 | var diff = (a & mask) - (b & mask); 216 | if (diff != 0) 217 | return int(diff); 218 | } 219 | selfptr += 32; 220 | otherptr += 32; 221 | } 222 | return int(self._len) - int(other._len); 223 | } 224 | 225 | /* 226 | * @dev Returns true if the two slices contain the same text. 227 | * @param self The first slice to compare. 228 | * @param self The second slice to compare. 229 | * @return True if the slices are equal, false otherwise. 230 | */ 231 | function equals(slice self, slice other) internal returns (bool) { 232 | return compare(self, other) == 0; 233 | } 234 | 235 | /* 236 | * @dev Extracts the first rune in the slice into `rune`, advancing the 237 | * slice to point to the next rune and returning `self`. 238 | * @param self The slice to operate on. 239 | * @param rune The slice that will contain the first rune. 240 | * @return `rune`. 241 | */ 242 | function nextRune(slice self, slice rune) internal returns (slice) { 243 | rune._ptr = self._ptr; 244 | 245 | if (self._len == 0) { 246 | rune._len = 0; 247 | return rune; 248 | } 249 | 250 | uint len; 251 | uint b; 252 | // Load the first byte of the rune into the LSBs of b 253 | assembly { b := and(mload(sub(mload(add(self, 32)), 31)), 0xFF) } 254 | if (b < 0x80) { 255 | len = 1; 256 | } else if(b < 0xE0) { 257 | len = 2; 258 | } else if(b < 0xF0) { 259 | len = 3; 260 | } else { 261 | len = 4; 262 | } 263 | 264 | // Check for truncated codepoints 265 | if (len > self._len) { 266 | rune._len = self._len; 267 | self._ptr += self._len; 268 | self._len = 0; 269 | return rune; 270 | } 271 | 272 | self._ptr += len; 273 | self._len -= len; 274 | rune._len = len; 275 | return rune; 276 | } 277 | 278 | /* 279 | * @dev Returns the first rune in the slice, advancing the slice to point 280 | * to the next rune. 281 | * @param self The slice to operate on. 282 | * @return A slice containing only the first rune from `self`. 283 | */ 284 | function nextRune(slice self) internal returns (slice ret) { 285 | nextRune(self, ret); 286 | } 287 | 288 | /* 289 | * @dev Returns the number of the first codepoint in the slice. 290 | * @param self The slice to operate on. 291 | * @return The number of the first codepoint in the slice. 292 | */ 293 | function ord(slice self) internal returns (uint ret) { 294 | if (self._len == 0) { 295 | return 0; 296 | } 297 | 298 | uint word; 299 | uint len; 300 | uint div = 2 ** 248; 301 | 302 | // Load the rune into the MSBs of b 303 | assembly { word:= mload(mload(add(self, 32))) } 304 | var b = word / div; 305 | if (b < 0x80) { 306 | ret = b; 307 | len = 1; 308 | } else if(b < 0xE0) { 309 | ret = b & 0x1F; 310 | len = 2; 311 | } else if(b < 0xF0) { 312 | ret = b & 0x0F; 313 | len = 3; 314 | } else { 315 | ret = b & 0x07; 316 | len = 4; 317 | } 318 | 319 | // Check for truncated codepoints 320 | if (len > self._len) { 321 | return 0; 322 | } 323 | 324 | for (uint i = 1; i < len; i++) { 325 | div = div / 256; 326 | b = (word / div) & 0xFF; 327 | if (b & 0xC0 != 0x80) { 328 | // Invalid UTF-8 sequence 329 | return 0; 330 | } 331 | ret = (ret * 64) | (b & 0x3F); 332 | } 333 | 334 | return ret; 335 | } 336 | 337 | /* 338 | * @dev Returns the keccak-256 hash of the slice. 339 | * @param self The slice to hash. 340 | * @return The hash of the slice. 341 | */ 342 | function keccak(slice self) internal returns (bytes32 ret) { 343 | assembly { 344 | ret := sha3(mload(add(self, 32)), mload(self)) 345 | } 346 | } 347 | 348 | /* 349 | * @dev Returns true if `self` starts with `needle`. 350 | * @param self The slice to operate on. 351 | * @param needle The slice to search for. 352 | * @return True if the slice starts with the provided text, false otherwise. 353 | */ 354 | function startsWith(slice self, slice needle) internal returns (bool) { 355 | if (self._len < needle._len) { 356 | return false; 357 | } 358 | 359 | if (self._ptr == needle._ptr) { 360 | return true; 361 | } 362 | 363 | bool equal; 364 | assembly { 365 | let len := mload(needle) 366 | let selfptr := mload(add(self, 0x20)) 367 | let needleptr := mload(add(needle, 0x20)) 368 | equal := eq(sha3(selfptr, len), sha3(needleptr, len)) 369 | } 370 | return equal; 371 | } 372 | 373 | /* 374 | * @dev If `self` starts with `needle`, `needle` is removed from the 375 | * beginning of `self`. Otherwise, `self` is unmodified. 376 | * @param self The slice to operate on. 377 | * @param needle The slice to search for. 378 | * @return `self` 379 | */ 380 | function beyond(slice self, slice needle) internal returns (slice) { 381 | if (self._len < needle._len) { 382 | return self; 383 | } 384 | 385 | bool equal = true; 386 | if (self._ptr != needle._ptr) { 387 | assembly { 388 | let len := mload(needle) 389 | let selfptr := mload(add(self, 0x20)) 390 | let needleptr := mload(add(needle, 0x20)) 391 | equal := eq(sha3(selfptr, len), sha3(needleptr, len)) 392 | } 393 | } 394 | 395 | if (equal) { 396 | self._len -= needle._len; 397 | self._ptr += needle._len; 398 | } 399 | 400 | return self; 401 | } 402 | 403 | /* 404 | * @dev Returns true if the slice ends with `needle`. 405 | * @param self The slice to operate on. 406 | * @param needle The slice to search for. 407 | * @return True if the slice starts with the provided text, false otherwise. 408 | */ 409 | function endsWith(slice self, slice needle) internal returns (bool) { 410 | if (self._len < needle._len) { 411 | return false; 412 | } 413 | 414 | var selfptr = self._ptr + self._len - needle._len; 415 | 416 | if (selfptr == needle._ptr) { 417 | return true; 418 | } 419 | 420 | bool equal; 421 | assembly { 422 | let len := mload(needle) 423 | let needleptr := mload(add(needle, 0x20)) 424 | equal := eq(sha3(selfptr, len), sha3(needleptr, len)) 425 | } 426 | 427 | return equal; 428 | } 429 | 430 | /* 431 | * @dev If `self` ends with `needle`, `needle` is removed from the 432 | * end of `self`. Otherwise, `self` is unmodified. 433 | * @param self The slice to operate on. 434 | * @param needle The slice to search for. 435 | * @return `self` 436 | */ 437 | function until(slice self, slice needle) internal returns (slice) { 438 | if (self._len < needle._len) { 439 | return self; 440 | } 441 | 442 | var selfptr = self._ptr + self._len - needle._len; 443 | bool equal = true; 444 | if (selfptr != needle._ptr) { 445 | assembly { 446 | let len := mload(needle) 447 | let needleptr := mload(add(needle, 0x20)) 448 | equal := eq(sha3(selfptr, len), sha3(needleptr, len)) 449 | } 450 | } 451 | 452 | if (equal) { 453 | self._len -= needle._len; 454 | } 455 | 456 | return self; 457 | } 458 | 459 | // Returns the memory address of the first byte of the first occurrence of 460 | // `needle` in `self`, or the first byte after `self` if not found. 461 | function findPtr(uint selflen, uint selfptr, uint needlelen, uint needleptr) private returns (uint) { 462 | uint ptr; 463 | uint idx; 464 | 465 | if (needlelen <= selflen) { 466 | if (needlelen <= 32) { 467 | // Optimized assembly for 68 gas per byte on short strings 468 | assembly { 469 | let mask := not(sub(exp(2, mul(8, sub(32, needlelen))), 1)) 470 | let needledata := and(mload(needleptr), mask) 471 | let end := add(selfptr, sub(selflen, needlelen)) 472 | ptr := selfptr 473 | loop: 474 | jumpi(exit, eq(and(mload(ptr), mask), needledata)) 475 | ptr := add(ptr, 1) 476 | jumpi(loop, lt(sub(ptr, 1), end)) 477 | ptr := add(selfptr, selflen) 478 | exit: 479 | } 480 | return ptr; 481 | } else { 482 | // For long needles, use hashing 483 | bytes32 hash; 484 | assembly { hash := sha3(needleptr, needlelen) } 485 | ptr = selfptr; 486 | for (idx = 0; idx <= selflen - needlelen; idx++) { 487 | bytes32 testHash; 488 | assembly { testHash := sha3(ptr, needlelen) } 489 | if (hash == testHash) 490 | return ptr; 491 | ptr += 1; 492 | } 493 | } 494 | } 495 | return selfptr + selflen; 496 | } 497 | 498 | // Returns the memory address of the first byte after the last occurrence of 499 | // `needle` in `self`, or the address of `self` if not found. 500 | function rfindPtr(uint selflen, uint selfptr, uint needlelen, uint needleptr) private returns (uint) { 501 | uint ptr; 502 | 503 | if (needlelen <= selflen) { 504 | if (needlelen <= 32) { 505 | // Optimized assembly for 69 gas per byte on short strings 506 | assembly { 507 | let mask := not(sub(exp(2, mul(8, sub(32, needlelen))), 1)) 508 | let needledata := and(mload(needleptr), mask) 509 | ptr := add(selfptr, sub(selflen, needlelen)) 510 | loop: 511 | jumpi(ret, eq(and(mload(ptr), mask), needledata)) 512 | ptr := sub(ptr, 1) 513 | jumpi(loop, gt(add(ptr, 1), selfptr)) 514 | ptr := selfptr 515 | jump(exit) 516 | ret: 517 | ptr := add(ptr, needlelen) 518 | exit: 519 | } 520 | return ptr; 521 | } else { 522 | // For long needles, use hashing 523 | bytes32 hash; 524 | assembly { hash := sha3(needleptr, needlelen) } 525 | ptr = selfptr + (selflen - needlelen); 526 | while (ptr >= selfptr) { 527 | bytes32 testHash; 528 | assembly { testHash := sha3(ptr, needlelen) } 529 | if (hash == testHash) 530 | return ptr + needlelen; 531 | ptr -= 1; 532 | } 533 | } 534 | } 535 | return selfptr; 536 | } 537 | 538 | /* 539 | * @dev Modifies `self` to contain everything from the first occurrence of 540 | * `needle` to the end of the slice. `self` is set to the empty slice 541 | * if `needle` is not found. 542 | * @param self The slice to search and modify. 543 | * @param needle The text to search for. 544 | * @return `self`. 545 | */ 546 | function find(slice self, slice needle) internal returns (slice) { 547 | uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr); 548 | self._len -= ptr - self._ptr; 549 | self._ptr = ptr; 550 | return self; 551 | } 552 | 553 | /* 554 | * @dev Modifies `self` to contain the part of the string from the start of 555 | * `self` to the end of the first occurrence of `needle`. If `needle` 556 | * is not found, `self` is set to the empty slice. 557 | * @param self The slice to search and modify. 558 | * @param needle The text to search for. 559 | * @return `self`. 560 | */ 561 | function rfind(slice self, slice needle) internal returns (slice) { 562 | uint ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr); 563 | self._len = ptr - self._ptr; 564 | return self; 565 | } 566 | 567 | /* 568 | * @dev Splits the slice, setting `self` to everything after the first 569 | * occurrence of `needle`, and `token` to everything before it. If 570 | * `needle` does not occur in `self`, `self` is set to the empty slice, 571 | * and `token` is set to the entirety of `self`. 572 | * @param self The slice to split. 573 | * @param needle The text to search for in `self`. 574 | * @param token An output parameter to which the first token is written. 575 | * @return `token`. 576 | */ 577 | function split(slice self, slice needle, slice token) internal returns (slice) { 578 | uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr); 579 | token._ptr = self._ptr; 580 | token._len = ptr - self._ptr; 581 | if (ptr == self._ptr + self._len) { 582 | // Not found 583 | self._len = 0; 584 | } else { 585 | self._len -= token._len + needle._len; 586 | self._ptr = ptr + needle._len; 587 | } 588 | return token; 589 | } 590 | 591 | /* 592 | * @dev Splits the slice, setting `self` to everything after the first 593 | * occurrence of `needle`, and returning everything before it. If 594 | * `needle` does not occur in `self`, `self` is set to the empty slice, 595 | * and the entirety of `self` is returned. 596 | * @param self The slice to split. 597 | * @param needle The text to search for in `self`. 598 | * @return The part of `self` up to the first occurrence of `delim`. 599 | */ 600 | function split(slice self, slice needle) internal returns (slice token) { 601 | split(self, needle, token); 602 | } 603 | 604 | /* 605 | * @dev Splits the slice, setting `self` to everything before the last 606 | * occurrence of `needle`, and `token` to everything after it. If 607 | * `needle` does not occur in `self`, `self` is set to the empty slice, 608 | * and `token` is set to the entirety of `self`. 609 | * @param self The slice to split. 610 | * @param needle The text to search for in `self`. 611 | * @param token An output parameter to which the first token is written. 612 | * @return `token`. 613 | */ 614 | function rsplit(slice self, slice needle, slice token) internal returns (slice) { 615 | uint ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr); 616 | token._ptr = ptr; 617 | token._len = self._len - (ptr - self._ptr); 618 | if (ptr == self._ptr) { 619 | // Not found 620 | self._len = 0; 621 | } else { 622 | self._len -= token._len + needle._len; 623 | } 624 | return token; 625 | } 626 | 627 | /* 628 | * @dev Splits the slice, setting `self` to everything before the last 629 | * occurrence of `needle`, and returning everything after it. If 630 | * `needle` does not occur in `self`, `self` is set to the empty slice, 631 | * and the entirety of `self` is returned. 632 | * @param self The slice to split. 633 | * @param needle The text to search for in `self`. 634 | * @return The part of `self` after the last occurrence of `delim`. 635 | */ 636 | function rsplit(slice self, slice needle) internal returns (slice token) { 637 | rsplit(self, needle, token); 638 | } 639 | 640 | /* 641 | * @dev Counts the number of nonoverlapping occurrences of `needle` in `self`. 642 | * @param self The slice to search. 643 | * @param needle The text to search for in `self`. 644 | * @return The number of occurrences of `needle` found in `self`. 645 | */ 646 | function count(slice self, slice needle) internal returns (uint count) { 647 | uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr) + needle._len; 648 | while (ptr <= self._ptr + self._len) { 649 | count++; 650 | ptr = findPtr(self._len - (ptr - self._ptr), ptr, needle._len, needle._ptr) + needle._len; 651 | } 652 | } 653 | 654 | /* 655 | * @dev Returns True if `self` contains `needle`. 656 | * @param self The slice to search. 657 | * @param needle The text to search for in `self`. 658 | * @return True if `needle` is found in `self`, false otherwise. 659 | */ 660 | function contains(slice self, slice needle) internal returns (bool) { 661 | return rfindPtr(self._len, self._ptr, needle._len, needle._ptr) != self._ptr; 662 | } 663 | 664 | /* 665 | * @dev Returns a newly allocated string containing the concatenation of 666 | * `self` and `other`. 667 | * @param self The first slice to concatenate. 668 | * @param other The second slice to concatenate. 669 | * @return The concatenation of the two strings. 670 | */ 671 | function concat(slice self, slice other) internal returns (string) { 672 | var ret = new string(self._len + other._len); 673 | uint retptr; 674 | assembly { retptr := add(ret, 32) } 675 | memcpy(retptr, self._ptr, self._len); 676 | memcpy(retptr + self._len, other._ptr, other._len); 677 | return ret; 678 | } 679 | 680 | /* 681 | * @dev Joins an array of slices, using `self` as a delimiter, returning a 682 | * newly allocated string. 683 | * @param self The delimiter to use. 684 | * @param parts A list of slices to join. 685 | * @return A newly allocated string containing all the slices in `parts`, 686 | * joined with `self`. 687 | */ 688 | function join(slice self, slice[] parts) internal returns (string) { 689 | if (parts.length == 0) 690 | return ""; 691 | 692 | uint len = self._len * (parts.length - 1); 693 | for(uint i = 0; i < parts.length; i++) 694 | len += parts[i]._len; 695 | 696 | var ret = new string(len); 697 | uint retptr; 698 | assembly { retptr := add(ret, 32) } 699 | 700 | for(i = 0; i < parts.length; i++) { 701 | memcpy(retptr, parts[i]._ptr, parts[i]._len); 702 | retptr += parts[i]._len; 703 | if (i < parts.length - 1) { 704 | memcpy(retptr, self._ptr, self._len); 705 | retptr += self._len; 706 | } 707 | } 708 | 709 | return ret; 710 | } 711 | } -------------------------------------------------------------------------------- /contracts/token/BasicERC20Token.sol: -------------------------------------------------------------------------------- 1 | import "../zeppelin-solidity/contracts/token/MintableToken.sol"; 2 | 3 | pragma solidity ^0.4.8; 4 | 5 | contract BasicERC20Token is MintableToken { 6 | 7 | function () { 8 | //if ether is sent to this address, send it back. 9 | throw; 10 | } 11 | 12 | string public name = "BasicERC20"; 13 | uint8 public decimals = 18; 14 | string public symbol = "ERC"; 15 | string public version = '0.1'; 16 | 17 | function mint(address _to, uint256 _amount) canMint onlyOwner returns (bool) { 18 | 19 | // never ever ever allow total supply to be higher than foreverMaxSupply 20 | uint256 foreverMaxSupply = 1000000000000000000 * 600000000; //600000000 GIT 21 | if (totalSupply > foreverMaxSupply) { 22 | finishMinting(); 23 | return false; 24 | } 25 | 26 | super.mint(_to, _amount); 27 | } 28 | 29 | 30 | } -------------------------------------------------------------------------------- /contracts/zeppelin-solidity: -------------------------------------------------------------------------------- 1 | /usr/local/lib/node_modules/zeppelin-solidity -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | testrpc: 5 | image: trufflesuite/ganache-cli 6 | ports: 7 | - "8545:8545" 8 | -------------------------------------------------------------------------------- /liscense.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2017 Gitcoin Core 2 | founders@gitcoin.co 3 | 4 | 5 | GNU AFFERO GENERAL PUBLIC LICENSE 6 | Version 3, 19 November 2007 7 | 8 | Copyright (C) 2007 Free Software Foundation, Inc. 9 | Everyone is permitted to copy and distribute verbatim copies 10 | of this license document, but changing it is not allowed. 11 | 12 | Preamble 13 | 14 | The GNU Affero General Public License is a free, copyleft license for 15 | software and other kinds of works, specifically designed to ensure 16 | cooperation with the community in the case of network server software. 17 | 18 | The licenses for most software and other practical works are designed 19 | to take away your freedom to share and change the works. By contrast, 20 | our General Public Licenses are intended to guarantee your freedom to 21 | share and change all versions of a program--to make sure it remains free 22 | software for all its users. 23 | 24 | When we speak of free software, we are referring to freedom, not 25 | price. Our General Public Licenses are designed to make sure that you 26 | have the freedom to distribute copies of free software (and charge for 27 | them if you wish), that you receive source code or can get it if you 28 | want it, that you can change the software or use pieces of it in new 29 | free programs, and that you know you can do these things. 30 | 31 | Developers that use our General Public Licenses protect your rights 32 | with two steps: (1) assert copyright on the software, and (2) offer 33 | you this License which gives you legal permission to copy, distribute 34 | and/or modify the software. 35 | 36 | A secondary benefit of defending all users' freedom is that 37 | improvements made in alternate versions of the program, if they 38 | receive widespread use, become available for other developers to 39 | incorporate. Many developers of free software are heartened and 40 | encouraged by the resulting cooperation. However, in the case of 41 | software used on network servers, this result may fail to come about. 42 | The GNU General Public License permits making a modified version and 43 | letting the public access it on a server without ever releasing its 44 | source code to the public. 45 | 46 | The GNU Affero General Public License is designed specifically to 47 | ensure that, in such cases, the modified source code becomes available 48 | to the community. It requires the operator of a network server to 49 | provide the source code of the modified version running there to the 50 | users of that server. Therefore, public use of a modified version, on 51 | a publicly accessible server, gives the public access to the source 52 | code of the modified version. 53 | 54 | An older license, called the Affero General Public License and 55 | published by Affero, was designed to accomplish similar goals. This is 56 | a different license, not a version of the Affero GPL, but Affero has 57 | released a new version of the Affero GPL which permits relicensing under 58 | this license. 59 | 60 | The precise terms and conditions for copying, distribution and 61 | modification follow. 62 | 63 | TERMS AND CONDITIONS 64 | 65 | 0. Definitions. 66 | 67 | "This License" refers to version 3 of the GNU Affero General Public License. 68 | 69 | "Copyright" also means copyright-like laws that apply to other kinds of 70 | works, such as semiconductor masks. 71 | 72 | "The Program" refers to any copyrightable work licensed under this 73 | License. Each licensee is addressed as "you". "Licensees" and 74 | "recipients" may be individuals or organizations. 75 | 76 | To "modify" a work means to copy from or adapt all or part of the work 77 | in a fashion requiring copyright permission, other than the making of an 78 | exact copy. The resulting work is called a "modified version" of the 79 | earlier work or a work "based on" the earlier work. 80 | 81 | A "covered work" means either the unmodified Program or a work based 82 | on the Program. 83 | 84 | To "propagate" a work means to do anything with it that, without 85 | permission, would make you directly or secondarily liable for 86 | infringement under applicable copyright law, except executing it on a 87 | computer or modifying a private copy. Propagation includes copying, 88 | distribution (with or without modification), making available to the 89 | public, and in some countries other activities as well. 90 | 91 | To "convey" a work means any kind of propagation that enables other 92 | parties to make or receive copies. Mere interaction with a user through 93 | a computer network, with no transfer of a copy, is not conveying. 94 | 95 | An interactive user interface displays "Appropriate Legal Notices" 96 | to the extent that it includes a convenient and prominently visible 97 | feature that (1) displays an appropriate copyright notice, and (2) 98 | tells the user that there is no warranty for the work (except to the 99 | extent that warranties are provided), that licensees may convey the 100 | work under this License, and how to view a copy of this License. If 101 | the interface presents a list of user commands or options, such as a 102 | menu, a prominent item in the list meets this criterion. 103 | 104 | 1. Source Code. 105 | 106 | The "source code" for a work means the preferred form of the work 107 | for making modifications to it. "Object code" means any non-source 108 | form of a work. 109 | 110 | A "Standard Interface" means an interface that either is an official 111 | standard defined by a recognized standards body, or, in the case of 112 | interfaces specified for a particular programming language, one that 113 | is widely used among developers working in that language. 114 | 115 | The "System Libraries" of an executable work include anything, other 116 | than the work as a whole, that (a) is included in the normal form of 117 | packaging a Major Component, but which is not part of that Major 118 | Component, and (b) serves only to enable use of the work with that 119 | Major Component, or to implement a Standard Interface for which an 120 | implementation is available to the public in source code form. A 121 | "Major Component", in this context, means a major essential component 122 | (kernel, window system, and so on) of the specific operating system 123 | (if any) on which the executable work runs, or a compiler used to 124 | produce the work, or an object code interpreter used to run it. 125 | 126 | The "Corresponding Source" for a work in object code form means all 127 | the source code needed to generate, install, and (for an executable 128 | work) run the object code and to modify the work, including scripts to 129 | control those activities. However, it does not include the work's 130 | System Libraries, or general-purpose tools or generally available free 131 | programs which are used unmodified in performing those activities but 132 | which are not part of the work. For example, Corresponding Source 133 | includes interface definition files associated with source files for 134 | the work, and the source code for shared libraries and dynamically 135 | linked subprograms that the work is specifically designed to require, 136 | such as by intimate data communication or control flow between those 137 | subprograms and other parts of the work. 138 | 139 | The Corresponding Source need not include anything that users 140 | can regenerate automatically from other parts of the Corresponding 141 | Source. 142 | 143 | The Corresponding Source for a work in source code form is that 144 | same work. 145 | 146 | 2. Basic Permissions. 147 | 148 | All rights granted under this License are granted for the term of 149 | copyright on the Program, and are irrevocable provided the stated 150 | conditions are met. This License explicitly affirms your unlimited 151 | permission to run the unmodified Program. The output from running a 152 | covered work is covered by this License only if the output, given its 153 | content, constitutes a covered work. This License acknowledges your 154 | rights of fair use or other equivalent, as provided by copyright law. 155 | 156 | You may make, run and propagate covered works that you do not 157 | convey, without conditions so long as your license otherwise remains 158 | in force. You may convey covered works to others for the sole purpose 159 | of having them make modifications exclusively for you, or provide you 160 | with facilities for running those works, provided that you comply with 161 | the terms of this License in conveying all material for which you do 162 | not control copyright. Those thus making or running the covered works 163 | for you must do so exclusively on your behalf, under your direction 164 | and control, on terms that prohibit them from making any copies of 165 | your copyrighted material outside their relationship with you. 166 | 167 | Conveying under any other circumstances is permitted solely under 168 | the conditions stated below. Sublicensing is not allowed; section 10 169 | makes it unnecessary. 170 | 171 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 172 | 173 | No covered work shall be deemed part of an effective technological 174 | measure under any applicable law fulfilling obligations under article 175 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 176 | similar laws prohibiting or restricting circumvention of such 177 | measures. 178 | 179 | When you convey a covered work, you waive any legal power to forbid 180 | circumvention of technological measures to the extent such circumvention 181 | is effected by exercising rights under this License with respect to 182 | the covered work, and you disclaim any intention to limit operation or 183 | modification of the work as a means of enforcing, against the work's 184 | users, your or third parties' legal rights to forbid circumvention of 185 | technological measures. 186 | 187 | 4. Conveying Verbatim Copies. 188 | 189 | You may convey verbatim copies of the Program's source code as you 190 | receive it, in any medium, provided that you conspicuously and 191 | appropriately publish on each copy an appropriate copyright notice; 192 | keep intact all notices stating that this License and any 193 | non-permissive terms added in accord with section 7 apply to the code; 194 | keep intact all notices of the absence of any warranty; and give all 195 | recipients a copy of this License along with the Program. 196 | 197 | You may charge any price or no price for each copy that you convey, 198 | and you may offer support or warranty protection for a fee. 199 | 200 | 5. Conveying Modified Source Versions. 201 | 202 | You may convey a work based on the Program, or the modifications to 203 | produce it from the Program, in the form of source code under the 204 | terms of section 4, provided that you also meet all of these conditions: 205 | 206 | a) The work must carry prominent notices stating that you modified 207 | it, and giving a relevant date. 208 | 209 | b) The work must carry prominent notices stating that it is 210 | released under this License and any conditions added under section 211 | 7. This requirement modifies the requirement in section 4 to 212 | "keep intact all notices". 213 | 214 | c) You must license the entire work, as a whole, under this 215 | License to anyone who comes into possession of a copy. This 216 | License will therefore apply, along with any applicable section 7 217 | additional terms, to the whole of the work, and all its parts, 218 | regardless of how they are packaged. This License gives no 219 | permission to license the work in any other way, but it does not 220 | invalidate such permission if you have separately received it. 221 | 222 | d) If the work has interactive user interfaces, each must display 223 | Appropriate Legal Notices; however, if the Program has interactive 224 | interfaces that do not display Appropriate Legal Notices, your 225 | work need not make them do so. 226 | 227 | A compilation of a covered work with other separate and independent 228 | works, which are not by their nature extensions of the covered work, 229 | and which are not combined with it such as to form a larger program, 230 | in or on a volume of a storage or distribution medium, is called an 231 | "aggregate" if the compilation and its resulting copyright are not 232 | used to limit the access or legal rights of the compilation's users 233 | beyond what the individual works permit. Inclusion of a covered work 234 | in an aggregate does not cause this License to apply to the other 235 | parts of the aggregate. 236 | 237 | 6. Conveying Non-Source Forms. 238 | 239 | You may convey a covered work in object code form under the terms 240 | of sections 4 and 5, provided that you also convey the 241 | machine-readable Corresponding Source under the terms of this License, 242 | in one of these ways: 243 | 244 | a) Convey the object code in, or embodied in, a physical product 245 | (including a physical distribution medium), accompanied by the 246 | Corresponding Source fixed on a durable physical medium 247 | customarily used for software interchange. 248 | 249 | b) Convey the object code in, or embodied in, a physical product 250 | (including a physical distribution medium), accompanied by a 251 | written offer, valid for at least three years and valid for as 252 | long as you offer spare parts or customer support for that product 253 | model, to give anyone who possesses the object code either (1) a 254 | copy of the Corresponding Source for all the software in the 255 | product that is covered by this License, on a durable physical 256 | medium customarily used for software interchange, for a price no 257 | more than your reasonable cost of physically performing this 258 | conveying of source, or (2) access to copy the 259 | Corresponding Source from a network server at no charge. 260 | 261 | c) Convey individual copies of the object code with a copy of the 262 | written offer to provide the Corresponding Source. This 263 | alternative is allowed only occasionally and noncommercially, and 264 | only if you received the object code with such an offer, in accord 265 | with subsection 6b. 266 | 267 | d) Convey the object code by offering access from a designated 268 | place (gratis or for a charge), and offer equivalent access to the 269 | Corresponding Source in the same way through the same place at no 270 | further charge. You need not require recipients to copy the 271 | Corresponding Source along with the object code. If the place to 272 | copy the object code is a network server, the Corresponding Source 273 | may be on a different server (operated by you or a third party) 274 | that supports equivalent copying facilities, provided you maintain 275 | clear directions next to the object code saying where to find the 276 | Corresponding Source. Regardless of what server hosts the 277 | Corresponding Source, you remain obligated to ensure that it is 278 | available for as long as needed to satisfy these requirements. 279 | 280 | e) Convey the object code using peer-to-peer transmission, provided 281 | you inform other peers where the object code and Corresponding 282 | Source of the work are being offered to the general public at no 283 | charge under subsection 6d. 284 | 285 | A separable portion of the object code, whose source code is excluded 286 | from the Corresponding Source as a System Library, need not be 287 | included in conveying the object code work. 288 | 289 | A "User Product" is either (1) a "consumer product", which means any 290 | tangible personal property which is normally used for personal, family, 291 | or household purposes, or (2) anything designed or sold for incorporation 292 | into a dwelling. In determining whether a product is a consumer product, 293 | doubtful cases shall be resolved in favor of coverage. For a particular 294 | product received by a particular user, "normally used" refers to a 295 | typical or common use of that class of product, regardless of the status 296 | of the particular user or of the way in which the particular user 297 | actually uses, or expects or is expected to use, the product. A product 298 | is a consumer product regardless of whether the product has substantial 299 | commercial, industrial or non-consumer uses, unless such uses represent 300 | the only significant mode of use of the product. 301 | 302 | "Installation Information" for a User Product means any methods, 303 | procedures, authorization keys, or other information required to install 304 | and execute modified versions of a covered work in that User Product from 305 | a modified version of its Corresponding Source. The information must 306 | suffice to ensure that the continued functioning of the modified object 307 | code is in no case prevented or interfered with solely because 308 | modification has been made. 309 | 310 | If you convey an object code work under this section in, or with, or 311 | specifically for use in, a User Product, and the conveying occurs as 312 | part of a transaction in which the right of possession and use of the 313 | User Product is transferred to the recipient in perpetuity or for a 314 | fixed term (regardless of how the transaction is characterized), the 315 | Corresponding Source conveyed under this section must be accompanied 316 | by the Installation Information. But this requirement does not apply 317 | if neither you nor any third party retains the ability to install 318 | modified object code on the User Product (for example, the work has 319 | been installed in ROM). 320 | 321 | The requirement to provide Installation Information does not include a 322 | requirement to continue to provide support service, warranty, or updates 323 | for a work that has been modified or installed by the recipient, or for 324 | the User Product in which it has been modified or installed. Access to a 325 | network may be denied when the modification itself materially and 326 | adversely affects the operation of the network or violates the rules and 327 | protocols for communication across the network. 328 | 329 | Corresponding Source conveyed, and Installation Information provided, 330 | in accord with this section must be in a format that is publicly 331 | documented (and with an implementation available to the public in 332 | source code form), and must require no special password or key for 333 | unpacking, reading or copying. 334 | 335 | 7. Additional Terms. 336 | 337 | "Additional permissions" are terms that supplement the terms of this 338 | License by making exceptions from one or more of its conditions. 339 | Additional permissions that are applicable to the entire Program shall 340 | be treated as though they were included in this License, to the extent 341 | that they are valid under applicable law. If additional permissions 342 | apply only to part of the Program, that part may be used separately 343 | under those permissions, but the entire Program remains governed by 344 | this License without regard to the additional permissions. 345 | 346 | When you convey a copy of a covered work, you may at your option 347 | remove any additional permissions from that copy, or from any part of 348 | it. (Additional permissions may be written to require their own 349 | removal in certain cases when you modify the work.) You may place 350 | additional permissions on material, added by you to a covered work, 351 | for which you have or can give appropriate copyright permission. 352 | 353 | Notwithstanding any other provision of this License, for material you 354 | add to a covered work, you may (if authorized by the copyright holders of 355 | that material) supplement the terms of this License with terms: 356 | 357 | a) Disclaiming warranty or limiting liability differently from the 358 | terms of sections 15 and 16 of this License; or 359 | 360 | b) Requiring preservation of specified reasonable legal notices or 361 | author attributions in that material or in the Appropriate Legal 362 | Notices displayed by works containing it; or 363 | 364 | c) Prohibiting misrepresentation of the origin of that material, or 365 | requiring that modified versions of such material be marked in 366 | reasonable ways as different from the original version; or 367 | 368 | d) Limiting the use for publicity purposes of names of licensors or 369 | authors of the material; or 370 | 371 | e) Declining to grant rights under trademark law for use of some 372 | trade names, trademarks, or service marks; or 373 | 374 | f) Requiring indemnification of licensors and authors of that 375 | material by anyone who conveys the material (or modified versions of 376 | it) with contractual assumptions of liability to the recipient, for 377 | any liability that these contractual assumptions directly impose on 378 | those licensors and authors. 379 | 380 | All other non-permissive additional terms are considered "further 381 | restrictions" within the meaning of section 10. If the Program as you 382 | received it, or any part of it, contains a notice stating that it is 383 | governed by this License along with a term that is a further 384 | restriction, you may remove that term. If a license document contains 385 | a further restriction but permits relicensing or conveying under this 386 | License, you may add to a covered work material governed by the terms 387 | of that license document, provided that the further restriction does 388 | not survive such relicensing or conveying. 389 | 390 | If you add terms to a covered work in accord with this section, you 391 | must place, in the relevant source files, a statement of the 392 | additional terms that apply to those files, or a notice indicating 393 | where to find the applicable terms. 394 | 395 | Additional terms, permissive or non-permissive, may be stated in the 396 | form of a separately written license, or stated as exceptions; 397 | the above requirements apply either way. 398 | 399 | 8. Termination. 400 | 401 | You may not propagate or modify a covered work except as expressly 402 | provided under this License. Any attempt otherwise to propagate or 403 | modify it is void, and will automatically terminate your rights under 404 | this License (including any patent licenses granted under the third 405 | paragraph of section 11). 406 | 407 | However, if you cease all violation of this License, then your 408 | license from a particular copyright holder is reinstated (a) 409 | provisionally, unless and until the copyright holder explicitly and 410 | finally terminates your license, and (b) permanently, if the copyright 411 | holder fails to notify you of the violation by some reasonable means 412 | prior to 60 days after the cessation. 413 | 414 | Moreover, your license from a particular copyright holder is 415 | reinstated permanently if the copyright holder notifies you of the 416 | violation by some reasonable means, this is the first time you have 417 | received notice of violation of this License (for any work) from that 418 | copyright holder, and you cure the violation prior to 30 days after 419 | your receipt of the notice. 420 | 421 | Termination of your rights under this section does not terminate the 422 | licenses of parties who have received copies or rights from you under 423 | this License. If your rights have been terminated and not permanently 424 | reinstated, you do not qualify to receive new licenses for the same 425 | material under section 10. 426 | 427 | 9. Acceptance Not Required for Having Copies. 428 | 429 | You are not required to accept this License in order to receive or 430 | run a copy of the Program. Ancillary propagation of a covered work 431 | occurring solely as a consequence of using peer-to-peer transmission 432 | to receive a copy likewise does not require acceptance. However, 433 | nothing other than this License grants you permission to propagate or 434 | modify any covered work. These actions infringe copyright if you do 435 | not accept this License. Therefore, by modifying or propagating a 436 | covered work, you indicate your acceptance of this License to do so. 437 | 438 | 10. Automatic Licensing of Downstream Recipients. 439 | 440 | Each time you convey a covered work, the recipient automatically 441 | receives a license from the original licensors, to run, modify and 442 | propagate that work, subject to this License. You are not responsible 443 | for enforcing compliance by third parties with this License. 444 | 445 | An "entity transaction" is a transaction transferring control of an 446 | organization, or substantially all assets of one, or subdividing an 447 | organization, or merging organizations. If propagation of a covered 448 | work results from an entity transaction, each party to that 449 | transaction who receives a copy of the work also receives whatever 450 | licenses to the work the party's predecessor in interest had or could 451 | give under the previous paragraph, plus a right to possession of the 452 | Corresponding Source of the work from the predecessor in interest, if 453 | the predecessor has it or can get it with reasonable efforts. 454 | 455 | You may not impose any further restrictions on the exercise of the 456 | rights granted or affirmed under this License. For example, you may 457 | not impose a license fee, royalty, or other charge for exercise of 458 | rights granted under this License, and you may not initiate litigation 459 | (including a cross-claim or counterclaim in a lawsuit) alleging that 460 | any patent claim is infringed by making, using, selling, offering for 461 | sale, or importing the Program or any portion of it. 462 | 463 | 11. Patents. 464 | 465 | A "contributor" is a copyright holder who authorizes use under this 466 | License of the Program or a work on which the Program is based. The 467 | work thus licensed is called the contributor's "contributor version". 468 | 469 | A contributor's "essential patent claims" are all patent claims 470 | owned or controlled by the contributor, whether already acquired or 471 | hereafter acquired, that would be infringed by some manner, permitted 472 | by this License, of making, using, or selling its contributor version, 473 | but do not include claims that would be infringed only as a 474 | consequence of further modification of the contributor version. For 475 | purposes of this definition, "control" includes the right to grant 476 | patent sublicenses in a manner consistent with the requirements of 477 | this License. 478 | 479 | Each contributor grants you a non-exclusive, worldwide, royalty-free 480 | patent license under the contributor's essential patent claims, to 481 | make, use, sell, offer for sale, import and otherwise run, modify and 482 | propagate the contents of its contributor version. 483 | 484 | In the following three paragraphs, a "patent license" is any express 485 | agreement or commitment, however denominated, not to enforce a patent 486 | (such as an express permission to practice a patent or covenant not to 487 | sue for patent infringement). To "grant" such a patent license to a 488 | party means to make such an agreement or commitment not to enforce a 489 | patent against the party. 490 | 491 | If you convey a covered work, knowingly relying on a patent license, 492 | and the Corresponding Source of the work is not available for anyone 493 | to copy, free of charge and under the terms of this License, through a 494 | publicly available network server or other readily accessible means, 495 | then you must either (1) cause the Corresponding Source to be so 496 | available, or (2) arrange to deprive yourself of the benefit of the 497 | patent license for this particular work, or (3) arrange, in a manner 498 | consistent with the requirements of this License, to extend the patent 499 | license to downstream recipients. "Knowingly relying" means you have 500 | actual knowledge that, but for the patent license, your conveying the 501 | covered work in a country, or your recipient's use of the covered work 502 | in a country, would infringe one or more identifiable patents in that 503 | country that you have reason to believe are valid. 504 | 505 | If, pursuant to or in connection with a single transaction or 506 | arrangement, you convey, or propagate by procuring conveyance of, a 507 | covered work, and grant a patent license to some of the parties 508 | receiving the covered work authorizing them to use, propagate, modify 509 | or convey a specific copy of the covered work, then the patent license 510 | you grant is automatically extended to all recipients of the covered 511 | work and works based on it. 512 | 513 | A patent license is "discriminatory" if it does not include within 514 | the scope of its coverage, prohibits the exercise of, or is 515 | conditioned on the non-exercise of one or more of the rights that are 516 | specifically granted under this License. You may not convey a covered 517 | work if you are a party to an arrangement with a third party that is 518 | in the business of distributing software, under which you make payment 519 | to the third party based on the extent of your activity of conveying 520 | the work, and under which the third party grants, to any of the 521 | parties who would receive the covered work from you, a discriminatory 522 | patent license (a) in connection with copies of the covered work 523 | conveyed by you (or copies made from those copies), or (b) primarily 524 | for and in connection with specific products or compilations that 525 | contain the covered work, unless you entered into that arrangement, 526 | or that patent license was granted, prior to 28 March 2007. 527 | 528 | Nothing in this License shall be construed as excluding or limiting 529 | any implied license or other defenses to infringement that may 530 | otherwise be available to you under applicable patent law. 531 | 532 | 12. No Surrender of Others' Freedom. 533 | 534 | If conditions are imposed on you (whether by court order, agreement or 535 | otherwise) that contradict the conditions of this License, they do not 536 | excuse you from the conditions of this License. If you cannot convey a 537 | covered work so as to satisfy simultaneously your obligations under this 538 | License and any other pertinent obligations, then as a consequence you may 539 | not convey it at all. For example, if you agree to terms that obligate you 540 | to collect a royalty for further conveying from those to whom you convey 541 | the Program, the only way you could satisfy both those terms and this 542 | License would be to refrain entirely from conveying the Program. 543 | 544 | 13. Remote Network Interaction; Use with the GNU General Public License. 545 | 546 | Notwithstanding any other provision of this License, if you modify the 547 | Program, your modified version must prominently offer all users 548 | interacting with it remotely through a computer network (if your version 549 | supports such interaction) an opportunity to receive the Corresponding 550 | Source of your version by providing access to the Corresponding Source 551 | from a network server at no charge, through some standard or customary 552 | means of facilitating copying of software. This Corresponding Source 553 | shall include the Corresponding Source for any work covered by version 3 554 | of the GNU General Public License that is incorporated pursuant to the 555 | following paragraph. 556 | 557 | Notwithstanding any other provision of this License, you have 558 | permission to link or combine any covered work with a work licensed 559 | under version 3 of the GNU General Public License into a single 560 | combined work, and to convey the resulting work. The terms of this 561 | License will continue to apply to the part which is the covered work, 562 | but the work with which it is combined will remain governed by version 563 | 3 of the GNU General Public License. 564 | 565 | 14. Revised Versions of this License. 566 | 567 | The Free Software Foundation may publish revised and/or new versions of 568 | the GNU Affero General Public License from time to time. Such new versions 569 | will be similar in spirit to the present version, but may differ in detail to 570 | address new problems or concerns. 571 | 572 | Each version is given a distinguishing version number. If the 573 | Program specifies that a certain numbered version of the GNU Affero General 574 | Public License "or any later version" applies to it, you have the 575 | option of following the terms and conditions either of that numbered 576 | version or of any later version published by the Free Software 577 | Foundation. If the Program does not specify a version number of the 578 | GNU Affero General Public License, you may choose any version ever published 579 | by the Free Software Foundation. 580 | 581 | If the Program specifies that a proxy can decide which future 582 | versions of the GNU Affero General Public License can be used, that proxy's 583 | public statement of acceptance of a version permanently authorizes you 584 | to choose that version for the Program. 585 | 586 | Later license versions may give you additional or different 587 | permissions. However, no additional obligations are imposed on any 588 | author or copyright holder as a result of your choosing to follow a 589 | later version. 590 | 591 | 15. Disclaimer of Warranty. 592 | 593 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 594 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 595 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 596 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 597 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 598 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 599 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 600 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 601 | 602 | 16. Limitation of Liability. 603 | 604 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 605 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 606 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 607 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 608 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 609 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 610 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 611 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 612 | SUCH DAMAGES. 613 | 614 | 17. Interpretation of Sections 15 and 16. 615 | 616 | If the disclaimer of warranty and limitation of liability provided 617 | above cannot be given local legal effect according to their terms, 618 | reviewing courts shall apply local law that most closely approximates 619 | an absolute waiver of all civil liability in connection with the 620 | Program, unless a warranty or assumption of liability accompanies a 621 | copy of the Program in return for a fee. 622 | 623 | END OF TERMS AND CONDITIONS 624 | 625 | How to Apply These Terms to Your New Programs 626 | 627 | If you develop a new program, and you want it to be of the greatest 628 | possible use to the public, the best way to achieve this is to make it 629 | free software which everyone can redistribute and change under these terms. 630 | 631 | To do so, attach the following notices to the program. It is safest 632 | to attach them to the start of each source file to most effectively 633 | state the exclusion of warranty; and each file should have at least 634 | the "copyright" line and a pointer to where the full notice is found. 635 | 636 | 637 | Copyright (C) 638 | 639 | This program is free software: you can redistribute it and/or modify 640 | it under the terms of the GNU Affero General Public License as published by 641 | the Free Software Foundation, either version 3 of the License, or 642 | (at your option) any later version. 643 | 644 | This program is distributed in the hope that it will be useful, 645 | but WITHOUT ANY WARRANTY; without even the implied warranty of 646 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 647 | GNU Affero General Public License for more details. 648 | 649 | You should have received a copy of the GNU Affero General Public License 650 | along with this program. If not, see . 651 | 652 | Also add information on how to contact you by electronic and paper mail. 653 | 654 | If your software can interact with users remotely through a computer 655 | network, you should also make sure that it provides a way for users to 656 | get its source. For example, if your program is a web application, its 657 | interface could display a "Source" link that leads users to an archive 658 | of the code. There are many ways you could offer source, and different 659 | solutions will be better for different programs; see section 13 for the 660 | specific requirements. 661 | 662 | You should also get your employer (if you work as a programmer) or school, 663 | if any, to sign a "copyright disclaimer" for the program, if necessary. 664 | For more information on this, and how to apply and follow the GNU AGPL, see 665 | . -------------------------------------------------------------------------------- /migrations/1_initial_migration.js: -------------------------------------------------------------------------------- 1 | var Migrations = artifacts.require("./Migrations.sol"); 2 | 3 | module.exports = function(deployer) { 4 | deployer.deploy(Migrations); 5 | }; 6 | -------------------------------------------------------------------------------- /migrations/2_deploy_contracts.js: -------------------------------------------------------------------------------- 1 | var tools = require('../test/tools'); 2 | var BasicERC20Token = artifacts.require("./token/BasicERC20Token.sol"); 3 | var BountyIndex = artifacts.require("./bounty/BountyIndex.sol"); 4 | 5 | // IMPORTANT: If running live, make sure you choose a non-dumb value for 6 | var startblock = web3.eth.blockNumber + 10; 7 | var endBlock = startblock + 1000; 8 | 9 | var supply = tools.gitcoinSupply() * tools.weiPerEther(); 10 | module.exports = function(deployer, network) { 11 | deployer.deploy(BasicERC20Token).await.then(function(result){ 12 | deployer.deploy(BountyIndex); 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /mnemonic.js.dist: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | mnemonic: function() { 3 | var mnemonic = "foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar "; 4 | return mnemonic; 5 | }, 6 | }; 7 | 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "smart_contracts", 3 | "version": "1.0.0", 4 | "description": "Gitcoin smart contracts.", 5 | "main": "truffle.js", 6 | "directories": { 7 | "test": "test" 8 | }, 9 | "dependencies": { 10 | "bip39": "^2.5.0", 11 | "ethereumjs-wallet": "^0.6.0", 12 | "scrypt": "^6.0.3", 13 | "web3": "^1.0.0-beta.21", 14 | "web3-provider-engine": "^13.2.9", 15 | "zeppelin-solidity": "^1.5.0" 16 | }, 17 | "devDependencies": { 18 | "truffle": "^4.0.4" 19 | }, 20 | "scripts": { 21 | "test": "truffle test" 22 | }, 23 | "repository": { 24 | "type": "git", 25 | "url": "git+https://github.com/gitcoinco/smart_contracts.git" 26 | }, 27 | "keywords": [ 28 | "gitcoin", 29 | "ethereum" 30 | ], 31 | "author": "gitcoinco", 32 | "license": "GPL-3.0", 33 | "bugs": { 34 | "url": "https://github.com/gitcoinco/smart_contracts/issues" 35 | }, 36 | "homepage": "https://github.com/gitcoinco/smart_contracts#readme" 37 | } 38 | -------------------------------------------------------------------------------- /scripts/getabi.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import json 3 | from pprint import pprint 4 | 5 | file = "build/contracts/"+ sys.argv[1]+".json" 6 | 7 | with open(file) as data_file: 8 | data = json.load(data_file) 9 | print(json.dumps(data['abi'])); -------------------------------------------------------------------------------- /scripts/install.bash: -------------------------------------------------------------------------------- 1 | #TODO: update this 2 | 3 | npm install -g zeppelin-solidity 4 | cd contracts 5 | ln -s /usr/local/lib/node_modules/zeppelin-solidity zeppelin-solidity 6 | -------------------------------------------------------------------------------- /scripts/prepTestRPC.bash: -------------------------------------------------------------------------------- 1 | truffle deploy 2 | truffle exec scripts/prepTestRPC/sendETH.js 0xe93d33CF8AaF56C64D23b5b248919EabD8c3c41E 10 3 | truffle exec scripts/prepTestRPC/mint.js 0x7dd4bfd96981573ce7dbcde779adcdf2d3039332 0xD3d280C2866eAa795FC72BD850C48E7cCE166E23 100000 4 | for i in $(seq 1 10); do 5 | truffle exec scripts/prepTestRPC/sampleBounty.js 0x0ed0c2a859e9e576cdff840c51d29b6f8a405bdd 0x7dd4bfd96981573ce7dbcde779adcdf2d3039332 6 | done 7 | 8 | echo "please remember to refresh metamask by restarting chrome (or switching to mainnet and back)" -------------------------------------------------------------------------------- /scripts/prepTestRPC/mint.js: -------------------------------------------------------------------------------- 1 | var BasicERC20Token = artifacts.require("./token/BasicERC20Token.sol"); 2 | var tools = require('../../test/tools'); 3 | 4 | var args = process.argv.slice(2); 5 | 6 | var token_address = args[2]; 7 | var to_address = args[3]; 8 | var amount = args[4]; 9 | 10 | var deploy_from_address = web3.eth.accounts[0]; 11 | 12 | //console.log('args',token_address, to_address, amount) 13 | 14 | if(typeof token_address == 'undefined' || typeof to_address == 'undefined' || typeof amount == 'undefined'){ 15 | console.log('invalid arguments'); 16 | process.exit(); 17 | } 18 | 19 | module.exports = function(callback) { 20 | 21 | gitcoin = BasicERC20Token.at(token_address); 22 | gitcoin.mint(to_address, amount * tools.weiPerEther(), {from: deploy_from_address}).then(function(result){ 23 | gitcoin.balanceOf.call(to_address).then(function(result){ 24 | var balance = result.toNumber() / tools.weiPerEther(); 25 | console.log(balance); 26 | callback(); 27 | }); 28 | }); 29 | } -------------------------------------------------------------------------------- /scripts/prepTestRPC/sampleBounty.js: -------------------------------------------------------------------------------- 1 | var BasicERC20Token = artifacts.require("./token/BasicERC20Token.sol"); 2 | var BountyIndex = artifacts.require("./bounty/BountyIndex.sol"); 3 | var tools = require('../../test/tools'); 4 | 5 | var args = process.argv.slice(2); 6 | 7 | var bounty_address = args[2]; 8 | var tokenAddress = args[3]; 9 | 10 | var deploy_from_address = web3.eth.accounts[0]; 11 | var issueURL = "https://github.com/owocki/pytrader/issues/" + Math.floor(Math.random(0,100) * 100);; 12 | var amount = Math.floor(Math.random(0,100) * 10000) * tools.weiPerEther(); 13 | var fromUsername = "owocki"; 14 | var fromEmail = 'kevin@gitcoin.co'; 15 | 16 | 17 | //console.log('args',token_address, to_address, amount) 18 | 19 | if(typeof tokenAddress == 'undefined' || typeof bounty_address == 'undefined' || typeof amount == 'undefined'){ 20 | console.log('invalid arguments'); 21 | process.exit(); 22 | } 23 | 24 | module.exports = async function() { 25 | 26 | gitcoin = BasicERC20Token.at(tokenAddress); 27 | bountyindex = BountyIndex.at(bounty_address); 28 | await gitcoin.mint(deploy_from_address, amount); 29 | await gitcoin.approve(bountyindex.address, amount); 30 | await bountyindex.postBounty(issueURL, amount, tokenAddress, fromUsername, fromEmail); 31 | 32 | 33 | } -------------------------------------------------------------------------------- /scripts/prepTestRPC/sendETH.js: -------------------------------------------------------------------------------- 1 | var BasicERC20Token = artifacts.require("./token/BasicERC20Token.sol"); 2 | var tools = require('../../test/tools'); 3 | 4 | var args = process.argv.slice(2); 5 | 6 | var to_address = args[2]; 7 | var amount = args[3]; 8 | 9 | var send_from_address = web3.eth.accounts[0]; 10 | 11 | if(typeof to_address == 'undefined' || typeof amount == 'undefined'){ 12 | console.log('invalid arguments'); 13 | process.exit(); 14 | } 15 | 16 | module.exports = function(callback) { 17 | var amountInWei = amount * tools.weiPerEther(); 18 | const gasPrice = 100000000000; 19 | const gas = 2500000; 20 | web3.eth.sendTransaction({from: send_from_address, to: to_address, value: amountInWei, gas:gas, gasPrice: gasPrice}, function(errors,reuslts){ 21 | console.log(errors, reuslts); 22 | console.log(web3.eth.getBalance(to_address)); 23 | callback(); 24 | }); 25 | } -------------------------------------------------------------------------------- /scripts/stats/dilligence_scoping.bash: -------------------------------------------------------------------------------- 1 | cd contracts/contracts 2 | echo "num lines:" 3 | cat * | wc -l 4 | echo "num files:" 5 | ls | wc -l 6 | echo "num source files:" 7 | ls *.sol | wc -l 8 | echo "num functions:" 9 | cat * | grep function | wc -l 10 | cd ../test 11 | echo "How many of these functions are intended to be state changing?" 12 | echo " TODO" 13 | echo "How many functions are only intended to retrieve data? (getters)" 14 | echo " TODO" 15 | echo "What is the complete ABI of the contract system?" 16 | echo " -- Please upload the 'build/contracts folder" 17 | echo "num tests:" 18 | cat * | grep 'it(' | wc -l 19 | echo "tests:" 20 | cat * | grep 'it(' | sed 's/it(//g' | sed 's/function(done)//g' | sed 's/{//g' 21 | 22 | -------------------------------------------------------------------------------- /scripts/stats/get_coverage_num.bash: -------------------------------------------------------------------------------- 1 | cd 2 | cd Sites/gitcoin/contracts/solcover 3 | rm -Rf contracts 4 | rm -Rf ../originalContracts/ 5 | cp -Rf $HOME/Sites/gitcoin/contracts/contracts . 6 | node ./runCoveredTests.js 7 | rm -Rf ../originalContracts/ 8 | 9 | echo "please check /coverage/lcov-report/index.html" -------------------------------------------------------------------------------- /test/bounty/bounty.js: -------------------------------------------------------------------------------- 1 | var BountyIndex = artifacts.require("./BountyIndex.sol"); 2 | var Gitcoin = artifacts.require("./BasicERC20Token.sol"); 3 | var tools = require('../tools'); 4 | 5 | contract("BountyIndex", function(accounts) { 6 | 7 | //CREATION 8 | 9 | var issueURL = "https://github.com/owocki/pytrader/issues/46"; 10 | var issueURLWithSlash = issueURL + '/'; 11 | var amount = 100; 12 | var expirationTime = 60 * 60; 13 | var issueTitle = "Test issue 123"; 14 | var issueKeywords = "python, solidity, javascript"; 15 | var metadata = '{experienceLevel: "Senior", type: "bug", length: "weeks", fromEmail: "kevin@gitcoin.co", fromUsername: "owocki"}'; 16 | var claimee_metadata = '{fromEmail: "kevin@gitcoin.co", fromUsername: "owocki"}'; 17 | 18 | 19 | it("Bounty is posted and approved (ERC20)", async function() { 20 | //config 21 | var gitcoin = await Gitcoin.new({from: accounts[0]}); 22 | var bountyindex = await BountyIndex.new({from: accounts[0]}); 23 | var tokenAddress = gitcoin.address; 24 | 25 | //create coins 26 | await gitcoin.mint(accounts[0], amount); 27 | await gitcoin.approve(bountyindex.address, amount); 28 | 29 | //post bounty 30 | await bountyindex.postBounty(issueURL, amount, tokenAddress, expirationTime, metadata, {from: accounts[0]}); 31 | 32 | //verify bounty posted 33 | var bountydetail = await bountyindex.bountydetails.call(issueURLWithSlash); 34 | assert.isTrue(bountydetail[0].toNumber() == amount); 35 | assert.isTrue(bountydetail[1] == tokenAddress); 36 | var numBounties = await bountyindex.numBounties.call(); 37 | assert.isTrue(numBounties == 1); 38 | 39 | //verify escrow balance 40 | var escrowBalance = await gitcoin.balanceOf.call(bountyindex.address); 41 | assert.strictEqual(escrowBalance.toNumber(), amount); 42 | 43 | //claim bounty 44 | await bountyindex.claimBounty(issueURLWithSlash, claimee_metadata, {from: accounts[1]}); 45 | 46 | //approve bounty 47 | await bountyindex.approveBountyClaim(issueURLWithSlash, {from: accounts[0]}); 48 | 49 | //verify claimee balance is updated 50 | var claimeeBalance = await gitcoin.balanceOf.call(accounts[1]); 51 | assert.strictEqual(claimeeBalance.toNumber(), amount); 52 | 53 | 54 | }); 55 | 56 | it("Bounty is posted and approved (Ether)", async function() { 57 | //config 58 | var bountyindex = await BountyIndex.new({from: accounts[0]}); 59 | var _amount = 1 * tools.weiPerEther(); 60 | var _tokenAddress = '0x0000000000000000000000000000000000000000'; 61 | 62 | //post bounty 63 | await bountyindex.postBounty(issueURL, _amount, _tokenAddress, expirationTime, metadata, {from: accounts[0], value: _amount}); 64 | 65 | //verify bounty posted 66 | var bountydetail = await bountyindex.bountydetails.call(issueURLWithSlash); 67 | assert.isTrue(bountydetail[0].toNumber() == _amount); 68 | assert.isTrue(bountydetail[1] == _tokenAddress); 69 | var numBounties = await bountyindex.numBounties.call(); 70 | assert.isTrue(numBounties == 1); 71 | 72 | //verify escrow balance 73 | var escrowBalance = await web3.eth.getBalance(bountyindex.address); 74 | assert.strictEqual(escrowBalance.toNumber(), _amount); 75 | 76 | //claim bounty 77 | await bountyindex.claimBounty(issueURLWithSlash, claimee_metadata, {from: accounts[1]}); 78 | 79 | //approve bounty 80 | var claimeeBalanceBefore = await web3.eth.getBalance(accounts[1]); 81 | await bountyindex.approveBountyClaim(issueURLWithSlash, {from: accounts[0]}); 82 | 83 | //verify claimee balance is updated 84 | var claimeeBalanceAfter = await web3.eth.getBalance(accounts[1]); 85 | assert.strictEqual(claimeeBalanceAfter.toNumber() - claimeeBalanceBefore.toNumber(), _amount); 86 | 87 | 88 | }); 89 | 90 | it("Bounty is posted, expired, and clawed back", async function() { 91 | //config 92 | var bountyindex = await BountyIndex.new({from: accounts[0]}); 93 | var _amount = 1 * tools.weiPerEther(); 94 | var _tokenAddress = '0x0000000000000000000000000000000000000000'; 95 | 96 | var senderBalanceBefore = await web3.eth.getBalance(accounts[0]); 97 | 98 | //post bounty 99 | await bountyindex.postBounty(issueURL, _amount, _tokenAddress, expirationTime, metadata, {from: accounts[0], value: _amount}); 100 | 101 | var bountydetail = await bountyindex.bountydetails.call(issueURLWithSlash); 102 | 103 | //clawback will fail if bounty is not expired yet 104 | var gotError = false; 105 | try{ 106 | await bountyindex.clawbackExpiredBounty(issueURLWithSlash, {from: accounts[0]}); 107 | } catch(error) { 108 | gotError = true; 109 | } 110 | 111 | assert.isTrue(gotError); 112 | 113 | await tools.increaseTime(expirationTime + 10); 114 | await bountyindex.clawbackExpiredBounty(issueURLWithSlash, {from: accounts[0]}); 115 | 116 | //verify claimee balance is updated 117 | var senderBalanceAfter = await web3.eth.getBalance(accounts[0]); 118 | 119 | var priceDelta = senderBalanceBefore.toNumber() - senderBalanceAfter.toNumber(); 120 | console.log(priceDelta); 121 | assert.isTrue(priceDelta < 6160960 ); // delta should be gas fees, nothing more 122 | }); 123 | 124 | 125 | it("Bounty is posted and rejected", async function() { 126 | 127 | //config 128 | var gitcoin = await Gitcoin.new({from: accounts[0]}); 129 | var bountyindex = await BountyIndex.new({from: accounts[0]}); 130 | var tokenAddress = gitcoin.address; 131 | 132 | //create coins 133 | await gitcoin.mint(accounts[0], amount); 134 | await gitcoin.approve(bountyindex.address, amount); 135 | 136 | //post bounty 137 | await bountyindex.postBounty(issueURL, amount, tokenAddress, expirationTime, metadata, {from: accounts[0]}); 138 | 139 | //verify bounty posted 140 | var numBounties = await bountyindex.numBounties.call(); 141 | assert.isTrue(numBounties == 1); 142 | 143 | //verify escrow balance 144 | var escrowBalance = await gitcoin.balanceOf.call(bountyindex.address); 145 | assert.strictEqual(escrowBalance.toNumber(), amount); 146 | 147 | //claim bounty 148 | await bountyindex.claimBounty(issueURL, claimee_metadata, {from: accounts[1]}); 149 | 150 | //reject bounty 151 | await bountyindex.rejectBountyClaim(issueURL, {from: accounts[0]}); 152 | 153 | // verify claim status remains open 154 | // var claimStatus = await bountyindex.Bounties[BountyIndex.stringToBytes32Hash(issueURL)].open.call(); 155 | // assert.isTrue(claimStatus == true); 156 | 157 | // verify bounty claimee is 0x0 158 | 159 | }); 160 | 161 | 162 | it("Bounty attempted to be posted, but user does not have sufficient balance", async function() { 163 | //config 164 | var gitcoin = await Gitcoin.new({from: accounts[0]}); 165 | var bountyindex = await BountyIndex.new({from: accounts[0]}); 166 | var tokenAddress = gitcoin.address; 167 | 168 | //create coins 169 | await gitcoin.mint(accounts[0], amount); 170 | await gitcoin.approve(bountyindex.address, 99); 171 | 172 | try { 173 | await bountyindex.postBounty(issueURL, amount, tokenAddress, expirationTime, metadata, {from: accounts[0], gas: 9999999}); 174 | } catch (e) { 175 | console.log('Bounty cannot be posted, insufficient balance'); 176 | } 177 | 178 | }); 179 | 180 | it("Non-bountyOwner claim approval failure", async function() { 181 | //config 182 | var gitcoin = await Gitcoin.new({from: accounts[0]}); 183 | var bountyindex = await BountyIndex.new({from: accounts[0]}); 184 | var tokenAddress = gitcoin.address; 185 | 186 | //create coins 187 | await gitcoin.mint(accounts[0], amount); 188 | await gitcoin.approve(bountyindex.address, amount); 189 | 190 | //post bounty 191 | await bountyindex.postBounty(issueURL, amount, tokenAddress, expirationTime, metadata, {from: accounts[0]}); 192 | 193 | //claim bounty 194 | await bountyindex.claimBounty(issueURL, claimee_metadata, {from: accounts[1]}); 195 | 196 | //approve bounty from Non-bountyOwner failure 197 | try { 198 | await bountyindex.approveBountyClaim(issueURL, {from: accounts[1]}); 199 | } catch (e) { 200 | console.log('Approval failed, not bountyOwner'); 201 | } 202 | }); 203 | 204 | it("Non-bountyOwner claim rejection failure", async function() { 205 | //config 206 | var gitcoin = await Gitcoin.new({from: accounts[0]}); 207 | var bountyindex = await BountyIndex.new({from: accounts[0]}); 208 | var tokenAddress = gitcoin.address; 209 | 210 | //create coins 211 | await gitcoin.mint(accounts[0], amount); 212 | await gitcoin.approve(bountyindex.address, amount); 213 | 214 | //post bounty 215 | await bountyindex.postBounty(issueURL, amount, tokenAddress, expirationTime, metadata, {from: accounts[0]}); 216 | 217 | //claim bounty 218 | await bountyindex.claimBounty(issueURL, claimee_metadata, {from: accounts[1]}); 219 | 220 | //approve bounty from Non-bountyOwner failure 221 | try { 222 | await bountyindex.rejectBountyClaim(issueURL, {from: accounts[2]}); 223 | } catch (e) { 224 | console.log('Rejection failed, not bountyOwner'); 225 | } 226 | }); 227 | 228 | 229 | it("test getGetRepoURL", async function() { 230 | //config 231 | var gitcoin = await Gitcoin.new({from: accounts[0]}); 232 | var bountyindex = await BountyIndex.new({from: accounts[0]}); 233 | var tokenAddress = gitcoin.address; 234 | 235 | //create coins 236 | var repoURL = await bountyindex.getRepoURL.call(issueURL); 237 | assert.strictEqual( repoURL.toString(), "https://github.com/owocki/pytrader/" ); 238 | }); 239 | 240 | 241 | }); 242 | -------------------------------------------------------------------------------- /test/token/ERC20.js: -------------------------------------------------------------------------------- 1 | var tools = require('../tools'); 2 | var BasicERC20 = artifacts.require("./BasicERC20Token.sol"); 3 | 4 | contract("BasicERC20", function(accounts) { 5 | 6 | //CREATION 7 | 8 | it("creation: should create an initial balance of 0 for the creator", function(done) { 9 | BasicERC20.new( {from: accounts[0]}).then(function(ctr) { 10 | return ctr.balanceOf.call(accounts[0]); 11 | }).then(function (result) { 12 | assert.strictEqual(result.toNumber(), 0); 13 | done(); 14 | }).catch(done); 15 | }); 16 | 17 | it("creation: test correct setting of vanity information", function(done) { 18 | var ctr; 19 | BasicERC20.new( {from: accounts[0]}).then(function(result) { 20 | ctr = result; 21 | return ctr.name.call(); 22 | }).then(function (result) { 23 | assert.strictEqual(result, 'BasicERC20'); 24 | return ctr.decimals.call(); 25 | }).then(function(result) { 26 | assert.strictEqual(result.toNumber(), 18); 27 | return ctr.symbol.call(); 28 | }).then(function(result) { 29 | assert.strictEqual(result, 'ERC'); 30 | done(); 31 | }).catch(done); 32 | }); 33 | 34 | //TRANSERS 35 | //normal transfers without approvals. 36 | 37 | //this is not *good* enough as the contract could still throw an error otherwise. 38 | //ideally one should check balances before and after, but estimateGas currently always throws an error. 39 | //it's not giving estimate on gas used in the event of an error. 40 | it("transfers: ether transfer should be reversed.", function(done) { 41 | var ctr; 42 | BasicERC20.new( {from: accounts[0]}).then(function(result) { 43 | ctr = result; 44 | return web3.eth.sendTransaction({from: accounts[0], to: ctr.address, value: web3.toWei("10", "Ether")}); 45 | }).catch(function(result) { 46 | done(); 47 | }).catch(done); 48 | }); 49 | 50 | 51 | it("transfers: should transfer 600000000 to accounts[1] with accounts[0] having 600000000", function(done) { 52 | var ctr; 53 | BasicERC20.new( {from: accounts[0]}).then(function(result) { 54 | ctr = result; 55 | return ctr.mint(accounts[0], 600000000, {from: accounts[0]}); 56 | }).then(function (result) { 57 | return ctr.transfer(accounts[1], 600000000, {from: accounts[0]}); 58 | }).then(function (result) { 59 | return ctr.balanceOf.call(accounts[1]); 60 | }).then(function (result) { 61 | assert.strictEqual(result.toNumber(), 600000000); 62 | done(); 63 | }).catch(done); 64 | }); 65 | 66 | it("transfers: should fail when trying to transfer 600000001 to accounts[1] with accounts[0] having 600000000", function(done) { 67 | var ctr; 68 | var hasErrored = false; 69 | BasicERC20.new( {from: accounts[0]}).then(function(result) { 70 | ctr = result; 71 | return ctr.mint(accounts[0], 600000000, {from: accounts[0]}); 72 | }).then(function (result) { 73 | return ctr.transfer(accounts[1], 600000001, {from: accounts[0]}); 74 | }).catch(function (error) { 75 | assert.strictEqual( error.toString().indexOf('Exception') != -1 ,true); 76 | hasErrored = true; 77 | }).then(function (result) { 78 | return ctr.balanceOf.call(accounts[1]); 79 | }).then(function (result) { 80 | assert.strictEqual(result.toNumber(), 0); 81 | assert.strictEqual(hasErrored, true); 82 | done(); 83 | }).catch(done); 84 | }); 85 | 86 | it("transfers: should fail when trying to transfer negative amount.", function(done) { 87 | var ctr; 88 | var hasErrored = false; 89 | var amount = 1000; 90 | BasicERC20.new( {from: accounts[0]}).then(function(result) { 91 | ctr = result; 92 | return ctr.mint(accounts[1], amount, {from: accounts[0]}); 93 | }).then(function (result) { 94 | return ctr.transfer.call(accounts[1], -1, {from: accounts[0]}); 95 | }).catch(function (error) { 96 | assert.strictEqual( error.toString().indexOf('Exception') != -1 ,true); 97 | hasErrored = true; 98 | }).then(function (result) { 99 | return ctr.balanceOf.call(accounts[1]); 100 | }).then(function (result) { 101 | assert.strictEqual(result.toNumber(), amount); 102 | assert.strictEqual(hasErrored, true); 103 | done(); 104 | }).catch(done); 105 | }); 106 | 107 | //NOTE: testing uint256 wrapping is impossible in this standard token since you can't supply > 2^256 -1. 108 | 109 | //todo: transfer max amounts. 110 | 111 | //APPROVALS 112 | 113 | it("approvals: msg.sender should approve 100 to accounts[1]", function(done) { 114 | var ctr = null; 115 | BasicERC20.new( {from: accounts[0]}).then(function(result) { 116 | ctr = result; 117 | return ctr.approve(accounts[1], 100, {from: accounts[0]}); 118 | }).then(function (result) { 119 | return ctr.allowance.call(accounts[0], accounts[1]); 120 | }).then(function (result) { 121 | assert.strictEqual(result.toNumber(), 100); 122 | done(); 123 | }).catch(done); 124 | }); 125 | 126 | //bit overkill. But is for testing a bug 127 | it("approvals: msg.sender approves accounts[1] of 100 & withdraws 20 once.", function(done) { 128 | var ctr = null; 129 | BasicERC20.new( {from: accounts[0]}).then(function(result) { 130 | ctr = result; 131 | return ctr.mint(accounts[1], 200, {from: accounts[0]}); 132 | }).catch(function (error) { 133 | return ctr.approve(accounts[0], 0, {from: accounts[1]}); 134 | }).then(function (result) { 135 | return ctr.approve(accounts[0], 100, {from: accounts[1]}); 136 | }).then(function (result) { 137 | return ctr.transferFrom(accounts[1], accounts[2], 20, {from: accounts[0]}); 138 | }).then(function (result) { 139 | return ctr.balanceOf.call(accounts[2]); 140 | }).then(function (result) { 141 | assert.strictEqual(result.toNumber(), 20); 142 | done(); 143 | }).catch(done); 144 | }); 145 | 146 | //should approve 100 of msg.sender & withdraw 50, twice. (should succeed) 147 | it("approvals: msg.sender approves accounts[1] of 100 & withdraws 20 twice.", function(done) { 148 | var ctr = null; 149 | BasicERC20.new( {from: accounts[0]}).then(function(result) { 150 | ctr = result; 151 | return ctr.mint(accounts[1], 200, {from: accounts[0]}); 152 | }).catch(function (error) { 153 | return ctr.approve(accounts[0], 0, {from: accounts[1]}); 154 | }).then(function (result) { 155 | return ctr.approve(accounts[0], 100, {from: accounts[1]}); 156 | }).then(function (result) { 157 | return ctr.transferFrom(accounts[1], accounts[2], 20, {from: accounts[0]}); 158 | }).then(function (result) { 159 | return ctr.balanceOf.call(accounts[2]); 160 | }).then(function (result) { 161 | assert.strictEqual(result.toNumber(), 20); 162 | return ctr.transferFrom(accounts[1], accounts[2], 20, {from: accounts[0]}); 163 | }).then(function (result) { 164 | return ctr.balanceOf.call(accounts[2]); 165 | }).then(function (result) { 166 | assert.strictEqual(result.toNumber(), 40); 167 | return ctr.balanceOf.call(accounts[1]); 168 | }).then(function (result) { 169 | assert.strictEqual(result.toNumber(), 160); 170 | done(); 171 | }).catch(done); 172 | }); 173 | 174 | //should approve 100 of msg.sender & withdraw 50 & 60 (should fail). 175 | it("approvals: msg.sender approves accounts[1] of 100 & withdraws 50 & 60 (2nd tx should fail)", function(done) { 176 | var ctr = null; 177 | var hasErrored = false; 178 | BasicERC20.new( {from: accounts[0]}).then(function(result) { 179 | ctr = result; 180 | return ctr.mint(accounts[1], 200, {from: accounts[0]}); 181 | }).catch(function (error) { 182 | return ctr.approve(accounts[0], 0, {from: accounts[1]}); 183 | }).then(function (result) { 184 | return ctr.approve(accounts[0], 100, {from: accounts[1]}); 185 | }).then(function (result) { 186 | return ctr.transferFrom(accounts[1], accounts[2], 50, {from: accounts[0]}); 187 | }).then(function (result) { 188 | return ctr.balanceOf.call(accounts[2]); 189 | }).then(function (result) { 190 | assert.strictEqual(result.toNumber(), 50); 191 | return ctr.transferFrom(accounts[1], accounts[2], 60, {from: accounts[0]}); 192 | }).catch(function (error) { 193 | assert.strictEqual( error.toString().indexOf('Exception') != -1 ,true); 194 | hasErrored = true; 195 | }).then(function (result) { 196 | return ctr.balanceOf.call(accounts[2]); 197 | }).then(function (result) { 198 | assert.strictEqual(result.toNumber(), 50); 199 | assert.strictEqual(hasErrored, true); 200 | done(); 201 | }).catch(done); 202 | }); 203 | 204 | 205 | it("approvals: attempt withdrawal from account with no allowance (should fail)", function(done) { 206 | var ctr = null; 207 | var hasErrored = false; 208 | BasicERC20.new( {from: accounts[0]}).then(function(result) { 209 | ctr = result; 210 | return ctr.mint(accounts[1], 200, {from: accounts[0]}); 211 | }).then(function (result) { 212 | return ctr.transferFrom(accounts[1], accounts[2], 50, {from: accounts[0]}); 213 | }).catch(function (error) { 214 | assert.strictEqual( error.toString().indexOf('Exception') != -1 ,true); 215 | hasErrored = true; 216 | }).then(function (result) { 217 | return ctr.balanceOf.call(accounts[1]); 218 | }).then(function (result) { 219 | assert.strictEqual(result.toNumber(), 200); 220 | assert.strictEqual(hasErrored, true); 221 | done(); 222 | }).catch(done); 223 | }); 224 | 225 | it("approvals: allow accounts[1] 100 to withdraw from accounts[0]", function(done) { 226 | var ctr = null; 227 | BasicERC20.new( {from: accounts[0]}).then(function(result) { 228 | ctr = result; 229 | return ctr.mint(accounts[1], 200, {from: accounts[0]}); 230 | }).catch(function (error) { 231 | return ctr.approve(accounts[0], 0, {from: accounts[1]}); 232 | }).then(function (result) { 233 | return ctr.approve(accounts[0], 100, {from: accounts[1]}); 234 | }).then(function (result) { 235 | return ctr.transferFrom(accounts[1], accounts[2], 60, {from: accounts[0]}); 236 | }).then(function (result) { 237 | return ctr.balanceOf.call(accounts[2]); 238 | }).then(function (result) { 239 | assert.strictEqual(result.toNumber(), 60); 240 | done(); 241 | }).catch(done); 242 | }); 243 | 244 | it("approvals: approve max (2^256 - 1)", function(done) { 245 | var ctr = null; 246 | BasicERC20.new( {from: accounts[0]}).then(function(result) { 247 | ctr = result; 248 | return ctr.approve(accounts[1],'115792089237316195423570985008687907853269984665640564039457584007913129639935' , {from: accounts[0]}); 249 | }).then(function (result) { 250 | return ctr.allowance(accounts[0], accounts[1]); 251 | }).then(function (result) { 252 | var match = result.equals('1.15792089237316195423570985008687907853269984665640564039457584007913129639935e+77'); 253 | assert.isTrue(match); 254 | done(); 255 | }).catch(done); 256 | }); 257 | 258 | it("can't mint more than max (2^256)", function(done) { 259 | var ctr; 260 | var hasErrored = false; 261 | BasicERC20.new( {from: accounts[0]}).then(function(result) { 262 | ctr = result; 263 | return ctr.mint(accounts[0], 2**256 + 1, {from: accounts[0]}); 264 | }).catch(function (error) { 265 | assert.strictEqual( error.toString().indexOf('Exception') != -1 ,true); 266 | hasErrored = true; 267 | }).then(function (result) { 268 | return ctr.balanceOf.call(accounts[0]); 269 | }).then(function (result) { 270 | assert.strictEqual(result.toNumber(), 0); 271 | assert.strictEqual(hasErrored, true); 272 | done(); 273 | }).catch(done); 274 | }); 275 | 276 | it("can't mint once finishMinting() is called", function(done) { 277 | var ctr; 278 | var hasErrored = false; 279 | BasicERC20.new( {from: accounts[0]}).then(function(result) { 280 | ctr = result; 281 | return ctr.mint(accounts[0], 600000000, {from: accounts[0]}); 282 | }).then(function (result) { 283 | return ctr.balanceOf.call(accounts[0]); 284 | }).then(function (result) { 285 | assert.strictEqual(result.toNumber(), 600000000); 286 | return ctr.finishMinting({from: accounts[0]}); 287 | }).then(function (result) { 288 | return ctr.mintingFinished(); 289 | }).then(function (result) { 290 | assert.strictEqual(result, true) 291 | return ctr.mint(accounts[0], 600000000, {from: accounts[0]}); 292 | }).catch(function (error) { 293 | assert.strictEqual( error.toString().indexOf('Exception') != -1 ,true); 294 | hasErrored = true; 295 | }).then(function (result) { 296 | return ctr.balanceOf.call(accounts[0]); 297 | }).then(function (result) { 298 | assert.strictEqual(result.toNumber(), 600000000); 299 | assert.strictEqual(hasErrored, true); 300 | done(); 301 | }).catch(done); 302 | }); 303 | 304 | it("can't mint once targetTotalSupply() is reached", function(done) { 305 | var ctr; 306 | BasicERC20.new( {from: accounts[0]}).then(function(result) { 307 | ctr = result; 308 | return ctr.mint(accounts[0], tools.weiPerEther() * 600000000, {from: accounts[0]}); 309 | }).then(function (result) { 310 | return ctr.balanceOf.call(accounts[0]); 311 | }).then(function (result) { 312 | assert.strictEqual(result.toNumber(), tools.weiPerEther() * 600000000); 313 | return ctr.mint(accounts[0], 1, {from: accounts[0]}); 314 | }).then(function (result) { 315 | return ctr.balanceOf.call(accounts[0]); 316 | }).then(function (result) { 317 | assert.strictEqual(result.toNumber(), tools.weiPerEther() * 600000000); 318 | done(); 319 | }).catch(done); 320 | }); 321 | 322 | it("totalsupply always equals minted amount.", async function() { 323 | var ctr = await BasicERC20.new({from: accounts[0]}); 324 | 325 | var amounts =[1, 50, 55, 90, 10000, 2091, 1111]; 326 | var runningTotalAmount = 0; 327 | 328 | for (var i = 0; i < amounts.length; i++) { 329 | var thisAmount = amounts[i]; 330 | await ctr.mint(accounts[0], thisAmount); 331 | runningTotalAmount += thisAmount; 332 | 333 | let balance0 = await ctr.balanceOf(accounts[0]); 334 | assert(balance0, runningTotalAmount); 335 | 336 | let totalSupply = await ctr.totalSupply(); 337 | assert(totalSupply, runningTotalAmount); 338 | } 339 | }); 340 | 341 | }); -------------------------------------------------------------------------------- /test/tools.js: -------------------------------------------------------------------------------- 1 | // tools.js 2 | module.exports = { 3 | increaseTime: function (addSeconds) { 4 | web3.currentProvider.send({jsonrpc: "2.0", method: "evm_increaseTime", params: [addSeconds], id: 0}); 5 | web3.currentProvider.send({jsonrpc: "2.0", method: "evm_mine", params: [], id: 0}); 6 | }, 7 | vestTime: function () { 8 | return vestTime = 60 * 60 * 24 * 30; 9 | }, 10 | weiPerEther: function(){ 11 | return 1000000000000000000; 12 | }, 13 | gitcoinSupply: function(){ 14 | return 600 * 1000 * 1000; 15 | }, 16 | etherPerWei: function(){ 17 | return 1/1000000000000000000; 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /truffle.js: -------------------------------------------------------------------------------- 1 | var bip39 = require("bip39"); 2 | var hdkey = require('ethereumjs-wallet/hdkey'); 3 | var ProviderEngine = require("web3-provider-engine"); 4 | var WalletSubprovider = require('web3-provider-engine/subproviders/wallet.js'); 5 | var Web3Subprovider = require("web3-provider-engine/subproviders/web3.js"); 6 | var Web3 = require("web3"); 7 | 8 | // Get our mnemonic and create an hdwallet 9 | 10 | var mnemonic = require('./mnemonic.js'); 11 | var hdwallet = hdkey.fromMasterSeed(bip39.mnemonicToSeed(mnemonic.mnemonic())); 12 | 13 | // Get the first account using the standard hd path. 14 | var wallet_hdpath = "m/44'/60'/0'/0/"; 15 | var wallet = hdwallet.derivePath(wallet_hdpath + "0").getWallet(); 16 | var address = "0x" + wallet.getAddress().toString("hex"); 17 | console.log("using address: " + address) 18 | 19 | var providerUrl = "https://rinkeby.infura.io"; 20 | var testnet_engine = new ProviderEngine(); 21 | testnet_engine.addProvider(new WalletSubprovider(wallet, {})); 22 | testnet_engine.addProvider(new Web3Subprovider(new Web3.providers.HttpProvider(providerUrl))); 23 | testnet_engine.start(); // Required by the provider engine. 24 | 25 | var providerUrl = "https://ropsten.infura.io"; 26 | var ropsten_engine = new ProviderEngine(); 27 | ropsten_engine.addProvider(new WalletSubprovider(wallet, {})); 28 | ropsten_engine.addProvider(new Web3Subprovider(new Web3.providers.HttpProvider(providerUrl))); 29 | ropsten_engine.start(); // Required by the provider engine. 30 | 31 | var providerUrl = "https://mainnet.infura.io"; 32 | var mainnet_engine = new ProviderEngine(); 33 | mainnet_engine.addProvider(new WalletSubprovider(wallet, {})); 34 | mainnet_engine.addProvider(new Web3Subprovider(new Web3.providers.HttpProvider(providerUrl))); 35 | mainnet_engine.start(); // Required by the provider engine. 36 | 37 | module.exports = { 38 | migrations_directory: "./migrations", 39 | networks: { 40 | ropsten: { 41 | network_id: 3, // Official ropsten network id 42 | provider: ropsten_engine, // Use our custom provider 43 | from: address, // Use the address we derived 44 | gasPrice: '0x2756CD00' , /// .66 gwei 45 | gasPrice: '0x24E160300' , /// 9.9 gwei 46 | }, 47 | rinkeby: { 48 | network_id: 4, // Official rinkeby network id 49 | provider: testnet_engine, // Use our custom provider 50 | from: address, // Use the address we derived 51 | gasPrice: '0x2756CD00' , /// .66 gwei 52 | gasPrice: '0x24E160300' , /// 9.9 gwei 53 | }, 54 | mainnet: { 55 | network_id: 1, // Official mainnet network id 56 | provider: mainnet_engine, // Use our custom provider 57 | from: address, // Use the address we derived 58 | //gasPrice: '0x13AB6680' , /// 33 gwei 59 | gasPrice: '0x38fa6ae00' , /// 66 gwei 60 | }, 61 | development: { 62 | host: "localhost", 63 | port: 8545, 64 | network_id: "*", 65 | from: "0xd3d280c2866eaa795fc72bd850c48e7cce166e23", 66 | gasLimit: 0xfffffffffff, 67 | gasPrice: 0x01 68 | } 69 | } 70 | }; --------------------------------------------------------------------------------