Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
60b48b02
Commit
60b48b02
authored
Feb 13, 2017
by
Manuel Araoz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Solium
parent
f4624837
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
48 deletions
+41
-48
.soliumignore
.soliumignore
+2
-0
.soliumrc.json
.soliumrc.json
+22
-0
Bounty.sol
contracts/Bounty.sol
+8
-8
DayLimit.sol
contracts/DayLimit.sol
+9
-19
MultisigWallet.sol
contracts/MultisigWallet.sol
+0
-21
No files found.
.soliumignore
0 → 100644
View file @
60b48b02
node_modules
\ No newline at end of file
.soliumrc.json
0 → 100644
View file @
60b48b02
{
"custom-rules-filename"
:
null
,
"rules"
:
{
"imports-on-top"
:
true
,
"variable-declarations"
:
true
,
"array-declarations"
:
true
,
"operator-whitespace"
:
true
,
"lbrace"
:
true
,
"mixedcase"
:
false
,
"camelcase"
:
true
,
"uppercase"
:
true
,
"no-with"
:
true
,
"no-empty-blocks"
:
true
,
"no-unused-vars"
:
true
,
"double-quotes"
:
true
,
"blank-lines"
:
true
,
"indentation"
:
true
,
"whitespace"
:
true
,
"deprecated-suicide"
:
true
,
"pragma-on-top"
:
true
}
}
contracts/Bounty.sol
View file @
60b48b02
...
@@ -11,18 +11,19 @@ import './lifecycle/Killable.sol';
...
@@ -11,18 +11,19 @@ import './lifecycle/Killable.sol';
* This bounty will pay out to a researcher if they break invariant logic of the contract.
* This bounty will pay out to a researcher if they break invariant logic of the contract.
*/
*/
contract Bounty is PullPayment, Killable {
contract Bounty is PullPayment, Killable {
Target target;
bool public claimed;
bool public claimed;
mapping(address => address) public researchers;
mapping(address => address) public researchers;
event TargetCreated(address createdAddress);
event TargetCreated(address createdAddress);
function() payable {
function() payable {
if (claimed) throw;
if (claimed) {
throw;
}
}
}
function createTarget() returns(Target) {
function createTarget() returns(Target) {
target = Target(deployContract());
Target
target = Target(deployContract());
researchers[target] = msg.sender;
researchers[target] = msg.sender;
TargetCreated(target);
TargetCreated(target);
return target;
return target;
...
@@ -30,13 +31,11 @@ contract Bounty is PullPayment, Killable {
...
@@ -30,13 +31,11 @@ contract Bounty is PullPayment, Killable {
function deployContract() internal returns(address);
function deployContract() internal returns(address);
function checkInvariant() returns(bool){
return target.checkInvariant();
}
function claim(Target target) {
function claim(Target target) {
address researcher = researchers[target];
address researcher = researchers[target];
if (researcher == 0) throw;
if (researcher == 0) {
throw;
}
// Check Target contract invariants
// Check Target contract invariants
if (target.checkInvariant()) {
if (target.checkInvariant()) {
throw;
throw;
...
@@ -47,6 +46,7 @@ contract Bounty is PullPayment, Killable {
...
@@ -47,6 +46,7 @@ contract Bounty is PullPayment, Killable {
}
}
/*
/*
* Target
* Target
*
*
...
...
contracts/DayLimit.sol
View file @
60b48b02
...
@@ -12,33 +12,18 @@ import './ownership/Shareable.sol';
...
@@ -12,33 +12,18 @@ import './ownership/Shareable.sol';
* uses is specified in the modifier.
* uses is specified in the modifier.
*/
*/
contract DayLimit {
contract DayLimit {
// FIELDS
uint public dailyLimit;
uint public dailyLimit;
uint public spentToday;
uint public spentToday;
uint public lastDay;
uint public lastDay;
// MODIFIERS
// simple modifier for daily limit.
modifier limitedDaily(uint _value) {
if (underLimit(_value))
_;
}
// CONSTRUCTOR
// stores initial daily limit and records the present day's index.
function DayLimit(uint _limit) {
function DayLimit(uint _limit) {
dailyLimit = _limit;
dailyLimit = _limit;
lastDay = today();
lastDay = today();
}
}
// sets the daily limit. doesn't alter the amount already spent today
// METHODS
// (re)sets the daily limit. doesn't alter the amount already spent today.
function _setDailyLimit(uint _newLimit) internal {
function _setDailyLimit(uint _newLimit) internal {
dailyLimit = _newLimit;
dailyLimit = _newLimit;
}
}
...
@@ -48,9 +33,6 @@ contract DayLimit {
...
@@ -48,9 +33,6 @@ contract DayLimit {
spentToday = 0;
spentToday = 0;
}
}
// INTERNAL METHODS
// checks to see if there is at least `_value` left from the daily limit today. if there is, subtracts it and
// checks to see if there is at least `_value` left from the daily limit today. if there is, subtracts it and
// returns true. otherwise just returns false.
// returns true. otherwise just returns false.
function underLimit(uint _value) internal returns (bool) {
function underLimit(uint _value) internal returns (bool) {
...
@@ -72,4 +54,12 @@ contract DayLimit {
...
@@ -72,4 +54,12 @@ contract DayLimit {
function today() private constant returns (uint) {
function today() private constant returns (uint) {
return now / 1 days;
return now / 1 days;
}
}
// simple modifier for daily limit.
modifier limitedDaily(uint _value) {
if (underLimit(_value)) {
_;
}
}
}
}
contracts/MultisigWallet.sol
View file @
60b48b02
...
@@ -13,27 +13,6 @@ import "./DayLimit.sol";
...
@@ -13,27 +13,6 @@ import "./DayLimit.sol";
* Wallet(w).from(anotherOwner).confirm(h);
* Wallet(w).from(anotherOwner).confirm(h);
*/
*/
contract MultisigWallet is Multisig, Shareable, DayLimit {
contract MultisigWallet is Multisig, Shareable, DayLimit {
// TYPES
// Transaction structure to remember details of transaction lest it need be saved for a later call.
struct Transaction {
address to;
uint value;
bytes data;
}
// CONSTRUCTOR
// just pass on the owner array to the multiowned and
// the limit to daylimit
function MultisigWallet(address[] _owners, uint _required, uint _daylimit)
Shareable(_owners, _required)
DayLimit(_daylimit) { }
// METHODS
// kills the contract sending everything to `_to`.
// kills the contract sending everything to `_to`.
function kill(address _to) onlymanyowners(sha3(msg.data)) external {
function kill(address _to) onlymanyowners(sha3(msg.data)) external {
suicide(_to);
suicide(_to);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment