Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
c8c2309
Role tests (#1228)
nventuro Aug 22, 2018
ed04195
Removed RBAC tokens (#1229)
nventuro Aug 22, 2018
5b7ec56
Roles can now be transfered. (#1235)
nventuro Aug 28, 2018
0530e1e
True Ownership (#1247)
nventuro Aug 30, 2018
128c4c0
Improve encapsulation on ERC165
Sep 3, 2018
0d8a5e4
Improve encapsulation on ERC20
Sep 3, 2018
1c365fe
Improve encapsulation on ERC721
Sep 3, 2018
9ebdae6
Add tests, use standard getters
Sep 3, 2018
963a00b
fix tests
Sep 3, 2018
4d8db8d
Fix lint
Sep 3, 2018
dc7b21e
Merge branch 'master' into refactor/1174/private-state-vars-erc
Sep 4, 2018
d8e7c25
MintableToken using Roles (#1236)
nventuro Sep 4, 2018
0b0d6c6
move interface ids to implementation contracts
frangio Sep 4, 2018
68094d1
Do not prefix getters
Sep 5, 2018
2ea79e9
Merge branch 'master' into refactor/1174/private-state-vars-erc
Sep 5, 2018
5fc3742
Improve encapsulation on Pausable
Sep 3, 2018
172b720
add the underscore
Sep 3, 2018
86bbab3
Improve encapsulation on ownership
Sep 3, 2018
faed52d
fix rebase
Sep 3, 2018
21ae177
fix ownership
Sep 3, 2018
917a019
Improve encapsulation on payments
Sep 3, 2018
478d974
Add missing tests
Sep 4, 2018
0fecbac
add missing test
Sep 4, 2018
9449572
Do not prefix getters
Sep 5, 2018
1856f07
Fix tests.
Sep 5, 2018
f61acdc
Improve encapsulation on Crowdsales
Sep 3, 2018
44d113a
add missing tests
Sep 3, 2018
0257670
remove only
Sep 3, 2018
5a476d1
Do not prefix getters
Sep 5, 2018
85a0fc3
Update modifiers to call public view functions.
Sep 5, 2018
c420563
Improve encapsulation on Pausable
Sep 3, 2018
fcd369a
add the underscore
Sep 3, 2018
1eb1340
Improve encapsulation on ownership
Sep 3, 2018
211e2aa
fix rebase
Sep 3, 2018
411058f
fix ownership
Sep 3, 2018
0be5129
Improve encapsulation on payments
Sep 3, 2018
1c1399c
Add missing tests
Sep 4, 2018
cbe4f36
add missing test
Sep 4, 2018
869b364
Do not prefix getters
Sep 5, 2018
526ff31
Fix tests.
Sep 5, 2018
b4d64d4
Improve encapsulation on Crowdsales
Sep 3, 2018
2e2d634
add missing tests
Sep 3, 2018
4be20f7
remove only
Sep 3, 2018
8559477
Do not prefix getters
Sep 5, 2018
edf8ea5
Improve encapsulation on BreakInvariantBounty
Sep 3, 2018
b64cdef
Make researchers private
Sep 3, 2018
148ef64
Do not prefix getters
Sep 5, 2018
4080385
tmp
Sep 5, 2018
24761a5
remove isMinter
Sep 5, 2018
c14d597
fix is owner call
Sep 5, 2018
ba7fa16
fix isOpen
Sep 5, 2018
776d47a
Merge branch 'master' into feature/1179/modifiers-call-functions
Sep 6, 2018
7a37725
Fix merge
Sep 6, 2018
cab8bdb
Merge branch 'master' into refactor/underscores-final-final
Sep 6, 2018
093a9d5
tmp
Sep 6, 2018
52352ce
Improve encapsulation on TimedCrowdsale
Sep 6, 2018
7d10c0e
tmp
Sep 6, 2018
63b93cc
Add missing parentheses
Sep 6, 2018
4403e49
Merge branch 'refactor/1174/private-state-vars-timed-crowdsale' into …
Sep 6, 2018
093bcd3
Use prefix underscore for state variables and no underscore for param…
Sep 6, 2018
a14963b
Improved Roles API. (#1280)
nventuro Sep 6, 2018
4d4a004
Added PauserRole. (#1283)
nventuro Sep 6, 2018
b6bddb2
Merge branch 'master' into refactor/1174/private-state-vars-timed-cro…
frangio Sep 6, 2018
369b8d6
remove duplicate function definition
frangio Sep 6, 2018
b2f350d
Remove Claimable, DelayedClaimable, Heritable (#1274)
frangio Sep 5, 2018
c529524
Merge remote-tracking branch 'upstream/master' into rbac-migration
frangio Sep 6, 2018
145962d
Merge branch 'refactor/1174/private-state-vars-timed-crowdsale' into …
Sep 6, 2018
cb836c3
Merge branch 'master' into refactor/underscores-final-final
Sep 6, 2018
bf4a211
Role behavior tests (#1285)
nventuro Sep 6, 2018
199e156
Migrate Ownable to Roles (#1287)
nventuro Sep 6, 2018
d4dea3c
Remove RBAC, SignatureBouncer refactor (#1289)
nventuro Sep 6, 2018
e9cc437
feat: implement ERC721Mintable and ERC721Burnable (#1276)
shrugs Sep 6, 2018
075334a
Merge branch 'master' into refactor/underscores-final-final
Sep 7, 2018
abd946d
Merge branch 'master' into refactor/underscores-final-final
Sep 7, 2018
436c89f
Merge branch 'master' into rbac-migration
Sep 7, 2018
c81e75d
Fix the merge with the privatization branch
Sep 7, 2018
a49efc0
Merge branch 'master' into refactor/underscores-final-final
Sep 7, 2018
be372f2
Merge branch 'rbac-migration' into refactor/underscores-final-final
Sep 7, 2018
1002c20
fix lint
Sep 7, 2018
58524e3
Remove underscore
Sep 7, 2018
d4a1178
Merge branch 'master' of github.com:OpenZeppelin/openzeppelin-solidit…
frangio Sep 7, 2018
2458d72
Delete CapperRole.test.js
nventuro Sep 7, 2018
58e1050
fix increaseApproval
frangio Sep 7, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'master' into rbac-migration
  • Loading branch information
Leo Arias committed Sep 7, 2018
commit 436c89f7e7548a7eb0619a7528751980fa291e37
21 changes: 2 additions & 19 deletions contracts/crowdsale/validation/IndividuallyCappedCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,12 @@ contract IndividuallyCappedCrowdsale is Crowdsale, CapperRole {
* @param _beneficiary Address to be capped
* @param _cap Wei limit for individual contribution
*/
function setUserCap(address _beneficiary, uint256 _cap) external onlyCapper {
function setCap(address _beneficiary, uint256 _cap) external onlyCapper {
caps_[_beneficiary] = _cap;
}

/**
* @dev Sets a group of users' maximum contribution.
* @param _beneficiaries List of addresses to be capped
* @param _cap Wei limit for individual contribution
*/
function setGroupCap(
address[] _beneficiaries,
uint256 _cap
)
external
onlyCapper
{
for (uint256 i = 0; i < _beneficiaries.length; i++) {
caps_[_beneficiaries[i]] = _cap;
}
}

/**
* @dev Returns the cap of a specific user.
* @dev Returns the cap of a specific beneficiary.
* @param _beneficiary Address whose cap is to be checked
* @return Current cap for individual beneficiary
*/
Expand Down
59 changes: 7 additions & 52 deletions test/crowdsale/IndividuallyCappedCrowdsale.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ contract('IndividuallyCappedCrowdsale', function (

describe('individual caps', function () {
it('sets a cap when the sender is a capper', async function () {
await this.crowdsale.setUserCap(alice, capAlice, { from: capper });
(await this.crowdsale.getUserCap(alice)).should.be.bignumber.equal(capAlice);
await this.crowdsale.setCap(alice, capAlice, { from: capper });
(await this.crowdsale.getCap(alice)).should.be.bignumber.equal(capAlice);
});

it('reverts when a non-capper sets a cap', async function () {
await expectThrow(this.crowdsale.setUserCap(alice, capAlice, { from: anyone }), EVMRevert);
await expectThrow(this.crowdsale.setCap(alice, capAlice, { from: anyone }), EVMRevert);
});

context('with individual caps', function () {
beforeEach(async function () {
await this.crowdsale.setUserCap(alice, capAlice, { from: capper });
await this.crowdsale.setUserCap(bob, capBob, { from: capper });
await this.crowdsale.setCap(alice, capAlice, { from: capper });
await this.crowdsale.setCap(bob, capBob, { from: capper });
await this.token.transfer(this.crowdsale.address, tokenSupply);
});

Expand Down Expand Up @@ -80,57 +80,12 @@ contract('IndividuallyCappedCrowdsale', function (

describe('reporting state', function () {
it('should report correct cap', async function () {
(await this.crowdsale.getUserCap(alice)).should.be.bignumber.equal(capAlice);
(await this.crowdsale.getCap(alice)).should.be.bignumber.equal(capAlice);
});

it('should report actual contribution', async function () {
await this.crowdsale.buyTokens(alice, { value: lessThanCapAlice });
(await this.crowdsale.getUserContribution(alice)).should.be.bignumber.equal(lessThanCapAlice);
});
});
});
});

describe('group capping', function () {
it('sets caps when the sender is a capper', async function () {
await this.crowdsale.setGroupCap([bob, charlie], capBob, { from: capper });
(await this.crowdsale.getUserCap(bob)).should.be.bignumber.equal(capBob);
(await this.crowdsale.getUserCap(charlie)).should.be.bignumber.equal(capBob);
});

it('reverts when a non-capper set caps', async function () {
await expectThrow(this.crowdsale.setGroupCap([bob, charlie], capBob, { from: anyone }), EVMRevert);
});

context('with group caps', function () {
beforeEach(async function () {
await this.crowdsale.setGroupCap([bob, charlie], capBob, { from: capper });
await this.token.transfer(this.crowdsale.address, tokenSupply);
});

describe('accepting payments', function () {
it('should accept payments within cap', async function () {
await this.crowdsale.buyTokens(bob, { value: lessThanCapBoth });
await this.crowdsale.buyTokens(charlie, { value: lessThanCapBoth });
});

it('should reject payments outside cap', async function () {
await this.crowdsale.buyTokens(bob, { value: capBob });
await expectThrow(this.crowdsale.buyTokens(bob, { value: 1 }), EVMRevert);
await this.crowdsale.buyTokens(charlie, { value: capBob });
await expectThrow(this.crowdsale.buyTokens(charlie, { value: 1 }), EVMRevert);
});

it('should reject payments that exceed cap', async function () {
await expectThrow(this.crowdsale.buyTokens(bob, { value: capBob.plus(1) }), EVMRevert);
await expectThrow(this.crowdsale.buyTokens(charlie, { value: capBob.plus(1) }), EVMRevert);
});
});

describe('reporting state', function () {
it('should report correct cap', async function () {
(await this.crowdsale.getUserCap(bob)).should.be.bignumber.equal(capBob);
(await this.crowdsale.getUserCap(charlie)).should.be.bignumber.equal(capBob);
(await this.crowdsale.getContribution(alice)).should.be.bignumber.equal(lessThanCapAlice);
});
});
});
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.