|
|
|
const { balance, BN, constants, ether, expectEvent, shouldFail } = require('openzeppelin-test-helpers');
|
|
|
|
const { ZERO_ADDRESS } = constants;
|
Crowdsale refactor and add new models (#744)
* Basic idea
* Fine tuning idea
* Add comments / tidy up Crowdsale base class
* fixed TimedCrowdsale constructor
* added simple crowdsale test
* added HODL directory under home to store unused contracts. ugly hack to solve Crowdsale selection in tests, better way?
* Capped no longer inherits from Timed, added capReached() method (replacing hasEnded())
* added SafeMath in TimedCrowdsale for safety, CHECK whether it is inherited from Crowdsale
* several fixes related to separating Capped from Timed. functions renamed, mocks changed. Capped tests passing
* added TimedCrowdsaleImpl.sol, TimedCrowdsale tests, passed
* added Whitelisted implementation and test, passed.
* removed unnecessary super constructor call in WhitelistedCrowdsale, removed unused dependencies in tests
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale, implemented IndividuallyCappedCrowdsaleImpl.sol and corresponding tests, passed.
* homogeneized use of using SafeMath for uint256 across validation crowdsales. checked that it IS indeed inherited, but leaving it there as per Frans suggestion.
* adding questions.md where I track questions, bugs and progress
* modified VariablePriceCrowdsale, added Impl.
* finished VariablePrice, fixed sign, added test, passing.
* changed VariablePrice to IncreasingPrice, added corresponding require()
* MintedCrowdsale done, mock implemented, test passing
* PremintedCrowdsale done, mocks, tests passing
* checked FinalizableCrowdsale
* PostDeliveryCrowdsale done, mock, tests passing.
* RefundableCrowdsale done. Detached Vault. modified mock and test, passing
* renamed crowdsale-refactor to crowdsale in contracts and test
* deleted HODL old contracts
* polished variable names in tests
* fixed typos and removed comments in tests
* Renamed 'crowdsale-refactor' to 'crowdsale' in all imports
* Fix minor param naming issues in Crowdsale functions and added documentation to Crowdsale.sol
* Added documentation to Crowdsale extensions
* removed residual comments and progress tracking files
* added docs for validation crowdsales
* Made user promises in PostDeliveryCrowdsale public so that users can query their promised token balance.
* added docs for distribution crowdsales
* renamed PremintedCrowdsale to AllowanceCrowdsale
* added allowance check function and corresponding test. fixed filename in AllowanceCrowdsale mock.
* spilt Crowdsale _postValidatePurchase in _postValidatePurchase and _updatePurchasingState. changed IndividuallyCappedCrowdsale accordingly.
* polished tests for linter, salve Travis
* polished IncreasingPriceCrowdsale.sol for linter.
* renamed and polished for linter WhitelistedCrowdsale test.
* fixed indentation in IncreasingPriceCrowdsaleImpl.sol for linter
* fixed ignoring token.mint return value in MintedCrowdsale.sol
* expanded docs throughout, fixed minor issues
* extended test coverage for IndividuallyCappedCrowdsale
* Extended WhitelistedCrwodsale test coverage
* roll back decoupling of RefundVault in RefundableCrowdsale
* moved cap exceedance checks in Capped and IndividuallyCapped crowdsales to _preValidatePurchase to save gas
* revert name change, IndividuallyCapped to UserCapped
* extended docs.
* added crowd whitelisting with tests
* added group capping, plus tests
* added modifiers in TimedCrowdsale and WhitelistedCrowdsale
* polished tests for linter
* moved check of whitelisted to modifier, mainly for testing coverage
* fixed minor ordering/polishingafter review
* modified TimedCrowdsale modifier/constructor ordering
* unchanged truffle-config.js
* changed indentation of visibility modifier in mocks
* changed naming of modifier and function to use Open/Closed for TimedCrowdsale
* changed ordering of constructor calls in SampleCrowdsale
* changed startTime and endTime to openingTime and closingTime throughout
* fixed exceeding line lenght for linter
* renamed _emitTokens to _deliverTokens
* renamed addCrowdToWhitelist to addManyToWhitelist
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale
7 years ago
|
|
|
|
|
|
|
const AllowanceCrowdsaleImpl = artifacts.require('AllowanceCrowdsaleImpl');
|
Crowdsale refactor and add new models (#744)
* Basic idea
* Fine tuning idea
* Add comments / tidy up Crowdsale base class
* fixed TimedCrowdsale constructor
* added simple crowdsale test
* added HODL directory under home to store unused contracts. ugly hack to solve Crowdsale selection in tests, better way?
* Capped no longer inherits from Timed, added capReached() method (replacing hasEnded())
* added SafeMath in TimedCrowdsale for safety, CHECK whether it is inherited from Crowdsale
* several fixes related to separating Capped from Timed. functions renamed, mocks changed. Capped tests passing
* added TimedCrowdsaleImpl.sol, TimedCrowdsale tests, passed
* added Whitelisted implementation and test, passed.
* removed unnecessary super constructor call in WhitelistedCrowdsale, removed unused dependencies in tests
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale, implemented IndividuallyCappedCrowdsaleImpl.sol and corresponding tests, passed.
* homogeneized use of using SafeMath for uint256 across validation crowdsales. checked that it IS indeed inherited, but leaving it there as per Frans suggestion.
* adding questions.md where I track questions, bugs and progress
* modified VariablePriceCrowdsale, added Impl.
* finished VariablePrice, fixed sign, added test, passing.
* changed VariablePrice to IncreasingPrice, added corresponding require()
* MintedCrowdsale done, mock implemented, test passing
* PremintedCrowdsale done, mocks, tests passing
* checked FinalizableCrowdsale
* PostDeliveryCrowdsale done, mock, tests passing.
* RefundableCrowdsale done. Detached Vault. modified mock and test, passing
* renamed crowdsale-refactor to crowdsale in contracts and test
* deleted HODL old contracts
* polished variable names in tests
* fixed typos and removed comments in tests
* Renamed 'crowdsale-refactor' to 'crowdsale' in all imports
* Fix minor param naming issues in Crowdsale functions and added documentation to Crowdsale.sol
* Added documentation to Crowdsale extensions
* removed residual comments and progress tracking files
* added docs for validation crowdsales
* Made user promises in PostDeliveryCrowdsale public so that users can query their promised token balance.
* added docs for distribution crowdsales
* renamed PremintedCrowdsale to AllowanceCrowdsale
* added allowance check function and corresponding test. fixed filename in AllowanceCrowdsale mock.
* spilt Crowdsale _postValidatePurchase in _postValidatePurchase and _updatePurchasingState. changed IndividuallyCappedCrowdsale accordingly.
* polished tests for linter, salve Travis
* polished IncreasingPriceCrowdsale.sol for linter.
* renamed and polished for linter WhitelistedCrowdsale test.
* fixed indentation in IncreasingPriceCrowdsaleImpl.sol for linter
* fixed ignoring token.mint return value in MintedCrowdsale.sol
* expanded docs throughout, fixed minor issues
* extended test coverage for IndividuallyCappedCrowdsale
* Extended WhitelistedCrwodsale test coverage
* roll back decoupling of RefundVault in RefundableCrowdsale
* moved cap exceedance checks in Capped and IndividuallyCapped crowdsales to _preValidatePurchase to save gas
* revert name change, IndividuallyCapped to UserCapped
* extended docs.
* added crowd whitelisting with tests
* added group capping, plus tests
* added modifiers in TimedCrowdsale and WhitelistedCrowdsale
* polished tests for linter
* moved check of whitelisted to modifier, mainly for testing coverage
* fixed minor ordering/polishingafter review
* modified TimedCrowdsale modifier/constructor ordering
* unchanged truffle-config.js
* changed indentation of visibility modifier in mocks
* changed naming of modifier and function to use Open/Closed for TimedCrowdsale
* changed ordering of constructor calls in SampleCrowdsale
* changed startTime and endTime to openingTime and closingTime throughout
* fixed exceeding line lenght for linter
* renamed _emitTokens to _deliverTokens
* renamed addCrowdToWhitelist to addManyToWhitelist
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale
7 years ago
|
|
|
const SimpleToken = artifacts.require('SimpleToken');
|
|
|
|
|
|
|
|
contract('AllowanceCrowdsale', function ([_, investor, wallet, purchaser, tokenWallet]) {
|
|
|
|
const rate = new BN('1');
|
|
|
|
const value = ether('0.42');
|
Crowdsale refactor and add new models (#744)
* Basic idea
* Fine tuning idea
* Add comments / tidy up Crowdsale base class
* fixed TimedCrowdsale constructor
* added simple crowdsale test
* added HODL directory under home to store unused contracts. ugly hack to solve Crowdsale selection in tests, better way?
* Capped no longer inherits from Timed, added capReached() method (replacing hasEnded())
* added SafeMath in TimedCrowdsale for safety, CHECK whether it is inherited from Crowdsale
* several fixes related to separating Capped from Timed. functions renamed, mocks changed. Capped tests passing
* added TimedCrowdsaleImpl.sol, TimedCrowdsale tests, passed
* added Whitelisted implementation and test, passed.
* removed unnecessary super constructor call in WhitelistedCrowdsale, removed unused dependencies in tests
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale, implemented IndividuallyCappedCrowdsaleImpl.sol and corresponding tests, passed.
* homogeneized use of using SafeMath for uint256 across validation crowdsales. checked that it IS indeed inherited, but leaving it there as per Frans suggestion.
* adding questions.md where I track questions, bugs and progress
* modified VariablePriceCrowdsale, added Impl.
* finished VariablePrice, fixed sign, added test, passing.
* changed VariablePrice to IncreasingPrice, added corresponding require()
* MintedCrowdsale done, mock implemented, test passing
* PremintedCrowdsale done, mocks, tests passing
* checked FinalizableCrowdsale
* PostDeliveryCrowdsale done, mock, tests passing.
* RefundableCrowdsale done. Detached Vault. modified mock and test, passing
* renamed crowdsale-refactor to crowdsale in contracts and test
* deleted HODL old contracts
* polished variable names in tests
* fixed typos and removed comments in tests
* Renamed 'crowdsale-refactor' to 'crowdsale' in all imports
* Fix minor param naming issues in Crowdsale functions and added documentation to Crowdsale.sol
* Added documentation to Crowdsale extensions
* removed residual comments and progress tracking files
* added docs for validation crowdsales
* Made user promises in PostDeliveryCrowdsale public so that users can query their promised token balance.
* added docs for distribution crowdsales
* renamed PremintedCrowdsale to AllowanceCrowdsale
* added allowance check function and corresponding test. fixed filename in AllowanceCrowdsale mock.
* spilt Crowdsale _postValidatePurchase in _postValidatePurchase and _updatePurchasingState. changed IndividuallyCappedCrowdsale accordingly.
* polished tests for linter, salve Travis
* polished IncreasingPriceCrowdsale.sol for linter.
* renamed and polished for linter WhitelistedCrowdsale test.
* fixed indentation in IncreasingPriceCrowdsaleImpl.sol for linter
* fixed ignoring token.mint return value in MintedCrowdsale.sol
* expanded docs throughout, fixed minor issues
* extended test coverage for IndividuallyCappedCrowdsale
* Extended WhitelistedCrwodsale test coverage
* roll back decoupling of RefundVault in RefundableCrowdsale
* moved cap exceedance checks in Capped and IndividuallyCapped crowdsales to _preValidatePurchase to save gas
* revert name change, IndividuallyCapped to UserCapped
* extended docs.
* added crowd whitelisting with tests
* added group capping, plus tests
* added modifiers in TimedCrowdsale and WhitelistedCrowdsale
* polished tests for linter
* moved check of whitelisted to modifier, mainly for testing coverage
* fixed minor ordering/polishingafter review
* modified TimedCrowdsale modifier/constructor ordering
* unchanged truffle-config.js
* changed indentation of visibility modifier in mocks
* changed naming of modifier and function to use Open/Closed for TimedCrowdsale
* changed ordering of constructor calls in SampleCrowdsale
* changed startTime and endTime to openingTime and closingTime throughout
* fixed exceeding line lenght for linter
* renamed _emitTokens to _deliverTokens
* renamed addCrowdToWhitelist to addManyToWhitelist
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale
7 years ago
|
|
|
const expectedTokenAmount = rate.mul(value);
|
|
|
|
const tokenAllowance = new BN('10').pow(new BN('22'));
|
Crowdsale refactor and add new models (#744)
* Basic idea
* Fine tuning idea
* Add comments / tidy up Crowdsale base class
* fixed TimedCrowdsale constructor
* added simple crowdsale test
* added HODL directory under home to store unused contracts. ugly hack to solve Crowdsale selection in tests, better way?
* Capped no longer inherits from Timed, added capReached() method (replacing hasEnded())
* added SafeMath in TimedCrowdsale for safety, CHECK whether it is inherited from Crowdsale
* several fixes related to separating Capped from Timed. functions renamed, mocks changed. Capped tests passing
* added TimedCrowdsaleImpl.sol, TimedCrowdsale tests, passed
* added Whitelisted implementation and test, passed.
* removed unnecessary super constructor call in WhitelistedCrowdsale, removed unused dependencies in tests
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale, implemented IndividuallyCappedCrowdsaleImpl.sol and corresponding tests, passed.
* homogeneized use of using SafeMath for uint256 across validation crowdsales. checked that it IS indeed inherited, but leaving it there as per Frans suggestion.
* adding questions.md where I track questions, bugs and progress
* modified VariablePriceCrowdsale, added Impl.
* finished VariablePrice, fixed sign, added test, passing.
* changed VariablePrice to IncreasingPrice, added corresponding require()
* MintedCrowdsale done, mock implemented, test passing
* PremintedCrowdsale done, mocks, tests passing
* checked FinalizableCrowdsale
* PostDeliveryCrowdsale done, mock, tests passing.
* RefundableCrowdsale done. Detached Vault. modified mock and test, passing
* renamed crowdsale-refactor to crowdsale in contracts and test
* deleted HODL old contracts
* polished variable names in tests
* fixed typos and removed comments in tests
* Renamed 'crowdsale-refactor' to 'crowdsale' in all imports
* Fix minor param naming issues in Crowdsale functions and added documentation to Crowdsale.sol
* Added documentation to Crowdsale extensions
* removed residual comments and progress tracking files
* added docs for validation crowdsales
* Made user promises in PostDeliveryCrowdsale public so that users can query their promised token balance.
* added docs for distribution crowdsales
* renamed PremintedCrowdsale to AllowanceCrowdsale
* added allowance check function and corresponding test. fixed filename in AllowanceCrowdsale mock.
* spilt Crowdsale _postValidatePurchase in _postValidatePurchase and _updatePurchasingState. changed IndividuallyCappedCrowdsale accordingly.
* polished tests for linter, salve Travis
* polished IncreasingPriceCrowdsale.sol for linter.
* renamed and polished for linter WhitelistedCrowdsale test.
* fixed indentation in IncreasingPriceCrowdsaleImpl.sol for linter
* fixed ignoring token.mint return value in MintedCrowdsale.sol
* expanded docs throughout, fixed minor issues
* extended test coverage for IndividuallyCappedCrowdsale
* Extended WhitelistedCrwodsale test coverage
* roll back decoupling of RefundVault in RefundableCrowdsale
* moved cap exceedance checks in Capped and IndividuallyCapped crowdsales to _preValidatePurchase to save gas
* revert name change, IndividuallyCapped to UserCapped
* extended docs.
* added crowd whitelisting with tests
* added group capping, plus tests
* added modifiers in TimedCrowdsale and WhitelistedCrowdsale
* polished tests for linter
* moved check of whitelisted to modifier, mainly for testing coverage
* fixed minor ordering/polishingafter review
* modified TimedCrowdsale modifier/constructor ordering
* unchanged truffle-config.js
* changed indentation of visibility modifier in mocks
* changed naming of modifier and function to use Open/Closed for TimedCrowdsale
* changed ordering of constructor calls in SampleCrowdsale
* changed startTime and endTime to openingTime and closingTime throughout
* fixed exceeding line lenght for linter
* renamed _emitTokens to _deliverTokens
* renamed addCrowdToWhitelist to addManyToWhitelist
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale
7 years ago
|
|
|
|
|
|
|
beforeEach(async function () {
|
|
|
|
this.token = await SimpleToken.new({ from: tokenWallet });
|
|
|
|
this.crowdsale = await AllowanceCrowdsaleImpl.new(rate, wallet, this.token.address, tokenWallet);
|
Crowdsale refactor and add new models (#744)
* Basic idea
* Fine tuning idea
* Add comments / tidy up Crowdsale base class
* fixed TimedCrowdsale constructor
* added simple crowdsale test
* added HODL directory under home to store unused contracts. ugly hack to solve Crowdsale selection in tests, better way?
* Capped no longer inherits from Timed, added capReached() method (replacing hasEnded())
* added SafeMath in TimedCrowdsale for safety, CHECK whether it is inherited from Crowdsale
* several fixes related to separating Capped from Timed. functions renamed, mocks changed. Capped tests passing
* added TimedCrowdsaleImpl.sol, TimedCrowdsale tests, passed
* added Whitelisted implementation and test, passed.
* removed unnecessary super constructor call in WhitelistedCrowdsale, removed unused dependencies in tests
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale, implemented IndividuallyCappedCrowdsaleImpl.sol and corresponding tests, passed.
* homogeneized use of using SafeMath for uint256 across validation crowdsales. checked that it IS indeed inherited, but leaving it there as per Frans suggestion.
* adding questions.md where I track questions, bugs and progress
* modified VariablePriceCrowdsale, added Impl.
* finished VariablePrice, fixed sign, added test, passing.
* changed VariablePrice to IncreasingPrice, added corresponding require()
* MintedCrowdsale done, mock implemented, test passing
* PremintedCrowdsale done, mocks, tests passing
* checked FinalizableCrowdsale
* PostDeliveryCrowdsale done, mock, tests passing.
* RefundableCrowdsale done. Detached Vault. modified mock and test, passing
* renamed crowdsale-refactor to crowdsale in contracts and test
* deleted HODL old contracts
* polished variable names in tests
* fixed typos and removed comments in tests
* Renamed 'crowdsale-refactor' to 'crowdsale' in all imports
* Fix minor param naming issues in Crowdsale functions and added documentation to Crowdsale.sol
* Added documentation to Crowdsale extensions
* removed residual comments and progress tracking files
* added docs for validation crowdsales
* Made user promises in PostDeliveryCrowdsale public so that users can query their promised token balance.
* added docs for distribution crowdsales
* renamed PremintedCrowdsale to AllowanceCrowdsale
* added allowance check function and corresponding test. fixed filename in AllowanceCrowdsale mock.
* spilt Crowdsale _postValidatePurchase in _postValidatePurchase and _updatePurchasingState. changed IndividuallyCappedCrowdsale accordingly.
* polished tests for linter, salve Travis
* polished IncreasingPriceCrowdsale.sol for linter.
* renamed and polished for linter WhitelistedCrowdsale test.
* fixed indentation in IncreasingPriceCrowdsaleImpl.sol for linter
* fixed ignoring token.mint return value in MintedCrowdsale.sol
* expanded docs throughout, fixed minor issues
* extended test coverage for IndividuallyCappedCrowdsale
* Extended WhitelistedCrwodsale test coverage
* roll back decoupling of RefundVault in RefundableCrowdsale
* moved cap exceedance checks in Capped and IndividuallyCapped crowdsales to _preValidatePurchase to save gas
* revert name change, IndividuallyCapped to UserCapped
* extended docs.
* added crowd whitelisting with tests
* added group capping, plus tests
* added modifiers in TimedCrowdsale and WhitelistedCrowdsale
* polished tests for linter
* moved check of whitelisted to modifier, mainly for testing coverage
* fixed minor ordering/polishingafter review
* modified TimedCrowdsale modifier/constructor ordering
* unchanged truffle-config.js
* changed indentation of visibility modifier in mocks
* changed naming of modifier and function to use Open/Closed for TimedCrowdsale
* changed ordering of constructor calls in SampleCrowdsale
* changed startTime and endTime to openingTime and closingTime throughout
* fixed exceeding line lenght for linter
* renamed _emitTokens to _deliverTokens
* renamed addCrowdToWhitelist to addManyToWhitelist
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale
7 years ago
|
|
|
await this.token.approve(this.crowdsale.address, tokenAllowance, { from: tokenWallet });
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('accepting payments', function () {
|
|
|
|
it('should have token wallet', async function () {
|
|
|
|
(await this.crowdsale.tokenWallet()).should.be.equal(tokenWallet);
|
|
|
|
});
|
|
|
|
|
Crowdsale refactor and add new models (#744)
* Basic idea
* Fine tuning idea
* Add comments / tidy up Crowdsale base class
* fixed TimedCrowdsale constructor
* added simple crowdsale test
* added HODL directory under home to store unused contracts. ugly hack to solve Crowdsale selection in tests, better way?
* Capped no longer inherits from Timed, added capReached() method (replacing hasEnded())
* added SafeMath in TimedCrowdsale for safety, CHECK whether it is inherited from Crowdsale
* several fixes related to separating Capped from Timed. functions renamed, mocks changed. Capped tests passing
* added TimedCrowdsaleImpl.sol, TimedCrowdsale tests, passed
* added Whitelisted implementation and test, passed.
* removed unnecessary super constructor call in WhitelistedCrowdsale, removed unused dependencies in tests
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale, implemented IndividuallyCappedCrowdsaleImpl.sol and corresponding tests, passed.
* homogeneized use of using SafeMath for uint256 across validation crowdsales. checked that it IS indeed inherited, but leaving it there as per Frans suggestion.
* adding questions.md where I track questions, bugs and progress
* modified VariablePriceCrowdsale, added Impl.
* finished VariablePrice, fixed sign, added test, passing.
* changed VariablePrice to IncreasingPrice, added corresponding require()
* MintedCrowdsale done, mock implemented, test passing
* PremintedCrowdsale done, mocks, tests passing
* checked FinalizableCrowdsale
* PostDeliveryCrowdsale done, mock, tests passing.
* RefundableCrowdsale done. Detached Vault. modified mock and test, passing
* renamed crowdsale-refactor to crowdsale in contracts and test
* deleted HODL old contracts
* polished variable names in tests
* fixed typos and removed comments in tests
* Renamed 'crowdsale-refactor' to 'crowdsale' in all imports
* Fix minor param naming issues in Crowdsale functions and added documentation to Crowdsale.sol
* Added documentation to Crowdsale extensions
* removed residual comments and progress tracking files
* added docs for validation crowdsales
* Made user promises in PostDeliveryCrowdsale public so that users can query their promised token balance.
* added docs for distribution crowdsales
* renamed PremintedCrowdsale to AllowanceCrowdsale
* added allowance check function and corresponding test. fixed filename in AllowanceCrowdsale mock.
* spilt Crowdsale _postValidatePurchase in _postValidatePurchase and _updatePurchasingState. changed IndividuallyCappedCrowdsale accordingly.
* polished tests for linter, salve Travis
* polished IncreasingPriceCrowdsale.sol for linter.
* renamed and polished for linter WhitelistedCrowdsale test.
* fixed indentation in IncreasingPriceCrowdsaleImpl.sol for linter
* fixed ignoring token.mint return value in MintedCrowdsale.sol
* expanded docs throughout, fixed minor issues
* extended test coverage for IndividuallyCappedCrowdsale
* Extended WhitelistedCrwodsale test coverage
* roll back decoupling of RefundVault in RefundableCrowdsale
* moved cap exceedance checks in Capped and IndividuallyCapped crowdsales to _preValidatePurchase to save gas
* revert name change, IndividuallyCapped to UserCapped
* extended docs.
* added crowd whitelisting with tests
* added group capping, plus tests
* added modifiers in TimedCrowdsale and WhitelistedCrowdsale
* polished tests for linter
* moved check of whitelisted to modifier, mainly for testing coverage
* fixed minor ordering/polishingafter review
* modified TimedCrowdsale modifier/constructor ordering
* unchanged truffle-config.js
* changed indentation of visibility modifier in mocks
* changed naming of modifier and function to use Open/Closed for TimedCrowdsale
* changed ordering of constructor calls in SampleCrowdsale
* changed startTime and endTime to openingTime and closingTime throughout
* fixed exceeding line lenght for linter
* renamed _emitTokens to _deliverTokens
* renamed addCrowdToWhitelist to addManyToWhitelist
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale
7 years ago
|
|
|
it('should accept sends', async function () {
|
|
|
|
await this.crowdsale.send(value);
|
Crowdsale refactor and add new models (#744)
* Basic idea
* Fine tuning idea
* Add comments / tidy up Crowdsale base class
* fixed TimedCrowdsale constructor
* added simple crowdsale test
* added HODL directory under home to store unused contracts. ugly hack to solve Crowdsale selection in tests, better way?
* Capped no longer inherits from Timed, added capReached() method (replacing hasEnded())
* added SafeMath in TimedCrowdsale for safety, CHECK whether it is inherited from Crowdsale
* several fixes related to separating Capped from Timed. functions renamed, mocks changed. Capped tests passing
* added TimedCrowdsaleImpl.sol, TimedCrowdsale tests, passed
* added Whitelisted implementation and test, passed.
* removed unnecessary super constructor call in WhitelistedCrowdsale, removed unused dependencies in tests
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale, implemented IndividuallyCappedCrowdsaleImpl.sol and corresponding tests, passed.
* homogeneized use of using SafeMath for uint256 across validation crowdsales. checked that it IS indeed inherited, but leaving it there as per Frans suggestion.
* adding questions.md where I track questions, bugs and progress
* modified VariablePriceCrowdsale, added Impl.
* finished VariablePrice, fixed sign, added test, passing.
* changed VariablePrice to IncreasingPrice, added corresponding require()
* MintedCrowdsale done, mock implemented, test passing
* PremintedCrowdsale done, mocks, tests passing
* checked FinalizableCrowdsale
* PostDeliveryCrowdsale done, mock, tests passing.
* RefundableCrowdsale done. Detached Vault. modified mock and test, passing
* renamed crowdsale-refactor to crowdsale in contracts and test
* deleted HODL old contracts
* polished variable names in tests
* fixed typos and removed comments in tests
* Renamed 'crowdsale-refactor' to 'crowdsale' in all imports
* Fix minor param naming issues in Crowdsale functions and added documentation to Crowdsale.sol
* Added documentation to Crowdsale extensions
* removed residual comments and progress tracking files
* added docs for validation crowdsales
* Made user promises in PostDeliveryCrowdsale public so that users can query their promised token balance.
* added docs for distribution crowdsales
* renamed PremintedCrowdsale to AllowanceCrowdsale
* added allowance check function and corresponding test. fixed filename in AllowanceCrowdsale mock.
* spilt Crowdsale _postValidatePurchase in _postValidatePurchase and _updatePurchasingState. changed IndividuallyCappedCrowdsale accordingly.
* polished tests for linter, salve Travis
* polished IncreasingPriceCrowdsale.sol for linter.
* renamed and polished for linter WhitelistedCrowdsale test.
* fixed indentation in IncreasingPriceCrowdsaleImpl.sol for linter
* fixed ignoring token.mint return value in MintedCrowdsale.sol
* expanded docs throughout, fixed minor issues
* extended test coverage for IndividuallyCappedCrowdsale
* Extended WhitelistedCrwodsale test coverage
* roll back decoupling of RefundVault in RefundableCrowdsale
* moved cap exceedance checks in Capped and IndividuallyCapped crowdsales to _preValidatePurchase to save gas
* revert name change, IndividuallyCapped to UserCapped
* extended docs.
* added crowd whitelisting with tests
* added group capping, plus tests
* added modifiers in TimedCrowdsale and WhitelistedCrowdsale
* polished tests for linter
* moved check of whitelisted to modifier, mainly for testing coverage
* fixed minor ordering/polishingafter review
* modified TimedCrowdsale modifier/constructor ordering
* unchanged truffle-config.js
* changed indentation of visibility modifier in mocks
* changed naming of modifier and function to use Open/Closed for TimedCrowdsale
* changed ordering of constructor calls in SampleCrowdsale
* changed startTime and endTime to openingTime and closingTime throughout
* fixed exceeding line lenght for linter
* renamed _emitTokens to _deliverTokens
* renamed addCrowdToWhitelist to addManyToWhitelist
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale
7 years ago
|
|
|
});
|
|
|
|
|
Crowdsale refactor and add new models (#744)
* Basic idea
* Fine tuning idea
* Add comments / tidy up Crowdsale base class
* fixed TimedCrowdsale constructor
* added simple crowdsale test
* added HODL directory under home to store unused contracts. ugly hack to solve Crowdsale selection in tests, better way?
* Capped no longer inherits from Timed, added capReached() method (replacing hasEnded())
* added SafeMath in TimedCrowdsale for safety, CHECK whether it is inherited from Crowdsale
* several fixes related to separating Capped from Timed. functions renamed, mocks changed. Capped tests passing
* added TimedCrowdsaleImpl.sol, TimedCrowdsale tests, passed
* added Whitelisted implementation and test, passed.
* removed unnecessary super constructor call in WhitelistedCrowdsale, removed unused dependencies in tests
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale, implemented IndividuallyCappedCrowdsaleImpl.sol and corresponding tests, passed.
* homogeneized use of using SafeMath for uint256 across validation crowdsales. checked that it IS indeed inherited, but leaving it there as per Frans suggestion.
* adding questions.md where I track questions, bugs and progress
* modified VariablePriceCrowdsale, added Impl.
* finished VariablePrice, fixed sign, added test, passing.
* changed VariablePrice to IncreasingPrice, added corresponding require()
* MintedCrowdsale done, mock implemented, test passing
* PremintedCrowdsale done, mocks, tests passing
* checked FinalizableCrowdsale
* PostDeliveryCrowdsale done, mock, tests passing.
* RefundableCrowdsale done. Detached Vault. modified mock and test, passing
* renamed crowdsale-refactor to crowdsale in contracts and test
* deleted HODL old contracts
* polished variable names in tests
* fixed typos and removed comments in tests
* Renamed 'crowdsale-refactor' to 'crowdsale' in all imports
* Fix minor param naming issues in Crowdsale functions and added documentation to Crowdsale.sol
* Added documentation to Crowdsale extensions
* removed residual comments and progress tracking files
* added docs for validation crowdsales
* Made user promises in PostDeliveryCrowdsale public so that users can query their promised token balance.
* added docs for distribution crowdsales
* renamed PremintedCrowdsale to AllowanceCrowdsale
* added allowance check function and corresponding test. fixed filename in AllowanceCrowdsale mock.
* spilt Crowdsale _postValidatePurchase in _postValidatePurchase and _updatePurchasingState. changed IndividuallyCappedCrowdsale accordingly.
* polished tests for linter, salve Travis
* polished IncreasingPriceCrowdsale.sol for linter.
* renamed and polished for linter WhitelistedCrowdsale test.
* fixed indentation in IncreasingPriceCrowdsaleImpl.sol for linter
* fixed ignoring token.mint return value in MintedCrowdsale.sol
* expanded docs throughout, fixed minor issues
* extended test coverage for IndividuallyCappedCrowdsale
* Extended WhitelistedCrwodsale test coverage
* roll back decoupling of RefundVault in RefundableCrowdsale
* moved cap exceedance checks in Capped and IndividuallyCapped crowdsales to _preValidatePurchase to save gas
* revert name change, IndividuallyCapped to UserCapped
* extended docs.
* added crowd whitelisting with tests
* added group capping, plus tests
* added modifiers in TimedCrowdsale and WhitelistedCrowdsale
* polished tests for linter
* moved check of whitelisted to modifier, mainly for testing coverage
* fixed minor ordering/polishingafter review
* modified TimedCrowdsale modifier/constructor ordering
* unchanged truffle-config.js
* changed indentation of visibility modifier in mocks
* changed naming of modifier and function to use Open/Closed for TimedCrowdsale
* changed ordering of constructor calls in SampleCrowdsale
* changed startTime and endTime to openingTime and closingTime throughout
* fixed exceeding line lenght for linter
* renamed _emitTokens to _deliverTokens
* renamed addCrowdToWhitelist to addManyToWhitelist
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale
7 years ago
|
|
|
it('should accept payments', async function () {
|
|
|
|
await this.crowdsale.buyTokens(investor, { value: value, from: purchaser });
|
Crowdsale refactor and add new models (#744)
* Basic idea
* Fine tuning idea
* Add comments / tidy up Crowdsale base class
* fixed TimedCrowdsale constructor
* added simple crowdsale test
* added HODL directory under home to store unused contracts. ugly hack to solve Crowdsale selection in tests, better way?
* Capped no longer inherits from Timed, added capReached() method (replacing hasEnded())
* added SafeMath in TimedCrowdsale for safety, CHECK whether it is inherited from Crowdsale
* several fixes related to separating Capped from Timed. functions renamed, mocks changed. Capped tests passing
* added TimedCrowdsaleImpl.sol, TimedCrowdsale tests, passed
* added Whitelisted implementation and test, passed.
* removed unnecessary super constructor call in WhitelistedCrowdsale, removed unused dependencies in tests
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale, implemented IndividuallyCappedCrowdsaleImpl.sol and corresponding tests, passed.
* homogeneized use of using SafeMath for uint256 across validation crowdsales. checked that it IS indeed inherited, but leaving it there as per Frans suggestion.
* adding questions.md where I track questions, bugs and progress
* modified VariablePriceCrowdsale, added Impl.
* finished VariablePrice, fixed sign, added test, passing.
* changed VariablePrice to IncreasingPrice, added corresponding require()
* MintedCrowdsale done, mock implemented, test passing
* PremintedCrowdsale done, mocks, tests passing
* checked FinalizableCrowdsale
* PostDeliveryCrowdsale done, mock, tests passing.
* RefundableCrowdsale done. Detached Vault. modified mock and test, passing
* renamed crowdsale-refactor to crowdsale in contracts and test
* deleted HODL old contracts
* polished variable names in tests
* fixed typos and removed comments in tests
* Renamed 'crowdsale-refactor' to 'crowdsale' in all imports
* Fix minor param naming issues in Crowdsale functions and added documentation to Crowdsale.sol
* Added documentation to Crowdsale extensions
* removed residual comments and progress tracking files
* added docs for validation crowdsales
* Made user promises in PostDeliveryCrowdsale public so that users can query their promised token balance.
* added docs for distribution crowdsales
* renamed PremintedCrowdsale to AllowanceCrowdsale
* added allowance check function and corresponding test. fixed filename in AllowanceCrowdsale mock.
* spilt Crowdsale _postValidatePurchase in _postValidatePurchase and _updatePurchasingState. changed IndividuallyCappedCrowdsale accordingly.
* polished tests for linter, salve Travis
* polished IncreasingPriceCrowdsale.sol for linter.
* renamed and polished for linter WhitelistedCrowdsale test.
* fixed indentation in IncreasingPriceCrowdsaleImpl.sol for linter
* fixed ignoring token.mint return value in MintedCrowdsale.sol
* expanded docs throughout, fixed minor issues
* extended test coverage for IndividuallyCappedCrowdsale
* Extended WhitelistedCrwodsale test coverage
* roll back decoupling of RefundVault in RefundableCrowdsale
* moved cap exceedance checks in Capped and IndividuallyCapped crowdsales to _preValidatePurchase to save gas
* revert name change, IndividuallyCapped to UserCapped
* extended docs.
* added crowd whitelisting with tests
* added group capping, plus tests
* added modifiers in TimedCrowdsale and WhitelistedCrowdsale
* polished tests for linter
* moved check of whitelisted to modifier, mainly for testing coverage
* fixed minor ordering/polishingafter review
* modified TimedCrowdsale modifier/constructor ordering
* unchanged truffle-config.js
* changed indentation of visibility modifier in mocks
* changed naming of modifier and function to use Open/Closed for TimedCrowdsale
* changed ordering of constructor calls in SampleCrowdsale
* changed startTime and endTime to openingTime and closingTime throughout
* fixed exceeding line lenght for linter
* renamed _emitTokens to _deliverTokens
* renamed addCrowdToWhitelist to addManyToWhitelist
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale
7 years ago
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('high-level purchase', function () {
|
|
|
|
it('should log purchase', async function () {
|
|
|
|
const { logs } = await this.crowdsale.sendTransaction({ value: value, from: investor });
|
|
|
|
expectEvent.inLogs(logs, 'TokensPurchased', {
|
|
|
|
purchaser: investor,
|
|
|
|
beneficiary: investor,
|
|
|
|
value: value,
|
|
|
|
amount: expectedTokenAmount,
|
|
|
|
});
|
Crowdsale refactor and add new models (#744)
* Basic idea
* Fine tuning idea
* Add comments / tidy up Crowdsale base class
* fixed TimedCrowdsale constructor
* added simple crowdsale test
* added HODL directory under home to store unused contracts. ugly hack to solve Crowdsale selection in tests, better way?
* Capped no longer inherits from Timed, added capReached() method (replacing hasEnded())
* added SafeMath in TimedCrowdsale for safety, CHECK whether it is inherited from Crowdsale
* several fixes related to separating Capped from Timed. functions renamed, mocks changed. Capped tests passing
* added TimedCrowdsaleImpl.sol, TimedCrowdsale tests, passed
* added Whitelisted implementation and test, passed.
* removed unnecessary super constructor call in WhitelistedCrowdsale, removed unused dependencies in tests
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale, implemented IndividuallyCappedCrowdsaleImpl.sol and corresponding tests, passed.
* homogeneized use of using SafeMath for uint256 across validation crowdsales. checked that it IS indeed inherited, but leaving it there as per Frans suggestion.
* adding questions.md where I track questions, bugs and progress
* modified VariablePriceCrowdsale, added Impl.
* finished VariablePrice, fixed sign, added test, passing.
* changed VariablePrice to IncreasingPrice, added corresponding require()
* MintedCrowdsale done, mock implemented, test passing
* PremintedCrowdsale done, mocks, tests passing
* checked FinalizableCrowdsale
* PostDeliveryCrowdsale done, mock, tests passing.
* RefundableCrowdsale done. Detached Vault. modified mock and test, passing
* renamed crowdsale-refactor to crowdsale in contracts and test
* deleted HODL old contracts
* polished variable names in tests
* fixed typos and removed comments in tests
* Renamed 'crowdsale-refactor' to 'crowdsale' in all imports
* Fix minor param naming issues in Crowdsale functions and added documentation to Crowdsale.sol
* Added documentation to Crowdsale extensions
* removed residual comments and progress tracking files
* added docs for validation crowdsales
* Made user promises in PostDeliveryCrowdsale public so that users can query their promised token balance.
* added docs for distribution crowdsales
* renamed PremintedCrowdsale to AllowanceCrowdsale
* added allowance check function and corresponding test. fixed filename in AllowanceCrowdsale mock.
* spilt Crowdsale _postValidatePurchase in _postValidatePurchase and _updatePurchasingState. changed IndividuallyCappedCrowdsale accordingly.
* polished tests for linter, salve Travis
* polished IncreasingPriceCrowdsale.sol for linter.
* renamed and polished for linter WhitelistedCrowdsale test.
* fixed indentation in IncreasingPriceCrowdsaleImpl.sol for linter
* fixed ignoring token.mint return value in MintedCrowdsale.sol
* expanded docs throughout, fixed minor issues
* extended test coverage for IndividuallyCappedCrowdsale
* Extended WhitelistedCrwodsale test coverage
* roll back decoupling of RefundVault in RefundableCrowdsale
* moved cap exceedance checks in Capped and IndividuallyCapped crowdsales to _preValidatePurchase to save gas
* revert name change, IndividuallyCapped to UserCapped
* extended docs.
* added crowd whitelisting with tests
* added group capping, plus tests
* added modifiers in TimedCrowdsale and WhitelistedCrowdsale
* polished tests for linter
* moved check of whitelisted to modifier, mainly for testing coverage
* fixed minor ordering/polishingafter review
* modified TimedCrowdsale modifier/constructor ordering
* unchanged truffle-config.js
* changed indentation of visibility modifier in mocks
* changed naming of modifier and function to use Open/Closed for TimedCrowdsale
* changed ordering of constructor calls in SampleCrowdsale
* changed startTime and endTime to openingTime and closingTime throughout
* fixed exceeding line lenght for linter
* renamed _emitTokens to _deliverTokens
* renamed addCrowdToWhitelist to addManyToWhitelist
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale
7 years ago
|
|
|
});
|
|
|
|
|
|
|
|
it('should assign tokens to sender', async function () {
|
|
|
|
await this.crowdsale.sendTransaction({ value: value, from: investor });
|
|
|
|
(await this.token.balanceOf(investor)).should.be.bignumber.equal(expectedTokenAmount);
|
Crowdsale refactor and add new models (#744)
* Basic idea
* Fine tuning idea
* Add comments / tidy up Crowdsale base class
* fixed TimedCrowdsale constructor
* added simple crowdsale test
* added HODL directory under home to store unused contracts. ugly hack to solve Crowdsale selection in tests, better way?
* Capped no longer inherits from Timed, added capReached() method (replacing hasEnded())
* added SafeMath in TimedCrowdsale for safety, CHECK whether it is inherited from Crowdsale
* several fixes related to separating Capped from Timed. functions renamed, mocks changed. Capped tests passing
* added TimedCrowdsaleImpl.sol, TimedCrowdsale tests, passed
* added Whitelisted implementation and test, passed.
* removed unnecessary super constructor call in WhitelistedCrowdsale, removed unused dependencies in tests
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale, implemented IndividuallyCappedCrowdsaleImpl.sol and corresponding tests, passed.
* homogeneized use of using SafeMath for uint256 across validation crowdsales. checked that it IS indeed inherited, but leaving it there as per Frans suggestion.
* adding questions.md where I track questions, bugs and progress
* modified VariablePriceCrowdsale, added Impl.
* finished VariablePrice, fixed sign, added test, passing.
* changed VariablePrice to IncreasingPrice, added corresponding require()
* MintedCrowdsale done, mock implemented, test passing
* PremintedCrowdsale done, mocks, tests passing
* checked FinalizableCrowdsale
* PostDeliveryCrowdsale done, mock, tests passing.
* RefundableCrowdsale done. Detached Vault. modified mock and test, passing
* renamed crowdsale-refactor to crowdsale in contracts and test
* deleted HODL old contracts
* polished variable names in tests
* fixed typos and removed comments in tests
* Renamed 'crowdsale-refactor' to 'crowdsale' in all imports
* Fix minor param naming issues in Crowdsale functions and added documentation to Crowdsale.sol
* Added documentation to Crowdsale extensions
* removed residual comments and progress tracking files
* added docs for validation crowdsales
* Made user promises in PostDeliveryCrowdsale public so that users can query their promised token balance.
* added docs for distribution crowdsales
* renamed PremintedCrowdsale to AllowanceCrowdsale
* added allowance check function and corresponding test. fixed filename in AllowanceCrowdsale mock.
* spilt Crowdsale _postValidatePurchase in _postValidatePurchase and _updatePurchasingState. changed IndividuallyCappedCrowdsale accordingly.
* polished tests for linter, salve Travis
* polished IncreasingPriceCrowdsale.sol for linter.
* renamed and polished for linter WhitelistedCrowdsale test.
* fixed indentation in IncreasingPriceCrowdsaleImpl.sol for linter
* fixed ignoring token.mint return value in MintedCrowdsale.sol
* expanded docs throughout, fixed minor issues
* extended test coverage for IndividuallyCappedCrowdsale
* Extended WhitelistedCrwodsale test coverage
* roll back decoupling of RefundVault in RefundableCrowdsale
* moved cap exceedance checks in Capped and IndividuallyCapped crowdsales to _preValidatePurchase to save gas
* revert name change, IndividuallyCapped to UserCapped
* extended docs.
* added crowd whitelisting with tests
* added group capping, plus tests
* added modifiers in TimedCrowdsale and WhitelistedCrowdsale
* polished tests for linter
* moved check of whitelisted to modifier, mainly for testing coverage
* fixed minor ordering/polishingafter review
* modified TimedCrowdsale modifier/constructor ordering
* unchanged truffle-config.js
* changed indentation of visibility modifier in mocks
* changed naming of modifier and function to use Open/Closed for TimedCrowdsale
* changed ordering of constructor calls in SampleCrowdsale
* changed startTime and endTime to openingTime and closingTime throughout
* fixed exceeding line lenght for linter
* renamed _emitTokens to _deliverTokens
* renamed addCrowdToWhitelist to addManyToWhitelist
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale
7 years ago
|
|
|
});
|
|
|
|
|
|
|
|
it('should forward funds to wallet', async function () {
|
|
|
|
const balanceTracker = await balance.tracker(wallet);
|
|
|
|
await this.crowdsale.sendTransaction({ value, from: investor });
|
|
|
|
(await balanceTracker.delta()).should.be.bignumber.equal(value);
|
Crowdsale refactor and add new models (#744)
* Basic idea
* Fine tuning idea
* Add comments / tidy up Crowdsale base class
* fixed TimedCrowdsale constructor
* added simple crowdsale test
* added HODL directory under home to store unused contracts. ugly hack to solve Crowdsale selection in tests, better way?
* Capped no longer inherits from Timed, added capReached() method (replacing hasEnded())
* added SafeMath in TimedCrowdsale for safety, CHECK whether it is inherited from Crowdsale
* several fixes related to separating Capped from Timed. functions renamed, mocks changed. Capped tests passing
* added TimedCrowdsaleImpl.sol, TimedCrowdsale tests, passed
* added Whitelisted implementation and test, passed.
* removed unnecessary super constructor call in WhitelistedCrowdsale, removed unused dependencies in tests
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale, implemented IndividuallyCappedCrowdsaleImpl.sol and corresponding tests, passed.
* homogeneized use of using SafeMath for uint256 across validation crowdsales. checked that it IS indeed inherited, but leaving it there as per Frans suggestion.
* adding questions.md where I track questions, bugs and progress
* modified VariablePriceCrowdsale, added Impl.
* finished VariablePrice, fixed sign, added test, passing.
* changed VariablePrice to IncreasingPrice, added corresponding require()
* MintedCrowdsale done, mock implemented, test passing
* PremintedCrowdsale done, mocks, tests passing
* checked FinalizableCrowdsale
* PostDeliveryCrowdsale done, mock, tests passing.
* RefundableCrowdsale done. Detached Vault. modified mock and test, passing
* renamed crowdsale-refactor to crowdsale in contracts and test
* deleted HODL old contracts
* polished variable names in tests
* fixed typos and removed comments in tests
* Renamed 'crowdsale-refactor' to 'crowdsale' in all imports
* Fix minor param naming issues in Crowdsale functions and added documentation to Crowdsale.sol
* Added documentation to Crowdsale extensions
* removed residual comments and progress tracking files
* added docs for validation crowdsales
* Made user promises in PostDeliveryCrowdsale public so that users can query their promised token balance.
* added docs for distribution crowdsales
* renamed PremintedCrowdsale to AllowanceCrowdsale
* added allowance check function and corresponding test. fixed filename in AllowanceCrowdsale mock.
* spilt Crowdsale _postValidatePurchase in _postValidatePurchase and _updatePurchasingState. changed IndividuallyCappedCrowdsale accordingly.
* polished tests for linter, salve Travis
* polished IncreasingPriceCrowdsale.sol for linter.
* renamed and polished for linter WhitelistedCrowdsale test.
* fixed indentation in IncreasingPriceCrowdsaleImpl.sol for linter
* fixed ignoring token.mint return value in MintedCrowdsale.sol
* expanded docs throughout, fixed minor issues
* extended test coverage for IndividuallyCappedCrowdsale
* Extended WhitelistedCrwodsale test coverage
* roll back decoupling of RefundVault in RefundableCrowdsale
* moved cap exceedance checks in Capped and IndividuallyCapped crowdsales to _preValidatePurchase to save gas
* revert name change, IndividuallyCapped to UserCapped
* extended docs.
* added crowd whitelisting with tests
* added group capping, plus tests
* added modifiers in TimedCrowdsale and WhitelistedCrowdsale
* polished tests for linter
* moved check of whitelisted to modifier, mainly for testing coverage
* fixed minor ordering/polishingafter review
* modified TimedCrowdsale modifier/constructor ordering
* unchanged truffle-config.js
* changed indentation of visibility modifier in mocks
* changed naming of modifier and function to use Open/Closed for TimedCrowdsale
* changed ordering of constructor calls in SampleCrowdsale
* changed startTime and endTime to openingTime and closingTime throughout
* fixed exceeding line lenght for linter
* renamed _emitTokens to _deliverTokens
* renamed addCrowdToWhitelist to addManyToWhitelist
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale
7 years ago
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('check remaining allowance', function () {
|
|
|
|
it('should report correct allowance left', async function () {
|
|
|
|
const remainingAllowance = tokenAllowance.sub(expectedTokenAmount);
|
Crowdsale refactor and add new models (#744)
* Basic idea
* Fine tuning idea
* Add comments / tidy up Crowdsale base class
* fixed TimedCrowdsale constructor
* added simple crowdsale test
* added HODL directory under home to store unused contracts. ugly hack to solve Crowdsale selection in tests, better way?
* Capped no longer inherits from Timed, added capReached() method (replacing hasEnded())
* added SafeMath in TimedCrowdsale for safety, CHECK whether it is inherited from Crowdsale
* several fixes related to separating Capped from Timed. functions renamed, mocks changed. Capped tests passing
* added TimedCrowdsaleImpl.sol, TimedCrowdsale tests, passed
* added Whitelisted implementation and test, passed.
* removed unnecessary super constructor call in WhitelistedCrowdsale, removed unused dependencies in tests
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale, implemented IndividuallyCappedCrowdsaleImpl.sol and corresponding tests, passed.
* homogeneized use of using SafeMath for uint256 across validation crowdsales. checked that it IS indeed inherited, but leaving it there as per Frans suggestion.
* adding questions.md where I track questions, bugs and progress
* modified VariablePriceCrowdsale, added Impl.
* finished VariablePrice, fixed sign, added test, passing.
* changed VariablePrice to IncreasingPrice, added corresponding require()
* MintedCrowdsale done, mock implemented, test passing
* PremintedCrowdsale done, mocks, tests passing
* checked FinalizableCrowdsale
* PostDeliveryCrowdsale done, mock, tests passing.
* RefundableCrowdsale done. Detached Vault. modified mock and test, passing
* renamed crowdsale-refactor to crowdsale in contracts and test
* deleted HODL old contracts
* polished variable names in tests
* fixed typos and removed comments in tests
* Renamed 'crowdsale-refactor' to 'crowdsale' in all imports
* Fix minor param naming issues in Crowdsale functions and added documentation to Crowdsale.sol
* Added documentation to Crowdsale extensions
* removed residual comments and progress tracking files
* added docs for validation crowdsales
* Made user promises in PostDeliveryCrowdsale public so that users can query their promised token balance.
* added docs for distribution crowdsales
* renamed PremintedCrowdsale to AllowanceCrowdsale
* added allowance check function and corresponding test. fixed filename in AllowanceCrowdsale mock.
* spilt Crowdsale _postValidatePurchase in _postValidatePurchase and _updatePurchasingState. changed IndividuallyCappedCrowdsale accordingly.
* polished tests for linter, salve Travis
* polished IncreasingPriceCrowdsale.sol for linter.
* renamed and polished for linter WhitelistedCrowdsale test.
* fixed indentation in IncreasingPriceCrowdsaleImpl.sol for linter
* fixed ignoring token.mint return value in MintedCrowdsale.sol
* expanded docs throughout, fixed minor issues
* extended test coverage for IndividuallyCappedCrowdsale
* Extended WhitelistedCrwodsale test coverage
* roll back decoupling of RefundVault in RefundableCrowdsale
* moved cap exceedance checks in Capped and IndividuallyCapped crowdsales to _preValidatePurchase to save gas
* revert name change, IndividuallyCapped to UserCapped
* extended docs.
* added crowd whitelisting with tests
* added group capping, plus tests
* added modifiers in TimedCrowdsale and WhitelistedCrowdsale
* polished tests for linter
* moved check of whitelisted to modifier, mainly for testing coverage
* fixed minor ordering/polishingafter review
* modified TimedCrowdsale modifier/constructor ordering
* unchanged truffle-config.js
* changed indentation of visibility modifier in mocks
* changed naming of modifier and function to use Open/Closed for TimedCrowdsale
* changed ordering of constructor calls in SampleCrowdsale
* changed startTime and endTime to openingTime and closingTime throughout
* fixed exceeding line lenght for linter
* renamed _emitTokens to _deliverTokens
* renamed addCrowdToWhitelist to addManyToWhitelist
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale
7 years ago
|
|
|
await this.crowdsale.buyTokens(investor, { value: value, from: purchaser });
|
|
|
|
(await this.crowdsale.remainingTokens()).should.be.bignumber.equal(remainingAllowance);
|
Crowdsale refactor and add new models (#744)
* Basic idea
* Fine tuning idea
* Add comments / tidy up Crowdsale base class
* fixed TimedCrowdsale constructor
* added simple crowdsale test
* added HODL directory under home to store unused contracts. ugly hack to solve Crowdsale selection in tests, better way?
* Capped no longer inherits from Timed, added capReached() method (replacing hasEnded())
* added SafeMath in TimedCrowdsale for safety, CHECK whether it is inherited from Crowdsale
* several fixes related to separating Capped from Timed. functions renamed, mocks changed. Capped tests passing
* added TimedCrowdsaleImpl.sol, TimedCrowdsale tests, passed
* added Whitelisted implementation and test, passed.
* removed unnecessary super constructor call in WhitelistedCrowdsale, removed unused dependencies in tests
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale, implemented IndividuallyCappedCrowdsaleImpl.sol and corresponding tests, passed.
* homogeneized use of using SafeMath for uint256 across validation crowdsales. checked that it IS indeed inherited, but leaving it there as per Frans suggestion.
* adding questions.md where I track questions, bugs and progress
* modified VariablePriceCrowdsale, added Impl.
* finished VariablePrice, fixed sign, added test, passing.
* changed VariablePrice to IncreasingPrice, added corresponding require()
* MintedCrowdsale done, mock implemented, test passing
* PremintedCrowdsale done, mocks, tests passing
* checked FinalizableCrowdsale
* PostDeliveryCrowdsale done, mock, tests passing.
* RefundableCrowdsale done. Detached Vault. modified mock and test, passing
* renamed crowdsale-refactor to crowdsale in contracts and test
* deleted HODL old contracts
* polished variable names in tests
* fixed typos and removed comments in tests
* Renamed 'crowdsale-refactor' to 'crowdsale' in all imports
* Fix minor param naming issues in Crowdsale functions and added documentation to Crowdsale.sol
* Added documentation to Crowdsale extensions
* removed residual comments and progress tracking files
* added docs for validation crowdsales
* Made user promises in PostDeliveryCrowdsale public so that users can query their promised token balance.
* added docs for distribution crowdsales
* renamed PremintedCrowdsale to AllowanceCrowdsale
* added allowance check function and corresponding test. fixed filename in AllowanceCrowdsale mock.
* spilt Crowdsale _postValidatePurchase in _postValidatePurchase and _updatePurchasingState. changed IndividuallyCappedCrowdsale accordingly.
* polished tests for linter, salve Travis
* polished IncreasingPriceCrowdsale.sol for linter.
* renamed and polished for linter WhitelistedCrowdsale test.
* fixed indentation in IncreasingPriceCrowdsaleImpl.sol for linter
* fixed ignoring token.mint return value in MintedCrowdsale.sol
* expanded docs throughout, fixed minor issues
* extended test coverage for IndividuallyCappedCrowdsale
* Extended WhitelistedCrwodsale test coverage
* roll back decoupling of RefundVault in RefundableCrowdsale
* moved cap exceedance checks in Capped and IndividuallyCapped crowdsales to _preValidatePurchase to save gas
* revert name change, IndividuallyCapped to UserCapped
* extended docs.
* added crowd whitelisting with tests
* added group capping, plus tests
* added modifiers in TimedCrowdsale and WhitelistedCrowdsale
* polished tests for linter
* moved check of whitelisted to modifier, mainly for testing coverage
* fixed minor ordering/polishingafter review
* modified TimedCrowdsale modifier/constructor ordering
* unchanged truffle-config.js
* changed indentation of visibility modifier in mocks
* changed naming of modifier and function to use Open/Closed for TimedCrowdsale
* changed ordering of constructor calls in SampleCrowdsale
* changed startTime and endTime to openingTime and closingTime throughout
* fixed exceeding line lenght for linter
* renamed _emitTokens to _deliverTokens
* renamed addCrowdToWhitelist to addManyToWhitelist
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale
7 years ago
|
|
|
});
|
|
|
|
|
|
|
|
context('when the allowance is larger than the token amount', function () {
|
|
|
|
beforeEach(async function () {
|
|
|
|
const amount = await this.token.balanceOf(tokenWallet);
|
|
|
|
await this.token.approve(this.crowdsale.address, amount.addn(1), { from: tokenWallet });
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should report the amount instead of the allowance', async function () {
|
|
|
|
(await this.crowdsale.remainingTokens()).should.be.bignumber.equal(await this.token.balanceOf(tokenWallet));
|
|
|
|
});
|
|
|
|
});
|
Crowdsale refactor and add new models (#744)
* Basic idea
* Fine tuning idea
* Add comments / tidy up Crowdsale base class
* fixed TimedCrowdsale constructor
* added simple crowdsale test
* added HODL directory under home to store unused contracts. ugly hack to solve Crowdsale selection in tests, better way?
* Capped no longer inherits from Timed, added capReached() method (replacing hasEnded())
* added SafeMath in TimedCrowdsale for safety, CHECK whether it is inherited from Crowdsale
* several fixes related to separating Capped from Timed. functions renamed, mocks changed. Capped tests passing
* added TimedCrowdsaleImpl.sol, TimedCrowdsale tests, passed
* added Whitelisted implementation and test, passed.
* removed unnecessary super constructor call in WhitelistedCrowdsale, removed unused dependencies in tests
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale, implemented IndividuallyCappedCrowdsaleImpl.sol and corresponding tests, passed.
* homogeneized use of using SafeMath for uint256 across validation crowdsales. checked that it IS indeed inherited, but leaving it there as per Frans suggestion.
* adding questions.md where I track questions, bugs and progress
* modified VariablePriceCrowdsale, added Impl.
* finished VariablePrice, fixed sign, added test, passing.
* changed VariablePrice to IncreasingPrice, added corresponding require()
* MintedCrowdsale done, mock implemented, test passing
* PremintedCrowdsale done, mocks, tests passing
* checked FinalizableCrowdsale
* PostDeliveryCrowdsale done, mock, tests passing.
* RefundableCrowdsale done. Detached Vault. modified mock and test, passing
* renamed crowdsale-refactor to crowdsale in contracts and test
* deleted HODL old contracts
* polished variable names in tests
* fixed typos and removed comments in tests
* Renamed 'crowdsale-refactor' to 'crowdsale' in all imports
* Fix minor param naming issues in Crowdsale functions and added documentation to Crowdsale.sol
* Added documentation to Crowdsale extensions
* removed residual comments and progress tracking files
* added docs for validation crowdsales
* Made user promises in PostDeliveryCrowdsale public so that users can query their promised token balance.
* added docs for distribution crowdsales
* renamed PremintedCrowdsale to AllowanceCrowdsale
* added allowance check function and corresponding test. fixed filename in AllowanceCrowdsale mock.
* spilt Crowdsale _postValidatePurchase in _postValidatePurchase and _updatePurchasingState. changed IndividuallyCappedCrowdsale accordingly.
* polished tests for linter, salve Travis
* polished IncreasingPriceCrowdsale.sol for linter.
* renamed and polished for linter WhitelistedCrowdsale test.
* fixed indentation in IncreasingPriceCrowdsaleImpl.sol for linter
* fixed ignoring token.mint return value in MintedCrowdsale.sol
* expanded docs throughout, fixed minor issues
* extended test coverage for IndividuallyCappedCrowdsale
* Extended WhitelistedCrwodsale test coverage
* roll back decoupling of RefundVault in RefundableCrowdsale
* moved cap exceedance checks in Capped and IndividuallyCapped crowdsales to _preValidatePurchase to save gas
* revert name change, IndividuallyCapped to UserCapped
* extended docs.
* added crowd whitelisting with tests
* added group capping, plus tests
* added modifiers in TimedCrowdsale and WhitelistedCrowdsale
* polished tests for linter
* moved check of whitelisted to modifier, mainly for testing coverage
* fixed minor ordering/polishingafter review
* modified TimedCrowdsale modifier/constructor ordering
* unchanged truffle-config.js
* changed indentation of visibility modifier in mocks
* changed naming of modifier and function to use Open/Closed for TimedCrowdsale
* changed ordering of constructor calls in SampleCrowdsale
* changed startTime and endTime to openingTime and closingTime throughout
* fixed exceeding line lenght for linter
* renamed _emitTokens to _deliverTokens
* renamed addCrowdToWhitelist to addManyToWhitelist
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale
7 years ago
|
|
|
});
|
|
|
|
|
|
|
|
describe('when token wallet is the zero address', function () {
|
|
|
|
it('creation reverts', async function () {
|
|
|
|
this.token = await SimpleToken.new({ from: tokenWallet });
|
|
|
|
await shouldFail.reverting(AllowanceCrowdsaleImpl.new(rate, wallet, this.token.address, ZERO_ADDRESS));
|
|
|
|
});
|
|
|
|
});
|
Crowdsale refactor and add new models (#744)
* Basic idea
* Fine tuning idea
* Add comments / tidy up Crowdsale base class
* fixed TimedCrowdsale constructor
* added simple crowdsale test
* added HODL directory under home to store unused contracts. ugly hack to solve Crowdsale selection in tests, better way?
* Capped no longer inherits from Timed, added capReached() method (replacing hasEnded())
* added SafeMath in TimedCrowdsale for safety, CHECK whether it is inherited from Crowdsale
* several fixes related to separating Capped from Timed. functions renamed, mocks changed. Capped tests passing
* added TimedCrowdsaleImpl.sol, TimedCrowdsale tests, passed
* added Whitelisted implementation and test, passed.
* removed unnecessary super constructor call in WhitelistedCrowdsale, removed unused dependencies in tests
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale, implemented IndividuallyCappedCrowdsaleImpl.sol and corresponding tests, passed.
* homogeneized use of using SafeMath for uint256 across validation crowdsales. checked that it IS indeed inherited, but leaving it there as per Frans suggestion.
* adding questions.md where I track questions, bugs and progress
* modified VariablePriceCrowdsale, added Impl.
* finished VariablePrice, fixed sign, added test, passing.
* changed VariablePrice to IncreasingPrice, added corresponding require()
* MintedCrowdsale done, mock implemented, test passing
* PremintedCrowdsale done, mocks, tests passing
* checked FinalizableCrowdsale
* PostDeliveryCrowdsale done, mock, tests passing.
* RefundableCrowdsale done. Detached Vault. modified mock and test, passing
* renamed crowdsale-refactor to crowdsale in contracts and test
* deleted HODL old contracts
* polished variable names in tests
* fixed typos and removed comments in tests
* Renamed 'crowdsale-refactor' to 'crowdsale' in all imports
* Fix minor param naming issues in Crowdsale functions and added documentation to Crowdsale.sol
* Added documentation to Crowdsale extensions
* removed residual comments and progress tracking files
* added docs for validation crowdsales
* Made user promises in PostDeliveryCrowdsale public so that users can query their promised token balance.
* added docs for distribution crowdsales
* renamed PremintedCrowdsale to AllowanceCrowdsale
* added allowance check function and corresponding test. fixed filename in AllowanceCrowdsale mock.
* spilt Crowdsale _postValidatePurchase in _postValidatePurchase and _updatePurchasingState. changed IndividuallyCappedCrowdsale accordingly.
* polished tests for linter, salve Travis
* polished IncreasingPriceCrowdsale.sol for linter.
* renamed and polished for linter WhitelistedCrowdsale test.
* fixed indentation in IncreasingPriceCrowdsaleImpl.sol for linter
* fixed ignoring token.mint return value in MintedCrowdsale.sol
* expanded docs throughout, fixed minor issues
* extended test coverage for IndividuallyCappedCrowdsale
* Extended WhitelistedCrwodsale test coverage
* roll back decoupling of RefundVault in RefundableCrowdsale
* moved cap exceedance checks in Capped and IndividuallyCapped crowdsales to _preValidatePurchase to save gas
* revert name change, IndividuallyCapped to UserCapped
* extended docs.
* added crowd whitelisting with tests
* added group capping, plus tests
* added modifiers in TimedCrowdsale and WhitelistedCrowdsale
* polished tests for linter
* moved check of whitelisted to modifier, mainly for testing coverage
* fixed minor ordering/polishingafter review
* modified TimedCrowdsale modifier/constructor ordering
* unchanged truffle-config.js
* changed indentation of visibility modifier in mocks
* changed naming of modifier and function to use Open/Closed for TimedCrowdsale
* changed ordering of constructor calls in SampleCrowdsale
* changed startTime and endTime to openingTime and closingTime throughout
* fixed exceeding line lenght for linter
* renamed _emitTokens to _deliverTokens
* renamed addCrowdToWhitelist to addManyToWhitelist
* renamed UserCappedCrowdsale to IndividuallyCappedCrowdsale
7 years ago
|
|
|
});
|