Skip to content

Commit

Permalink
README
Browse files Browse the repository at this point in the history
  • Loading branch information
lsaether committed Dec 8, 2017
1 parent 7ceb9db commit 729294e
Show file tree
Hide file tree
Showing 8 changed files with 5,397 additions and 35 deletions.
44 changes: 37 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,46 @@ _Tests have been ported to JavaScript and can now be run using the Truffle Suite

Originally the test suite was written in Python using the Populus framework, these still exist for reference under the tests/ directory. However, we have ported over the suite to use the Truffle framework since this may be more familiar to developers who know the JavaScript Ethereum tooling. These tests can be found in the test/ directory but be warned - this repo is in active development and many of the tests are likely to start breaking. If you would like to fix or contribute a test please open an issue or contribute a pull request.

Make sure you're using node v8.0.0, truffle v4.0.0 and testrpc v6.0.1.
If you would like to run the test please set up your environment to use node v8.0.0, truffle v4.0.1 and the latest ganache-cli.

Start testrpc in a terminal window by running `testrpc`.
```
nvm use 8.0.0
npm i
npm i -g truffle@4.0.1
npm i -g ganache-cli
```

In another terminal run `truffle test` at the root of the directory.
Start ganache-cli in a terminal screen by running `ganache-cli`.

Between each instance of running the tests it is advised to rebuild your build/ folder, as this may lead to bugs if not done. You can do this by running the command `rm -rf build/` and then running `truffle compile`, `truffle migrate` and `truffle test`.
In another terminal screen run `npm test` at the root of the directory. This will run the npm test script that splits up the tests into different runtimes. We did this because the EAC is a moderately sized project and running all the tests with one command has a tendency to break down the ganache tester chain.

## Documentation
Each time you run the tests it is advised to rebuild your build/ folder, as this may lead to bugs if not done. You can do this by running the command `rm -rf build/`.

Currently there exists some documentation in the docs/ directory, but I make no guarantees that anything in there is up-to-date. Part of the work of the revitalization effort is to produce more in-line documentation in the code. To be safe, always refer to the documentation in the code as the final say as changes are migrating from the codebase back out into the docs currently.
## Documentation

We host developer documentation via Doxitiy on github pages.
Currently there exists the original documentation in the docs/ directory, but I make no guarantees that anything in there is up-to-date. Part of the work of the revitalization effort is to produce more in-line documentation in the code. To be safe, always refer to the documentation in the code as the final say as changes are migrating from the codebase back out into the docs currently.

We _will soon_ host developer documentation via Doxitiy on github pages.

## Deployment

The EAC contracts are deployed on Ropsten at the addresses below.

baseScheduler, 0x06eca20d5a4f9e9c1dac5d5e3a8b86d8264087e6
blockSceduler, 0x756377d64d005357d68b09090973a19b52ef0b4e
claimLib, 0xf0cb482306cd182c95e89a305680ad1c95aaef9c
executionLib, 0x9c12065b57567727ab055a5cdf61862dfd75f7c3
groveLib, 0x58d685a216aafee3e9ef77731cf0f8ce2801f9be
iterTools, 0xed46c237c50cd46df738f4451a343f9657a28e31
mathLib, 0x87e3c74941811bb0dcc8c38c03b8f0407b7cb0b5
paymentLib, 0xb182f19b3368261d3a5ae5a1f89b3c1f1e00b128
requestFactory, 0x76e0ad7d1dcdc36bd951ae320884c843f3613934
requestLib, 0x64d0b1768a9dee29d2f389459b8ddd6ab832703c
requestMetaLib, 0x3a1c8b73a149d0889c5516114d6e11b9b7c96cf6
requestScheduleLib, 0x9d96b1eb1ef99272b2a9326fffdd8659a93041f9
requestTracker, 0x71e49ac7b7058006f32e9946882c7fff59b571b3
safeMath, 0x6fdac55a6b36a3d5c4588cf61ca5ccb595c4270b
schedulerLib, 0x9e19c7f23c09e4b3fa89e799876e3cb29f86a73a
timestampScheduler, 0x9ba22a74fd873b901a1f58e14760489fc42265ec
transactionRequest, 0x0d8fabef45ec349d11d1a0eb4d3e1bcbba652459
transactionRecorder, 0x9c5c57b400afd2f646cd063ff41eb3478455f5fa
5 changes: 2 additions & 3 deletions contracts/Library/ClaimLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ library ClaimLib {

uint requiredDeposit; // The required deposit to claim the txRequest.

// An integer constrained between 0-100 that will be applied to the
// request payment as a percentage.
uint8 paymentModifier;
uint8 paymentModifier; // An integer constrained between 0-100 that will be applied to the
// request payment as a percentage.
}

/*
Expand Down
29 changes: 11 additions & 18 deletions contracts/Library/RequestLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,9 @@ library RequestLib {
);
isValid[5] = ExecutionLib.validateToAddress(request.txnData.toAddress);

LogSwitches(isValid);
/// Automatically returns isValid
}

event LogSwitches(bool[6] switches);

/*
* Initialize a new Request.
*/
Expand Down Expand Up @@ -352,7 +349,7 @@ library RequestLib {
Aborted(uint8(AbortReason.BeforeCallWindow));
return false;
} else if (self.schedule.isAfterWindow()) {
Aborted(uint8(AbortReason.AfterCallWindow)); //3
Aborted(uint8(AbortReason.AfterCallWindow));
return false;
} else if (self.claimData.isClaimed() &&
msg.sender != self.claimData.claimedBy &&
Expand Down Expand Up @@ -390,10 +387,10 @@ library RequestLib {

// record this so that we can log it later.
uint totalDonationPayment = self.paymentData.donationOwed;
debug(totalDonationPayment);
// debug(totalDonationPayment);
// Send the donation.
/// Bug vvv
// self.paymentData.sendDonation();
self.paymentData.sendDonation();

// Compute the payment amount and who it should be sent do.
self.paymentData.paymentBenefactor = msg.sender;
Expand Down Expand Up @@ -425,22 +422,20 @@ library RequestLib {
Executed(self.paymentData.paymentOwed,
totalDonationPayment,
measuredGasConsumption);

// Send the payment.
//FIXME: NO MORE PUSHES FOR PAYMENTS, CLIENTS MUST CALL
// self.paymentData.sendPayment();
// FIXME: NO MORE PUSHES FOR PAYMENTS, CLIENTS MUST CALL
self.paymentData.sendPayment();

// Send all extra ether back to the owner.
// sendOwnerEther(self);
sendOwnerEther(self);

// +-----------------+
// | End: Accounting |
// +-----------------+

return true;
}

event debug(uint num);

// This is the amount of gas that it takes to enter from the
// `TransactionRequest.execute()` contract into the `RequestLib.execute()`
Expand Down Expand Up @@ -658,12 +653,10 @@ library RequestLib {
function sendOwnerEther(Request storage self)
internal returns (bool)
{
// assert( self.meta.isCancelled || self.schedule.isAfterWindow() );
uint ownerRefund = this.balance.sub(self.claimData.claimDeposit)
.sub(self.paymentData.paymentOwed)
.sub(self.paymentData.donationOwed);

if ( ownerRefund > 0 ) {
if ( self.meta.isCancelled || self.schedule.isAfterWindow() ) {
uint ownerRefund = this.balance.sub(self.claimData.claimDeposit)
.sub(self.paymentData.paymentOwed)
.sub(self.paymentData.donationOwed);
self.meta.owner.transfer(ownerRefund);
return true;
}
Expand Down
12 changes: 6 additions & 6 deletions contracts/zeppelin/SafeMath.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.4.11;
pragma solidity ^0.4.18;


/**
Expand All @@ -8,25 +8,25 @@ pragma solidity ^0.4.11;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
require(a == 0 || c / a == b);
return c;
}

function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// require(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
// require(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}

function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
require(b <= a);
return a - b;
}

function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
require(c >= a);
return c;
}
}
Loading

0 comments on commit 729294e

Please sign in to comment.