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
576b0203
Commit
576b0203
authored
Dec 27, 2018
by
Nicolás Venturo
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release-v2.1.0-solc-0.5' into release-v2.1.0
parents
13eff701
4b8fcbce
Show whitespace changes
Inline
Side-by-side
Showing
127 changed files
with
285 additions
and
237 deletions
+285
-237
.gitignore
.gitignore
+3
-0
Roles.sol
contracts/access/Roles.sol
+1
-1
CapperRole.sol
contracts/access/roles/CapperRole.sol
+1
-1
MinterRole.sol
contracts/access/roles/MinterRole.sol
+1
-1
PauserRole.sol
contracts/access/roles/PauserRole.sol
+1
-1
SignerRole.sol
contracts/access/roles/SignerRole.sol
+1
-1
WhitelistedRole.sol
contracts/access/roles/WhitelistedRole.sol
+1
-1
WhitelisterRole.sol
contracts/access/roles/WhitelisterRole.sol
+1
-1
Crowdsale.sol
contracts/crowdsale/Crowdsale.sol
+5
-5
FinalizableCrowdsale.sol
contracts/crowdsale/distribution/FinalizableCrowdsale.sol
+1
-1
PostDeliveryCrowdsale.sol
contracts/crowdsale/distribution/PostDeliveryCrowdsale.sol
+1
-1
RefundableCrowdsale.sol
contracts/crowdsale/distribution/RefundableCrowdsale.sol
+2
-2
RefundablePostDeliveryCrowdsale.sol
...rowdsale/distribution/RefundablePostDeliveryCrowdsale.sol
+1
-1
AllowanceCrowdsale.sol
contracts/crowdsale/emission/AllowanceCrowdsale.sol
+2
-2
MintedCrowdsale.sol
contracts/crowdsale/emission/MintedCrowdsale.sol
+1
-1
IncreasingPriceCrowdsale.sol
contracts/crowdsale/price/IncreasingPriceCrowdsale.sol
+1
-1
CappedCrowdsale.sol
contracts/crowdsale/validation/CappedCrowdsale.sol
+1
-1
IndividuallyCappedCrowdsale.sol
...acts/crowdsale/validation/IndividuallyCappedCrowdsale.sol
+1
-1
PausableCrowdsale.sol
contracts/crowdsale/validation/PausableCrowdsale.sol
+1
-2
TimedCrowdsale.sol
contracts/crowdsale/validation/TimedCrowdsale.sol
+1
-1
WhitelistCrowdsale.sol
contracts/crowdsale/validation/WhitelistCrowdsale.sol
+1
-1
ECDSA.sol
contracts/cryptography/ECDSA.sol
+2
-2
MerkleProof.sol
contracts/cryptography/MerkleProof.sol
+2
-2
Counter.sol
contracts/drafts/Counter.sol
+1
-1
TokenMetadata.sol
contracts/drafts/ERC1046/TokenMetadata.sol
+4
-4
ERC20Migrator.sol
contracts/drafts/ERC20Migrator.sol
+7
-7
SignatureBouncer.sol
contracts/drafts/SignatureBouncer.sol
+8
-8
TokenVesting.sol
contracts/drafts/TokenVesting.sol
+9
-9
SampleCrowdsale.sol
contracts/examples/SampleCrowdsale.sol
+2
-2
SimpleToken.sol
contracts/examples/SimpleToken.sol
+4
-3
ERC165.sol
contracts/introspection/ERC165.sol
+1
-1
ERC165Checker.sol
contracts/introspection/ERC165Checker.sol
+2
-2
IERC165.sol
contracts/introspection/IERC165.sol
+1
-1
Pausable.sol
contracts/lifecycle/Pausable.sol
+1
-1
Math.sol
contracts/math/Math.sol
+1
-1
SafeMath.sol
contracts/math/SafeMath.sol
+1
-1
Acknowledger.sol
contracts/mocks/Acknowledger.sol
+1
-1
AddressImpl.sol
contracts/mocks/AddressImpl.sol
+1
-1
AllowanceCrowdsaleImpl.sol
contracts/mocks/AllowanceCrowdsaleImpl.sol
+2
-2
ArraysImpl.sol
contracts/mocks/ArraysImpl.sol
+2
-2
CappedCrowdsaleImpl.sol
contracts/mocks/CappedCrowdsaleImpl.sol
+2
-2
CapperRoleMock.sol
contracts/mocks/CapperRoleMock.sol
+1
-1
ConditionalEscrowMock.sol
contracts/mocks/ConditionalEscrowMock.sol
+1
-1
CounterImpl.sol
contracts/mocks/CounterImpl.sol
+2
-2
CrowdsaleMock.sol
contracts/mocks/CrowdsaleMock.sol
+2
-2
DetailedERC20Mock.sol
contracts/mocks/DetailedERC20Mock.sol
+2
-2
ECDSAMock.sol
contracts/mocks/ECDSAMock.sol
+2
-2
ERC165InterfacesSupported.sol
contracts/mocks/ERC165/ERC165InterfacesSupported.sol
+2
-2
ERC165NotSupported.sol
contracts/mocks/ERC165/ERC165NotSupported.sol
+1
-1
ERC165CheckerMock.sol
contracts/mocks/ERC165CheckerMock.sol
+2
-2
ERC165Mock.sol
contracts/mocks/ERC165Mock.sol
+1
-1
ERC20BurnableMock.sol
contracts/mocks/ERC20BurnableMock.sol
+1
-1
ERC20MintableMock.sol
contracts/mocks/ERC20MintableMock.sol
+1
-1
ERC20Mock.sol
contracts/mocks/ERC20Mock.sol
+1
-1
ERC20PausableMock.sol
contracts/mocks/ERC20PausableMock.sol
+1
-1
ERC20WithMetadataMock.sol
contracts/mocks/ERC20WithMetadataMock.sol
+2
-2
ERC721FullMock.sol
contracts/mocks/ERC721FullMock.sol
+3
-3
ERC721MintableBurnableImpl.sol
contracts/mocks/ERC721MintableBurnableImpl.sol
+1
-1
ERC721Mock.sol
contracts/mocks/ERC721Mock.sol
+1
-1
ERC721PausableMock.sol
contracts/mocks/ERC721PausableMock.sol
+1
-1
ERC721ReceiverMock.sol
contracts/mocks/ERC721ReceiverMock.sol
+2
-2
EventEmitter.sol
contracts/mocks/EventEmitter.sol
+6
-6
Failer.sol
contracts/mocks/Failer.sol
+1
-1
FinalizableCrowdsaleImpl.sol
contracts/mocks/FinalizableCrowdsaleImpl.sol
+2
-2
IncreasingPriceCrowdsaleImpl.sol
contracts/mocks/IncreasingPriceCrowdsaleImpl.sol
+2
-2
IndividuallyCappedCrowdsaleImpl.sol
contracts/mocks/IndividuallyCappedCrowdsaleImpl.sol
+2
-2
MathMock.sol
contracts/mocks/MathMock.sol
+1
-1
MerkleProofWrapper.sol
contracts/mocks/MerkleProofWrapper.sol
+2
-2
MintedCrowdsaleImpl.sol
contracts/mocks/MintedCrowdsaleImpl.sol
+2
-2
MinterRoleMock.sol
contracts/mocks/MinterRoleMock.sol
+1
-1
OwnableInterfaceId.sol
contracts/mocks/OwnableInterfaceId.sol
+1
-1
OwnableMock.sol
contracts/mocks/OwnableMock.sol
+1
-1
PausableCrowdsaleImpl.sol
contracts/mocks/PausableCrowdsaleImpl.sol
+2
-2
PausableMock.sol
contracts/mocks/PausableMock.sol
+1
-1
PauserRoleMock.sol
contracts/mocks/PauserRoleMock.sol
+1
-1
PostDeliveryCrowdsaleImpl.sol
contracts/mocks/PostDeliveryCrowdsaleImpl.sol
+2
-2
PullPaymentMock.sol
contracts/mocks/PullPaymentMock.sol
+1
-1
ReentrancyAttack.sol
contracts/mocks/ReentrancyAttack.sol
+3
-2
ReentrancyMock.sol
contracts/mocks/ReentrancyMock.sol
+3
-3
RefundableCrowdsaleImpl.sol
contracts/mocks/RefundableCrowdsaleImpl.sol
+2
-2
RefundablePostDeliveryCrowdsaleImpl.sol
contracts/mocks/RefundablePostDeliveryCrowdsaleImpl.sol
+2
-2
RolesMock.sol
contracts/mocks/RolesMock.sol
+1
-1
SafeERC20Helper.sol
contracts/mocks/SafeERC20Helper.sol
+4
-4
SafeMathMock.sol
contracts/mocks/SafeMathMock.sol
+1
-1
SecondaryMock.sol
contracts/mocks/SecondaryMock.sol
+1
-1
SignatureBouncerMock.sol
contracts/mocks/SignatureBouncerMock.sol
+8
-8
SignerRoleMock.sol
contracts/mocks/SignerRoleMock.sol
+1
-1
TimedCrowdsaleImpl.sol
contracts/mocks/TimedCrowdsaleImpl.sol
+2
-2
WhitelistCrowdsaleImpl.sol
contracts/mocks/WhitelistCrowdsaleImpl.sol
+2
-2
WhitelistedRoleMock.sol
contracts/mocks/WhitelistedRoleMock.sol
+1
-1
WhitelisterRoleMock.sol
contracts/mocks/WhitelisterRoleMock.sol
+1
-1
Ownable.sol
contracts/ownership/Ownable.sol
+1
-1
Secondary.sol
contracts/ownership/Secondary.sol
+1
-1
PaymentSplitter.sol
contracts/payment/PaymentSplitter.sol
+3
-3
PullPayment.sol
contracts/payment/PullPayment.sol
+2
-2
ConditionalEscrow.sol
contracts/payment/escrow/ConditionalEscrow.sol
+2
-2
Escrow.sol
contracts/payment/escrow/Escrow.sol
+2
-2
RefundEscrow.sol
contracts/payment/escrow/RefundEscrow.sol
+3
-3
ERC20.sol
contracts/token/ERC20/ERC20.sol
+1
-1
ERC20Burnable.sol
contracts/token/ERC20/ERC20Burnable.sol
+1
-1
ERC20Capped.sol
contracts/token/ERC20/ERC20Capped.sol
+1
-1
ERC20Detailed.sol
contracts/token/ERC20/ERC20Detailed.sol
+4
-4
ERC20Mintable.sol
contracts/token/ERC20/ERC20Mintable.sol
+1
-1
ERC20Pausable.sol
contracts/token/ERC20/ERC20Pausable.sol
+1
-1
IERC20.sol
contracts/token/ERC20/IERC20.sol
+1
-1
SafeERC20.sol
contracts/token/ERC20/SafeERC20.sol
+1
-1
TokenTimelock.sol
contracts/token/ERC20/TokenTimelock.sol
+1
-1
ERC721.sol
contracts/token/ERC721/ERC721.sol
+3
-3
ERC721Burnable.sol
contracts/token/ERC721/ERC721Burnable.sol
+1
-1
ERC721Enumerable.sol
contracts/token/ERC721/ERC721Enumerable.sol
+1
-1
ERC721Full.sol
contracts/token/ERC721/ERC721Full.sol
+2
-2
ERC721Holder.sol
contracts/token/ERC721/ERC721Holder.sol
+2
-2
ERC721Metadata.sol
contracts/token/ERC721/ERC721Metadata.sol
+6
-6
ERC721MetadataMintable.sol
contracts/token/ERC721/ERC721MetadataMintable.sol
+2
-2
ERC721Mintable.sol
contracts/token/ERC721/ERC721Mintable.sol
+1
-1
ERC721Pausable.sol
contracts/token/ERC721/ERC721Pausable.sol
+1
-1
IERC721.sol
contracts/token/ERC721/IERC721.sol
+2
-2
IERC721Enumerable.sol
contracts/token/ERC721/IERC721Enumerable.sol
+1
-1
IERC721Full.sol
contracts/token/ERC721/IERC721Full.sol
+1
-1
IERC721Metadata.sol
contracts/token/ERC721/IERC721Metadata.sol
+4
-4
IERC721Receiver.sol
contracts/token/ERC721/IERC721Receiver.sol
+2
-2
Address.sol
contracts/utils/Address.sol
+1
-1
Arrays.sol
contracts/utils/Arrays.sol
+1
-1
ReentrancyGuard.sol
contracts/utils/ReentrancyGuard.sol
+1
-1
package.json
package.json
+9
-8
build.sh
scripts/build.sh
+3
-2
compile.sh
scripts/compile.sh
+42
-0
No files found.
.gitignore
View file @
576b0203
...
...
@@ -37,3 +37,6 @@ build/
# truffle
.node-xmlhttprequest-*
# Temporary directory for 0.5.x compilation
solc-0.5
contracts/access/Roles.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
/**
* @title Roles
...
...
contracts/access/roles/CapperRole.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../Roles.sol";
...
...
contracts/access/roles/MinterRole.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../Roles.sol";
...
...
contracts/access/roles/PauserRole.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../Roles.sol";
...
...
contracts/access/roles/SignerRole.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../Roles.sol";
...
...
contracts/access/roles/WhitelistedRole.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../Roles.sol";
import "./WhitelisterRole.sol";
...
...
contracts/access/roles/WhitelisterRole.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../Roles.sol";
...
...
contracts/crowdsale/Crowdsale.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC20/IERC20.sol";
import "../math/SafeMath.sol";
...
...
@@ -25,7 +25,7 @@ contract Crowdsale is ReentrancyGuard {
IERC20 private _token;
// Address where funds are collected
address private _wallet;
address p
ayable p
rivate _wallet;
// How many token units a buyer gets per wei.
// The rate is the conversion between wei and the smallest and indivisible token unit.
...
...
@@ -53,10 +53,10 @@ contract Crowdsale is ReentrancyGuard {
* @param wallet Address where collected funds will be forwarded to
* @param token Address of the token being sold
*/
constructor (uint256 rate, address wallet, IERC20 token) public {
constructor (uint256 rate, address
payable
wallet, IERC20 token) public {
require(rate > 0);
require(wallet != address(0));
require(
token
!= address(0));
require(
address(token)
!= address(0));
_rate = rate;
_wallet = wallet;
...
...
@@ -87,7 +87,7 @@ contract Crowdsale is ReentrancyGuard {
/**
* @return the address where funds are collected.
*/
function wallet() public view returns (address) {
function wallet() public view returns (address
payable
) {
return _wallet;
}
...
...
contracts/crowdsale/distribution/FinalizableCrowdsale.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../../math/SafeMath.sol";
import "../validation/TimedCrowdsale.sol";
...
...
contracts/crowdsale/distribution/PostDeliveryCrowdsale.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../validation/TimedCrowdsale.sol";
import "../../math/SafeMath.sol";
...
...
contracts/crowdsale/distribution/RefundableCrowdsale.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../../math/SafeMath.sol";
import "./FinalizableCrowdsale.sol";
...
...
@@ -44,7 +44,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
* @dev Investors can claim refunds here if crowdsale is unsuccessful
* @param refundee Whose refund will be claimed.
*/
function claimRefund(address refundee) public {
function claimRefund(address
payable
refundee) public {
require(finalized());
require(!goalReached());
...
...
contracts/crowdsale/distribution/RefundablePostDeliveryCrowdsale.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./RefundableCrowdsale.sol";
import "./PostDeliveryCrowdsale.sol";
...
...
contracts/crowdsale/emission/AllowanceCrowdsale.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../Crowdsale.sol";
import "../../token/ERC20/IERC20.sol";
...
...
@@ -37,7 +37,7 @@ contract AllowanceCrowdsale is Crowdsale {
* @return Amount of tokens left in the allowance
*/
function remainingTokens() public view returns (uint256) {
return Math.min(token().balanceOf(_tokenWallet), token().allowance(_tokenWallet,
this
));
return Math.min(token().balanceOf(_tokenWallet), token().allowance(_tokenWallet,
address(this)
));
}
/**
...
...
contracts/crowdsale/emission/MintedCrowdsale.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../Crowdsale.sol";
import "../../token/ERC20/ERC20Mintable.sol";
...
...
contracts/crowdsale/price/IncreasingPriceCrowdsale.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../validation/TimedCrowdsale.sol";
import "../../math/SafeMath.sol";
...
...
contracts/crowdsale/validation/CappedCrowdsale.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../../math/SafeMath.sol";
import "../Crowdsale.sol";
...
...
contracts/crowdsale/validation/IndividuallyCappedCrowdsale.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../../math/SafeMath.sol";
import "../Crowdsale.sol";
...
...
contracts/crowdsale/validation/PausableCrowdsale.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../Crowdsale.sol";
import "../../lifecycle/Pausable.sol";
/**
* @title PausableCrowdsale
* @dev Extension of Crowdsale contract where purchases can be paused and unpaused by the pauser role.
...
...
contracts/crowdsale/validation/TimedCrowdsale.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../../math/SafeMath.sol";
import "../Crowdsale.sol";
...
...
contracts/crowdsale/validation/WhitelistCrowdsale.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../Crowdsale.sol";
import "../../access/roles/WhitelistedRole.sol";
...
...
contracts/cryptography/ECDSA.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
/**
* @title Elliptic curve signature operations
...
...
@@ -13,7 +13,7 @@ library ECDSA {
* @param hash bytes32 message, the hash is the signed message. What is recovered is the signer address.
* @param signature bytes signature, the signature is generated using web3.eth.sign()
*/
function recover(bytes32 hash, bytes signature) internal pure returns (address) {
function recover(bytes32 hash, bytes
memory
signature) internal pure returns (address) {
bytes32 r;
bytes32 s;
uint8 v;
...
...
contracts/cryptography/MerkleProof.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
/**
* @title MerkleProof
...
...
@@ -13,7 +13,7 @@ library MerkleProof {
* @param root Merkle root
* @param leaf Leaf of Merkle tree
*/
function verify(bytes32[] proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
function verify(bytes32[]
memory
proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
...
...
contracts/drafts/Counter.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
/**
* @title Counter
...
...
contracts/drafts/ERC1046/TokenMetadata.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../../token/ERC20/IERC20.sol";
...
...
@@ -9,17 +9,17 @@ import "../../token/ERC20/IERC20.sol";
* @dev TODO - update https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC721/IERC721.sol#L17 when 1046 is finalized
*/
contract ERC20TokenMetadata is IERC20 {
function tokenURI() external view returns (string);
function tokenURI() external view returns (string
memory
);
}
contract ERC20WithMetadata is ERC20TokenMetadata {
string private _tokenURI;
constructor (string tokenURI) public {
constructor (string
memory
tokenURI) public {
_tokenURI = tokenURI;
}
function tokenURI() external view returns (string) {
function tokenURI() external view returns (string
memory
) {
return _tokenURI;
}
}
contracts/drafts/ERC20Migrator.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC20/IERC20.sol";
import "../token/ERC20/ERC20Mintable.sol";
...
...
@@ -44,7 +44,7 @@ contract ERC20Migrator {
* @param legacyToken address of the old token contract
*/
constructor (IERC20 legacyToken) public {
require(
legacyToken
!= address(0));
require(
address(legacyToken)
!= address(0));
_legacyToken = legacyToken;
}
...
...
@@ -68,9 +68,9 @@ contract ERC20Migrator {
* @param newToken the token that will be minted
*/
function beginMigration(ERC20Mintable newToken) public {
require(
_newToken
== address(0));
require(
newToken
!= address(0));
require(newToken.isMinter(
this
));
require(
address(_newToken)
== address(0));
require(
address(newToken)
!= address(0));
require(newToken.isMinter(
address(this)
));
_newToken = newToken;
}
...
...
@@ -82,7 +82,7 @@ contract ERC20Migrator {
* @param amount amount of tokens to be migrated
*/
function migrate(address account, uint256 amount) public {
_legacyToken.safeTransferFrom(account,
this
, amount);
_legacyToken.safeTransferFrom(account,
address(this)
, amount);
_newToken.mint(account, amount);
}
...
...
@@ -93,7 +93,7 @@ contract ERC20Migrator {
*/
function migrateAll(address account) public {
uint256 balance = _legacyToken.balanceOf(account);
uint256 allowance = _legacyToken.allowance(account,
this
);
uint256 allowance = _legacyToken.allowance(account,
address(this)
);
uint256 amount = Math.min(balance, allowance);
migrate(account, amount);
}
...
...
contracts/drafts/SignatureBouncer.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../access/roles/SignerRole.sol";
import "../cryptography/ECDSA.sol";
...
...
@@ -48,7 +48,7 @@ contract SignatureBouncer is SignerRole {
/**
* @dev requires that a valid signature of a signer was provided
*/
modifier onlyValidSignature(bytes signature) {
modifier onlyValidSignature(bytes
memory
signature) {
require(_isValidSignature(msg.sender, signature));
_;
}
...
...
@@ -56,7 +56,7 @@ contract SignatureBouncer is SignerRole {
/**
* @dev requires that a valid signature with a specifed method of a signer was provided
*/
modifier onlyValidSignatureAndMethod(bytes signature) {
modifier onlyValidSignatureAndMethod(bytes
memory
signature) {
require(_isValidSignatureAndMethod(msg.sender, signature));
_;
}
...
...
@@ -64,7 +64,7 @@ contract SignatureBouncer is SignerRole {
/**
* @dev requires that a valid signature with a specifed method and params of a signer was provided
*/
modifier onlyValidSignatureAndData(bytes signature) {
modifier onlyValidSignatureAndData(bytes
memory
signature) {
require(_isValidSignatureAndData(msg.sender, signature));
_;
}
...
...
@@ -73,7 +73,7 @@ contract SignatureBouncer is SignerRole {
* @dev is the signature of `this + sender` from a signer?
* @return bool
*/
function _isValidSignature(address account, bytes signature) internal view returns (bool) {
function _isValidSignature(address account, bytes
memory
signature) internal view returns (bool) {
return _isValidDataHash(keccak256(abi.encodePacked(address(this), account)), signature);
}
...
...
@@ -81,7 +81,7 @@ contract SignatureBouncer is SignerRole {
* @dev is the signature of `this + sender + methodId` from a signer?
* @return bool
*/
function _isValidSignatureAndMethod(address account, bytes signature) internal view returns (bool) {
function _isValidSignatureAndMethod(address account, bytes
memory
signature) internal view returns (bool) {
bytes memory data = new bytes(_METHOD_ID_SIZE);
for (uint i = 0; i < data.length; i++) {
data[i] = msg.data[i];
...
...
@@ -94,7 +94,7 @@ contract SignatureBouncer is SignerRole {
* @notice the signature parameter of the method being validated must be the "last" parameter
* @return bool
*/
function _isValidSignatureAndData(address account, bytes signature) internal view returns (bool) {
function _isValidSignatureAndData(address account, bytes
memory
signature) internal view returns (bool) {
require(msg.data.length > _SIGNATURE_SIZE);
bytes memory data = new bytes(msg.data.length - _SIGNATURE_SIZE);
...
...
@@ -110,7 +110,7 @@ contract SignatureBouncer is SignerRole {
* and then recover the signature and check it against the signer role
* @return bool
*/
function _isValidDataHash(bytes32 hash, bytes signature) internal view returns (bool) {
function _isValidDataHash(bytes32 hash, bytes
memory
signature) internal view returns (bool) {
address signer = hash.toEthSignedMessageHash().recover(signature);
return signer != address(0) && isSigner(signer);
...
...
contracts/drafts/TokenVesting.sol
View file @
576b0203
/* solium-disable security/no-block-members */
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC20/SafeERC20.sol";
import "../ownership/Ownable.sol";
...
...
@@ -112,11 +112,11 @@ contract TokenVesting is Ownable {
require(unreleased > 0);
_released[
token] = _released[token
].add(unreleased);
_released[
address(token)] = _released[address(token)
].add(unreleased);
token.safeTransfer(_beneficiary, unreleased);
emit TokensReleased(
token
, unreleased);
emit TokensReleased(
address(token)
, unreleased);
}
/**
...
...
@@ -126,18 +126,18 @@ contract TokenVesting is Ownable {
*/
function revoke(IERC20 token) public onlyOwner {
require(_revocable);
require(!_revoked[
token
]);
require(!_revoked[
address(token)
]);
uint256 balance = token.balanceOf(address(this));
uint256 unreleased = _releasableAmount(token);
uint256 refund = balance.sub(unreleased);
_revoked[
token
] = true;
_revoked[
address(token)
] = true;
token.safeTransfer(owner(), refund);
emit TokenVestingRevoked(
token
);
emit TokenVestingRevoked(
address(token)
);
}
/**
...
...
@@ -145,7 +145,7 @@ contract TokenVesting is Ownable {
* @param token ERC20 token which is being vested
*/
function _releasableAmount(IERC20 token) private view returns (uint256) {
return _vestedAmount(token).sub(_released[
token
]);
return _vestedAmount(token).sub(_released[
address(token)
]);
}
/**
...
...
@@ -154,11 +154,11 @@ contract TokenVesting is Ownable {
*/
function _vestedAmount(IERC20 token) private view returns (uint256) {
uint256 currentBalance = token.balanceOf(address(this));
uint256 totalBalance = currentBalance.add(_released[
token
]);
uint256 totalBalance = currentBalance.add(_released[
address(token)
]);
if (block.timestamp < _cliff) {
return 0;
} else if (block.timestamp >= _start.add(_duration) || _revoked[
token
]) {
} else if (block.timestamp >= _start.add(_duration) || _revoked[
address(token)
]) {
return totalBalance;
} else {
return totalBalance.mul(block.timestamp.sub(_start)).div(_duration);
...
...
contracts/examples/SampleCrowdsale.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../crowdsale/validation/CappedCrowdsale.sol";
import "../crowdsale/distribution/RefundableCrowdsale.sol";
...
...
@@ -38,7 +38,7 @@ contract SampleCrowdsale is CappedCrowdsale, RefundableCrowdsale, MintedCrowdsal
uint256 openingTime,
uint256 closingTime,
uint256 rate,
address wallet,
address
payable
wallet,
uint256 cap,
ERC20Mintable token,
uint256 goal
...
...
contracts/examples/SimpleToken.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC20/ERC20.sol";
import "../token/ERC20/ERC20Detailed.sol";
...
...
@@ -10,12 +10,13 @@ import "../token/ERC20/ERC20Detailed.sol";
* `ERC20` functions.
*/
contract SimpleToken is ERC20, ERC20Detailed {
uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals()));
uint8 public constant DECIMALS = 18;
uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(DECIMALS));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor () public ERC20Detailed("SimpleToken", "SIM",
18
) {
constructor () public ERC20Detailed("SimpleToken", "SIM",
DECIMALS
) {
_mint(msg.sender, INITIAL_SUPPLY);
}
}
contracts/introspection/ERC165.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./IERC165.sol";
...
...
contracts/introspection/ERC165Checker.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
/**
* @title ERC165Checker
...
...
@@ -49,7 +49,7 @@ library ERC165Checker {
* interfaceIds list, false otherwise
* @dev Interface identification is specified in ERC-165.
*/
function _supportsAllInterfaces(address account, bytes4[] interfaceIds) internal view returns (bool) {
function _supportsAllInterfaces(address account, bytes4[]
memory
interfaceIds) internal view returns (bool) {
// query support of ERC165 itself
if (!_supportsERC165(account)) {
return false;
...
...
contracts/introspection/IERC165.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
/**
* @title IERC165
...
...
contracts/lifecycle/Pausable.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../access/roles/PauserRole.sol";
...
...
contracts/math/Math.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
/**
* @title Math
...
...
contracts/math/SafeMath.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
/**
* @title SafeMath
...
...
contracts/mocks/Acknowledger.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
contract Acknowledger {
event AcknowledgeFoo(uint256 a);
...
...
contracts/mocks/AddressImpl.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../utils/Address.sol";
...
...
contracts/mocks/AllowanceCrowdsaleImpl.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC20/IERC20.sol";
import "../crowdsale/emission/AllowanceCrowdsale.sol";
contract AllowanceCrowdsaleImpl is AllowanceCrowdsale {
constructor (uint256 rate, address wallet, IERC20 token, address tokenWallet)
constructor (uint256 rate, address
payable
wallet, IERC20 token, address tokenWallet)
public
Crowdsale(rate, wallet, token)
AllowanceCrowdsale(tokenWallet)
...
...
contracts/mocks/ArraysImpl.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../utils/Arrays.sol";
...
...
@@ -7,7 +7,7 @@ contract ArraysImpl {
uint256[] private array;
constructor (uint256[] _array) public {
constructor (uint256[]
memory
_array) public {
array = _array;
}
...
...
contracts/mocks/CappedCrowdsaleImpl.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC20/IERC20.sol";
import "../crowdsale/validation/CappedCrowdsale.sol";
contract CappedCrowdsaleImpl is CappedCrowdsale {
constructor (uint256 rate, address wallet, IERC20 token, uint256 cap)
constructor (uint256 rate, address
payable
wallet, IERC20 token, uint256 cap)
public
Crowdsale(rate, wallet, token)
CappedCrowdsale(cap)
...
...
contracts/mocks/CapperRoleMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../access/roles/CapperRole.sol";
...
...
contracts/mocks/ConditionalEscrowMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../payment/escrow/ConditionalEscrow.sol";
...
...
contracts/mocks/CounterImpl.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../drafts/Counter.sol";
...
...
@@ -10,7 +10,7 @@ contract CounterImpl {
// use whatever key you want to track your counters
mapping(string => Counter.Counter) private _counters;
function doThing(string key) public returns (uint256) {
function doThing(string
memory
key) public returns (uint256) {
theId = _counters[key].next();
return theId;
}
...
...
contracts/mocks/CrowdsaleMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../crowdsale/Crowdsale.sol";
contract CrowdsaleMock is Crowdsale {
constructor (uint256 rate, address wallet, IERC20 token) public Crowdsale(rate, wallet, token) {}
constructor (uint256 rate, address
payable
wallet, IERC20 token) public Crowdsale(rate, wallet, token) {}
}
contracts/mocks/DetailedERC20Mock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC20/ERC20.sol";
import "../token/ERC20/ERC20Detailed.sol";
contract ERC20DetailedMock is ERC20, ERC20Detailed {
constructor (string
name, string
symbol, uint8 decimals) ERC20Detailed(name, symbol, decimals) public {}
constructor (string
memory name, string memory
symbol, uint8 decimals) ERC20Detailed(name, symbol, decimals) public {}
}
contracts/mocks/ECDSAMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../cryptography/ECDSA.sol";
contract ECDSAMock {
using ECDSA for bytes32;
function recover(bytes32 hash, bytes signature) public pure returns (address) {
function recover(bytes32 hash, bytes
memory
signature) public pure returns (address) {
return hash.recover(signature);
}
...
...
contracts/mocks/ERC165/ERC165InterfacesSupported.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../../introspection/IERC165.sol";
...
...
@@ -47,7 +47,7 @@ contract SupportsInterfaceWithLookupMock is IERC165 {
}
contract ERC165InterfacesSupported is SupportsInterfaceWithLookupMock {
constructor (bytes4[] interfaceIds) public {
constructor (bytes4[]
memory
interfaceIds) public {
for (uint256 i = 0; i < interfaceIds.length; i++) {
_registerInterface(interfaceIds[i]);
}
...
...
contracts/mocks/ERC165/ERC165NotSupported.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
contract ERC165NotSupported {}
contracts/mocks/ERC165CheckerMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../introspection/ERC165Checker.sol";
...
...
@@ -13,7 +13,7 @@ contract ERC165CheckerMock {
return account._supportsInterface(interfaceId);
}
function supportsAllInterfaces(address account, bytes4[] interfaceIds) public view returns (bool) {
function supportsAllInterfaces(address account, bytes4[]
memory
interfaceIds) public view returns (bool) {
return account._supportsAllInterfaces(interfaceIds);
}
}
contracts/mocks/ERC165Mock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../introspection/ERC165.sol";
...
...
contracts/mocks/ERC20BurnableMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC20/ERC20Burnable.sol";
...
...
contracts/mocks/ERC20MintableMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC20/ERC20Mintable.sol";
import "./MinterRoleMock.sol";
...
...
contracts/mocks/ERC20Mock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC20/ERC20.sol";
...
...
contracts/mocks/ERC20PausableMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC20/ERC20Pausable.sol";
import "./PauserRoleMock.sol";
...
...
contracts/mocks/ERC20WithMetadataMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC20/ERC20.sol";
import "../drafts/ERC1046/TokenMetadata.sol";
contract ERC20WithMetadataMock is ERC20, ERC20WithMetadata {
constructor (string tokenURI) public ERC20WithMetadata(tokenURI) {}
constructor (string
memory
tokenURI) public ERC20WithMetadata(tokenURI) {}
}
contracts/mocks/ERC721FullMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC721/ERC721Full.sol";
import "../token/ERC721/ERC721Mintable.sol";
...
...
@@ -11,7 +11,7 @@ import "../token/ERC721/ERC721Burnable.sol";
* checking token existence, removal of a token from an address
*/
contract ERC721FullMock is ERC721Full, ERC721Mintable, ERC721MetadataMintable, ERC721Burnable {
constructor (string
name, string
symbol) public ERC721Mintable() ERC721Full(name, symbol) {}
constructor (string
memory name, string memory
symbol) public ERC721Mintable() ERC721Full(name, symbol) {}
function exists(uint256 tokenId) public view returns (bool) {
return _exists(tokenId);
...
...
@@ -21,7 +21,7 @@ contract ERC721FullMock is ERC721Full, ERC721Mintable, ERC721MetadataMintable, E
return _tokensOfOwner(owner);
}
function setTokenURI(uint256 tokenId, string uri) public {
function setTokenURI(uint256 tokenId, string
memory
uri) public {
_setTokenURI(tokenId, uri);
}
}
contracts/mocks/ERC721MintableBurnableImpl.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC721/ERC721Full.sol";
import "../token/ERC721/ERC721Mintable.sol";
...
...
contracts/mocks/ERC721Mock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC721/ERC721.sol";
...
...
contracts/mocks/ERC721PausableMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC721/ERC721Pausable.sol";
import "./PauserRoleMock.sol";
...
...
contracts/mocks/ERC721ReceiverMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC721/IERC721Receiver.sol";
...
...
@@ -13,7 +13,7 @@ contract ERC721ReceiverMock is IERC721Receiver {
_reverts = reverts;
}
function onERC721Received(address operator, address from, uint256 tokenId, bytes data) public returns (bytes4) {
function onERC721Received(address operator, address from, uint256 tokenId, bytes
memory
data) public returns (bytes4) {
require(!_reverts);
emit Received(operator, from, tokenId, data, gasleft());
return _retval;
...
...
contracts/mocks/EventEmitter.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
contract EventEmitter {
event Argumentless();
...
...
@@ -11,7 +11,7 @@ contract EventEmitter {
event String(string value);
event LongUintBooleanString(uint256 uintValue, bool booleanValue, string stringValue);
constructor (uint8 uintValue, bool booleanValue, string stringValue) public {
constructor (uint8 uintValue, bool booleanValue, string
memory
stringValue) public {
emit ShortUint(uintValue);
emit Boolean(booleanValue);
emit String(stringValue);
...
...
@@ -45,11 +45,11 @@ contract EventEmitter {
emit Boolean(value);
}
function emitString(string value) public {
function emitString(string
memory
value) public {
emit String(value);
}
function emitLongUintBooleanString(uint256 uintValue, bool booleanValue, string stringValue) public {
function emitLongUintBooleanString(uint256 uintValue, bool booleanValue, string
memory
stringValue) public {
emit LongUintBooleanString(uintValue, booleanValue, stringValue);
}
...
...
@@ -58,7 +58,7 @@ contract EventEmitter {
emit Boolean(boolValue);
}
function emitStringAndEmitIndirectly(string value, IndirectEventEmitter emitter) public {
function emitStringAndEmitIndirectly(string
memory
value, IndirectEventEmitter emitter) public {
emit String(value);
emitter.emitStringIndirectly(value);
}
...
...
@@ -67,7 +67,7 @@ contract EventEmitter {
contract IndirectEventEmitter {
event IndirectString(string value);
function emitStringIndirectly(string value) public {
function emitStringIndirectly(string
memory
value) public {
emit IndirectString(value);
}
}
contracts/mocks/Failer.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
contract Failer {
uint256[] private array;
...
...
contracts/mocks/FinalizableCrowdsaleImpl.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC20/IERC20.sol";
import "../crowdsale/distribution/FinalizableCrowdsale.sol";
contract FinalizableCrowdsaleImpl is FinalizableCrowdsale {
constructor (uint256 openingTime, uint256 closingTime, uint256 rate, address wallet, IERC20 token)
constructor (uint256 openingTime, uint256 closingTime, uint256 rate, address
payable
wallet, IERC20 token)
public
Crowdsale(rate, wallet, token)
TimedCrowdsale(openingTime, closingTime)
...
...
contracts/mocks/IncreasingPriceCrowdsaleImpl.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../crowdsale/price/IncreasingPriceCrowdsale.sol";
import "../math/SafeMath.sol";
...
...
@@ -7,7 +7,7 @@ contract IncreasingPriceCrowdsaleImpl is IncreasingPriceCrowdsale {
constructor (
uint256 openingTime,
uint256 closingTime,
address wallet,
address
payable
wallet,
IERC20 token,
uint256 initialRate,
uint256 finalRate
...
...
contracts/mocks/IndividuallyCappedCrowdsaleImpl.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC20/IERC20.sol";
import "../crowdsale/validation/IndividuallyCappedCrowdsale.sol";
import "./CapperRoleMock.sol";
contract IndividuallyCappedCrowdsaleImpl is IndividuallyCappedCrowdsale, CapperRoleMock {
constructor (uint256 rate, address wallet, IERC20 token) public Crowdsale(rate, wallet, token)
constructor (uint256 rate, address
payable
wallet, IERC20 token) public Crowdsale(rate, wallet, token)
{}
}
contracts/mocks/MathMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../math/Math.sol";
...
...
contracts/mocks/MerkleProofWrapper.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import { MerkleProof } from "../cryptography/MerkleProof.sol";
contract MerkleProofWrapper {
function verify(bytes32[] proof, bytes32 root, bytes32 leaf) public pure returns (bool) {
function verify(bytes32[]
memory
proof, bytes32 root, bytes32 leaf) public pure returns (bool) {
return MerkleProof.verify(proof, root, leaf);
}
}
contracts/mocks/MintedCrowdsaleImpl.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC20/ERC20Mintable.sol";
import "../crowdsale/emission/MintedCrowdsale.sol";
contract MintedCrowdsaleImpl is MintedCrowdsale {
constructor (uint256 rate, address wallet, ERC20Mintable token) public Crowdsale(rate, wallet, token) {}
constructor (uint256 rate, address
payable
wallet, ERC20Mintable token) public Crowdsale(rate, wallet, token) {}
}
contracts/mocks/MinterRoleMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../access/roles/MinterRole.sol";
...
...
contracts/mocks/OwnableInterfaceId.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../ownership/Ownable.sol";
...
...
contracts/mocks/OwnableMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../ownership/Ownable.sol";
...
...
contracts/mocks/PausableCrowdsaleImpl.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC20/ERC20.sol";
import "../crowdsale/validation/PausableCrowdsale.sol";
contract PausableCrowdsaleImpl is PausableCrowdsale {
constructor (uint256 _rate, address _wallet, ERC20 _token) public Crowdsale(_rate, _wallet, _token) {
constructor (uint256 _rate, address
payable
_wallet, ERC20 _token) public Crowdsale(_rate, _wallet, _token) {
}
}
contracts/mocks/PausableMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../lifecycle/Pausable.sol";
import "./PauserRoleMock.sol";
...
...
contracts/mocks/PauserRoleMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../access/roles/PauserRole.sol";
...
...
contracts/mocks/PostDeliveryCrowdsaleImpl.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC20/IERC20.sol";
import "../crowdsale/distribution/PostDeliveryCrowdsale.sol";
contract PostDeliveryCrowdsaleImpl is PostDeliveryCrowdsale {
constructor (uint256 openingTime, uint256 closingTime, uint256 rate, address wallet, IERC20 token)
constructor (uint256 openingTime, uint256 closingTime, uint256 rate, address
payable
wallet, IERC20 token)
public
TimedCrowdsale(openingTime, closingTime)
Crowdsale(rate, wallet, token)
...
...
contracts/mocks/PullPaymentMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../payment/PullPayment.sol";
...
...
contracts/mocks/ReentrancyAttack.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
contract ReentrancyAttack {
function callSender(bytes4 data) public {
// solium-disable-next-line security/no-low-level-calls
require(msg.sender.call(abi.encodeWithSelector(data)));
(bool success,) = msg.sender.call(abi.encodeWithSelector(data));
require(success);
}
}
contracts/mocks/ReentrancyMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../utils/ReentrancyGuard.sol";
import "./ReentrancyAttack.sol";
...
...
@@ -25,8 +25,8 @@ contract ReentrancyMock is ReentrancyGuard {
if (n > 0) {
count();
// solium-disable-next-line security/no-low-level-calls
bool result
= address(this).call(abi.encodeWithSignature("countThisRecursive(uint256)", n - 1));
require(
result == true
);
(bool success,)
= address(this).call(abi.encodeWithSignature("countThisRecursive(uint256)", n - 1));
require(
success
);
}
}
...
...
contracts/mocks/RefundableCrowdsaleImpl.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC20/IERC20.sol";
import "../crowdsale/distribution/RefundableCrowdsale.sol";
...
...
@@ -8,7 +8,7 @@ contract RefundableCrowdsaleImpl is RefundableCrowdsale {
uint256 openingTime,
uint256 closingTime,
uint256 rate,
address wallet,
address
payable
wallet,
IERC20 token,
uint256 goal
)
...
...
contracts/mocks/RefundablePostDeliveryCrowdsaleImpl.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC20/IERC20.sol";
import "../crowdsale/distribution/RefundablePostDeliveryCrowdsale.sol";
...
...
@@ -8,7 +8,7 @@ contract RefundablePostDeliveryCrowdsaleImpl is RefundablePostDeliveryCrowdsale
uint256 openingTime,
uint256 closingTime,
uint256 rate,
address wallet,
address
payable
wallet,
IERC20 token,
uint256 goal
)
...
...
contracts/mocks/RolesMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../access/Roles.sol";
...
...
contracts/mocks/SafeERC20Helper.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC20/IERC20.sol";
import "../token/ERC20/SafeERC20.sol";
...
...
@@ -54,8 +54,8 @@ contract SafeERC20Helper {
IERC20 private _succeeding;
constructor () public {
_failing = IERC20(
new ERC20FailingMock(
));
_succeeding = IERC20(
new ERC20SucceedingMock(
));
_failing = IERC20(
address(new ERC20FailingMock()
));
_succeeding = IERC20(
address(new ERC20SucceedingMock()
));
}
// Using _failing
...
...
@@ -103,7 +103,7 @@ contract SafeERC20Helper {
}
function setAllowance(uint256 allowance_) public {
ERC20SucceedingMock(
_succeeding
).setAllowance(allowance_);
ERC20SucceedingMock(
address(_succeeding)
).setAllowance(allowance_);
}
function allowance() public view returns (uint256) {
...
...
contracts/mocks/SafeMathMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../math/SafeMath.sol";
...
...
contracts/mocks/SecondaryMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../ownership/Secondary.sol";
...
...
contracts/mocks/SignatureBouncerMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../drafts/SignatureBouncer.sol";
import "./SignerRoleMock.sol";
contract SignatureBouncerMock is SignatureBouncer, SignerRoleMock {
function checkValidSignature(address account, bytes signature) public view returns (bool) {
function checkValidSignature(address account, bytes
memory
signature) public view returns (bool) {
return _isValidSignature(account, signature);
}
function onlyWithValidSignature(bytes signature) public onlyValidSignature(signature) view {}
function onlyWithValidSignature(bytes
memory
signature) public onlyValidSignature(signature) view {}
function checkValidSignatureAndMethod(address account, bytes signature) public view returns (bool) {
function checkValidSignatureAndMethod(address account, bytes
memory
signature) public view returns (bool) {
return _isValidSignatureAndMethod(account, signature);
}
function onlyWithValidSignatureAndMethod(bytes signature) public onlyValidSignatureAndMethod(signature) view {}
function onlyWithValidSignatureAndMethod(bytes
memory
signature) public onlyValidSignatureAndMethod(signature) view {}
function checkValidSignatureAndData(address account, bytes
, uint, bytes
signature) public view returns (bool) {
function checkValidSignatureAndData(address account, bytes
memory, uint, bytes memory
signature) public view returns (bool) {
return _isValidSignatureAndData(account, signature);
}
function onlyWithValidSignatureAndData(uint, bytes signature) public onlyValidSignatureAndData(signature) view {}
function onlyWithValidSignatureAndData(uint, bytes
memory
signature) public onlyValidSignatureAndData(signature) view {}
function theWrongMethod(bytes) public pure {}
function theWrongMethod(bytes
memory
) public pure {}
function tooShortMsgData() public onlyValidSignatureAndData("") view {}
}
contracts/mocks/SignerRoleMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../access/roles/SignerRole.sol";
...
...
contracts/mocks/TimedCrowdsaleImpl.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC20/IERC20.sol";
import "../crowdsale/validation/TimedCrowdsale.sol";
contract TimedCrowdsaleImpl is TimedCrowdsale {
constructor (uint256 openingTime, uint256 closingTime, uint256 rate, address wallet, IERC20 token)
constructor (uint256 openingTime, uint256 closingTime, uint256 rate, address
payable
wallet, IERC20 token)
public
Crowdsale(rate, wallet, token)
TimedCrowdsale(openingTime, closingTime)
...
...
contracts/mocks/WhitelistCrowdsaleImpl.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../token/ERC20/IERC20.sol";
import "../crowdsale/validation/WhitelistCrowdsale.sol";
...
...
@@ -6,5 +6,5 @@ import "../crowdsale/Crowdsale.sol";
contract WhitelistCrowdsaleImpl is Crowdsale, WhitelistCrowdsale {
constructor (uint256 _rate, address _wallet, IERC20 _token) Crowdsale(_rate, _wallet, _token) public {}
constructor (uint256 _rate, address
payable
_wallet, IERC20 _token) Crowdsale(_rate, _wallet, _token) public {}
}
contracts/mocks/WhitelistedRoleMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../access/roles/WhitelistedRole.sol";
...
...
contracts/mocks/WhitelisterRoleMock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../access/roles/WhitelisterRole.sol";
...
...
contracts/ownership/Ownable.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
/**
* @title Ownable
...
...
contracts/ownership/Secondary.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
/**
* @title Secondary
...
...
contracts/payment/PaymentSplitter.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../math/SafeMath.sol";
...
...
@@ -24,7 +24,7 @@ contract PaymentSplitter {
/**
* @dev Constructor
*/
constructor (address[]
payees, uint256[]
shares) public payable {
constructor (address[]
memory payees, uint256[] memory
shares) public payable {
require(payees.length == shares.length);
require(payees.length > 0);
...
...
@@ -79,7 +79,7 @@ contract PaymentSplitter {
* @dev Release one of the payee's proportional payment.
* @param account Whose payments will be released.
*/
function release(address account) public {
function release(address
payable
account) public {
require(_shares[account] > 0);
uint256 totalReceived = address(this).balance.add(_totalReleased);
...
...
contracts/payment/PullPayment.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./escrow/Escrow.sol";
...
...
@@ -18,7 +18,7 @@ contract PullPayment {
* @dev Withdraw accumulated balance.
* @param payee Whose balance will be withdrawn.
*/
function withdrawPayments(address payee) public {
function withdrawPayments(address pay
able pay
ee) public {
_escrow.withdraw(payee);
}
...
...
contracts/payment/escrow/ConditionalEscrow.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./Escrow.sol";
...
...
@@ -15,7 +15,7 @@ contract ConditionalEscrow is Escrow {
*/
function withdrawalAllowed(address payee) public view returns (bool);
function withdraw(address payee) public {
function withdraw(address pay
able pay
ee) public {
require(withdrawalAllowed(payee));
super.withdraw(payee);
}
...
...
contracts/payment/escrow/Escrow.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../../math/SafeMath.sol";
import "../../ownership/Secondary.sol";
...
...
@@ -42,7 +42,7 @@ contract Escrow is Secondary {
* @dev Withdraw accumulated balance for a payee.
* @param payee The address whose funds will be withdrawn and transferred to.
*/
function withdraw(address payee) public onlyPrimary {
function withdraw(address pay
able pay
ee) public onlyPrimary {
uint256 payment = _deposits[payee];
_deposits[payee] = 0;
...
...
contracts/payment/escrow/RefundEscrow.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./ConditionalEscrow.sol";
...
...
@@ -20,13 +20,13 @@ contract RefundEscrow is ConditionalEscrow {
event RefundsEnabled();
State private _state;
address private _beneficiary;
address p
ayable p
rivate _beneficiary;
/**
* @dev Constructor.
* @param beneficiary The beneficiary of the deposits.
*/
constructor (address beneficiary) public {
constructor (address
payable
beneficiary) public {
require(beneficiary != address(0));
_beneficiary = beneficiary;
_state = State.Active;
...
...
contracts/token/ERC20/ERC20.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./IERC20.sol";
import "../../math/SafeMath.sol";
...
...
contracts/token/ERC20/ERC20Burnable.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./ERC20.sol";
...
...
contracts/token/ERC20/ERC20Capped.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./ERC20Mintable.sol";
...
...
contracts/token/ERC20/ERC20Detailed.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./IERC20.sol";
...
...
@@ -13,7 +13,7 @@ contract ERC20Detailed is IERC20 {
string private _symbol;
uint8 private _decimals;
constructor (string
name, string
symbol, uint8 decimals) public {
constructor (string
memory name, string memory
symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
...
...
@@ -22,14 +22,14 @@ contract ERC20Detailed is IERC20 {
/**
* @return the name of the token.
*/
function name() public view returns (string) {
function name() public view returns (string
memory
) {
return _name;
}
/**
* @return the symbol of the token.
*/
function symbol() public view returns (string) {
function symbol() public view returns (string
memory
) {
return _symbol;
}
...
...
contracts/token/ERC20/ERC20Mintable.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./ERC20.sol";
import "../../access/roles/MinterRole.sol";
...
...
contracts/token/ERC20/ERC20Pausable.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./ERC20.sol";
import "../../lifecycle/Pausable.sol";
...
...
contracts/token/ERC20/IERC20.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
/**
* @title ERC20 interface
...
...
contracts/token/ERC20/SafeERC20.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./IERC20.sol";
import "../../math/SafeMath.sol";
...
...
contracts/token/ERC20/TokenTimelock.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./SafeERC20.sol";
...
...
contracts/token/ERC721/ERC721.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
...
...
@@ -163,7 +163,7 @@ contract ERC721 is ERC165, IERC721 {
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes data to send along with a safe transfer check
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes _data) public {
function safeTransferFrom(address from, address to, uint256 tokenId, bytes
memory
_data) public {
transferFrom(from, to, tokenId);
// solium-disable-next-line arg-overflow
require(_checkOnERC721Received(from, to, tokenId, _data));
...
...
@@ -267,7 +267,7 @@ contract ERC721 is ERC165, IERC721 {
* @param _data bytes optional data to send along with the call
* @return whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes _data) internal returns (bool) {
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes
memory
_data) internal returns (bool) {
if (!to.isContract()) {
return true;
}
...
...
contracts/token/ERC721/ERC721Burnable.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./ERC721.sol";
...
...
contracts/token/ERC721/ERC721Enumerable.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./IERC721Enumerable.sol";
import "./ERC721.sol";
...
...
contracts/token/ERC721/ERC721Full.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./ERC721.sol";
import "./ERC721Enumerable.sol";
...
...
@@ -11,5 +11,5 @@ import "./ERC721Metadata.sol";
* @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract ERC721Full is ERC721, ERC721Enumerable, ERC721Metadata {
constructor (string
name, string
symbol) ERC721Metadata(name, symbol) public {}
constructor (string
memory name, string memory
symbol) ERC721Metadata(name, symbol) public {}
}
contracts/token/ERC721/ERC721Holder.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./IERC721Receiver.sol";
contract ERC721Holder is IERC721Receiver {
function onERC721Received(address, address, uint256, bytes) public returns (bytes4) {
function onERC721Received(address, address, uint256, bytes
memory
) public returns (bytes4) {
return this.onERC721Received.selector;
}
}
contracts/token/ERC721/ERC721Metadata.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./ERC721.sol";
import "./IERC721Metadata.sol";
...
...
@@ -25,7 +25,7 @@ contract ERC721Metadata is ERC165, ERC721, IERC721Metadata {
/**
* @dev Constructor function
*/
constructor (string
name, string
symbol) public {
constructor (string
memory name, string memory
symbol) public {
_name = name;
_symbol = symbol;
...
...
@@ -37,7 +37,7 @@ contract ERC721Metadata is ERC165, ERC721, IERC721Metadata {
* @dev Gets the token name
* @return string representing the token name
*/
function name() external view returns (string) {
function name() external view returns (string
memory
) {
return _name;
}
...
...
@@ -45,7 +45,7 @@ contract ERC721Metadata is ERC165, ERC721, IERC721Metadata {
* @dev Gets the token symbol
* @return string representing the token symbol
*/
function symbol() external view returns (string) {
function symbol() external view returns (string
memory
) {
return _symbol;
}
...
...
@@ -54,7 +54,7 @@ contract ERC721Metadata is ERC165, ERC721, IERC721Metadata {
* Throws if the token ID does not exist. May return an empty string.
* @param tokenId uint256 ID of the token to query
*/
function tokenURI(uint256 tokenId) external view returns (string) {
function tokenURI(uint256 tokenId) external view returns (string
memory
) {
require(_exists(tokenId));
return _tokenURIs[tokenId];
}
...
...
@@ -65,7 +65,7 @@ contract ERC721Metadata is ERC165, ERC721, IERC721Metadata {
* @param tokenId uint256 ID of the token to set its URI
* @param uri string URI to assign
*/
function _setTokenURI(uint256 tokenId, string uri) internal {
function _setTokenURI(uint256 tokenId, string
memory
uri) internal {
require(_exists(tokenId));
_tokenURIs[tokenId] = uri;
}
...
...
contracts/token/ERC721/ERC721MetadataMintable.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./ERC721Metadata.sol";
import "../../access/roles/MinterRole.sol";
...
...
@@ -16,7 +16,7 @@ contract ERC721MetadataMintable is ERC721, ERC721Metadata, MinterRole {
* @param tokenURI The token URI of the minted token.
* @return A boolean that indicates if the operation was successful.
*/
function mintWithTokenURI(address to, uint256 tokenId, string tokenURI) public onlyMinter returns (bool) {
function mintWithTokenURI(address to, uint256 tokenId, string
memory
tokenURI) public onlyMinter returns (bool) {
_mint(to, tokenId);
_setTokenURI(tokenId, tokenURI);
return true;
...
...
contracts/token/ERC721/ERC721Mintable.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./ERC721.sol";
import "../../access/roles/MinterRole.sol";
...
...
contracts/token/ERC721/ERC721Pausable.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./ERC721.sol";
import "../../lifecycle/Pausable.sol";
...
...
contracts/token/ERC721/IERC721.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../../introspection/IERC165.sol";
...
...
@@ -23,5 +23,5 @@ contract IERC721 is IERC165 {
function transferFrom(address from, address to, uint256 tokenId) public;
function safeTransferFrom(address from, address to, uint256 tokenId) public;
function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) public;
function safeTransferFrom(address from, address to, uint256 tokenId, bytes
memory
data) public;
}
contracts/token/ERC721/IERC721Enumerable.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./IERC721.sol";
...
...
contracts/token/ERC721/IERC721Full.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./IERC721.sol";
import "./IERC721Enumerable.sol";
...
...
contracts/token/ERC721/IERC721Metadata.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "./IERC721.sol";
...
...
@@ -7,7 +7,7 @@ import "./IERC721.sol";
* @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract IERC721Metadata is IERC721 {
function name() external view returns (string);
function symbol() external view returns (string);
function tokenURI(uint256 tokenId) external view returns (string);
function name() external view returns (string
memory
);
function symbol() external view returns (string
memory
);
function tokenURI(uint256 tokenId) external view returns (string
memory
);
}
contracts/token/ERC721/IERC721Receiver.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
/**
* @title ERC721 token receiver interface
...
...
@@ -20,5 +20,5 @@ contract IERC721Receiver {
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
*/
function onERC721Received(address operator, address from, uint256 tokenId, bytes data) public returns (bytes4);
function onERC721Received(address operator, address from, uint256 tokenId, bytes
memory
data) public returns (bytes4);
}
contracts/utils/Address.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
/**
* Utility library of inline functions on addresses
...
...
contracts/utils/Arrays.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
import "../math/Math.sol";
...
...
contracts/utils/ReentrancyGuard.sol
View file @
576b0203
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
/**
* @title Helps contracts guard against reentrancy attacks.
...
...
package.json
View file @
576b0203
...
...
@@ -8,18 +8,19 @@
"test"
],
"scripts"
:
{
"test"
:
"scripts/test.sh"
,
"build"
:
"scripts/build.sh"
,
"compile"
:
"scripts/compile.sh"
,
"console"
:
"truffle console"
,
"coverage"
:
"scripts/coverage.sh"
,
"lint"
:
"npm run lint:js && npm run lint:sol"
,
"lint:fix"
:
"npm run lint:js:fix && npm run lint:sol:fix"
,
"lint:js"
:
"eslint ."
,
"lint:js:fix"
:
"eslint . --fix"
,
"lint:sol"
:
"solium -d ."
,
"lint:sol:fix"
:
"solium -d . --fix"
,
"lint"
:
"npm run lint:js && npm run lint:sol"
,
"lint:fix"
:
"npm run lint:js:fix && npm run lint:sol:fix"
,
"console"
:
"truffle console"
,
"coverage"
:
"scripts/coverage.sh"
,
"version"
:
"scripts/version.js"
,
"build"
:
"scripts/build.sh"
,
"prepack"
:
"npm run build"
"prepack"
:
"npm run build"
,
"test"
:
"npm run compile && scripts/test.sh"
,
"version"
:
"scripts/version.js"
},
"repository"
:
{
"type"
:
"git"
,
...
...
scripts/build.sh
View file @
576b0203
...
...
@@ -7,7 +7,8 @@ set -o errexit
rm
-rf
build
# Create a temporary directory to place ignored files (e.g. examples).
tmp_dir
=
"
$(
mktemp
-dp
.
)
"
tmp_dir
=
"ignored_contracts"
mkdir
"
$tmp_dir
"
# Move the ignored files to the temporary directory.
while
IFS
=
""
read
-r
ignored
...
...
@@ -16,7 +17,7 @@ do
done
< contracts/.npmignore
# Compile everything else.
n
ode_modules/.bin/truffle
compile
n
pm run
compile
# Return ignored files to their place.
mv
"
$tmp_dir
/"
*
contracts/
...
...
scripts/compile.sh
0 → 100755
View file @
576b0203
#!/usr/bin/env bash
# Configure to exit script as soon as a command fails.
set
-o
errexit
SOLC_05_DIR
=
solc-0.5
# Delete any previous build artifacts
rm
-rf
build/
# Create a subproject where 0.5.x compilation will take place
mkdir
-p
"
$SOLC_05_DIR
"
cd
"
$SOLC_05_DIR
"
npm init
--yes
npm install
--save-dev
truffle@5.0.0
rm
-rf
contracts
ln
--symbolic
../contracts contracts
# Delete any previous build artifacts
rm
-rf
build/
# Compile
echo
"
module.exports = {
compilers: {
solc: {
version:
\"
0.5.0
\"
,
},
},
};
"
>
truffle-config.js
npx truffle compile
# Modify the paths in the artifacts to make it look as if they were built in the root
sed
--in-place
--expression
"s/
\/
$SOLC_05_DIR
//g"
build/contracts/
*
.json
# Copy them back into the root
cd
..
cp
--recursive
"
$SOLC_05_DIR
"
/build build
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