Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Upgrade truffle-compile, which provides Solidity 0.4.11.
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoulter committed May 8, 2017
1 parent d3aad15 commit 72cb5cf
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
9 changes: 4 additions & 5 deletions lib/testing/Assert.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ library Assert {
uint8 constant A = uint8(byte('a'));

byte constant MINUS = byte('-');
byte constant SPACE = byte(' ');

/*
Event: TestEvent
Expand Down Expand Up @@ -853,7 +852,7 @@ library Assert {
Returns:
result (bool) - The result.
*/
function notEqual(uint[] arrA, uint[] arrB, string message) constant returns (bool result) {
function notEqual(uint[] arrA, uint[] arrB, string message) constant returns (bool) {
var r = arrA.length == arrB.length;
if (r) {
for (uint i = 0; i < arrA.length; i++) {
Expand Down Expand Up @@ -965,7 +964,7 @@ library Assert {
Returns:
result (bool) - The result.
*/
function notEqual(int[] arrA, int[] arrB, string message) constant returns (bool result) {
function notEqual(int[] arrA, int[] arrB, string message) constant returns (bool) {
var r = arrA.length == arrB.length;
if (r) {
for (uint i = 0; i < arrA.length; i++) {
Expand Down Expand Up @@ -1077,7 +1076,7 @@ library Assert {
Returns:
result (bool) - The result.
*/
function notEqual(address[] arrA, address[] arrB, string message) constant returns (bool result) {
function notEqual(address[] arrA, address[] arrB, string message) constant returns (bool) {
var r = arrA.length == arrB.length;
if (r) {
for (uint i = 0; i < arrA.length; i++) {
Expand Down Expand Up @@ -1189,7 +1188,7 @@ library Assert {
Returns:
result (bool) - The result.
*/
function notEqual(bytes32[] arrA, bytes32[] arrB, string message) constant returns (bool result) {
function notEqual(bytes32[] arrA, bytes32[] arrB, string message) constant returns (bool) {
var r = arrA.length == arrB.length;
if (r) {
for (uint i = 0; i < arrA.length; i++) {
Expand Down
25 changes: 25 additions & 0 deletions lib/testing/deployed.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// Using web3 for its sha function...
var Web3 = require("web3");

var Deployed = {

makeSolidityDeployedAddressesLibrary: function(mapping) {
var self = this;

var source = "";
source += "pragma solidity ^0.4.6; \n\n library DeployedAddresses {" + "\n";

Expand All @@ -10,6 +15,8 @@ var Deployed = {
var body = "throw;";

if (address) {
address = self.toChecksumAddress(address);

body = "return " + address + ";";
}

Expand All @@ -20,6 +27,24 @@ var Deployed = {
source += "}";

return source;
},

// Pulled from ethereumjs-util, but I don't want all its dependencies at the moment.
toChecksumAddress: function (address) {
var web3 = new Web3();
address = address.toLowerCase().replace("0x", "");
var hash = web3.sha3(address).replace("0x", "");
var ret = '0x'

for (var i = 0; i < address.length; i++) {
if (parseInt(hash[i], 16) >= 8) {
ret += address[i].toUpperCase()
} else {
ret += address[i]
}
}

return ret
}
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"spawn-args": "^0.1.0",
"temp": "^0.8.3",
"truffle-artifactor": "~2.1.4",
"truffle-compile": "~1.1.2",
"truffle-compile": "~2.0.0",
"truffle-config": "~0.0.7",
"truffle-contract": "~2.0.0",
"truffle-contract-sources": "~0.0.1",
Expand Down

0 comments on commit 72cb5cf

Please sign in to comment.