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
37f74c7d
Commit
37f74c7d
authored
May 12, 2020
by
Francisco Giordano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
transpile contracts
parent
fd970c18
Show whitespace changes
Inline
Side-by-side
Showing
126 changed files
with
1730 additions
and
222 deletions
+1730
-222
Context.sol
contracts/GSN/Context.sol
+14
-2
GSNRecipient.sol
contracts/GSN/GSNRecipient.sol
+16
-2
GSNRecipientERC20Fee.sol
contracts/GSN/GSNRecipientERC20Fee.sol
+36
-4
GSNRecipientSignature.sol
contracts/GSN/GSNRecipientSignature.sol
+16
-2
Initializable.sol
contracts/Initializable.sol
+62
-0
AccessControl.sol
contracts/access/AccessControl.sol
+14
-1
Ownable.sol
contracts/access/Ownable.sol
+15
-2
TokenVesting.sol
contracts/drafts/TokenVesting.sol
+16
-2
ERC165.sol
contracts/introspection/ERC165.sol
+14
-2
ERC1820Implementer.sol
contracts/introspection/ERC1820Implementer.sol
+13
-1
AccessControlMock.sol
contracts/mocks/AccessControlMock.sol
+19
-1
AddressImpl.sol
contracts/mocks/AddressImpl.sol
+17
-1
ArraysImpl.sol
contracts/mocks/ArraysImpl.sol
+18
-2
ConditionalEscrowMock.sol
contracts/mocks/ConditionalEscrowMock.sol
+21
-1
ContextMock.sol
contracts/mocks/ContextMock.sol
+36
-4
CountersImpl.sol
contracts/mocks/CountersImpl.sol
+17
-1
Create2Impl.sol
contracts/mocks/Create2Impl.sol
+18
-2
ECDSAMock.sol
contracts/mocks/ECDSAMock.sol
+17
-1
ERC165InterfacesSupported.sol
contracts/mocks/ERC165/ERC165InterfacesSupported.sol
+36
-4
ERC165NotSupported.sol
contracts/mocks/ERC165/ERC165NotSupported.sol
+17
-1
ERC165CheckerMock.sol
contracts/mocks/ERC165CheckerMock.sol
+17
-1
ERC165Mock.sol
contracts/mocks/ERC165Mock.sol
+18
-1
ERC1820ImplementerMock.sol
contracts/mocks/ERC1820ImplementerMock.sol
+18
-1
ERC20BurnableMock.sol
contracts/mocks/ERC20BurnableMock.sol
+32
-3
ERC20CappedMock.sol
contracts/mocks/ERC20CappedMock.sol
+21
-4
ERC20DecimalsMock.sol
contracts/mocks/ERC20DecimalsMock.sol
+20
-2
ERC20Mock.sol
contracts/mocks/ERC20Mock.sol
+31
-3
ERC20PausableMock.sol
contracts/mocks/ERC20PausableMock.sol
+33
-3
ERC20PresetMinterPauserMock.sol
contracts/mocks/ERC20PresetMinterPauserMock.sol
+25
-2
ERC20SnapshotMock.sol
contracts/mocks/ERC20SnapshotMock.sol
+31
-2
ERC721BurnableMock.sol
contracts/mocks/ERC721BurnableMock.sol
+22
-2
ERC721GSNRecipientMock.sol
contracts/mocks/ERC721GSNRecipientMock.sol
+27
-10
ERC721Mock.sol
contracts/mocks/ERC721Mock.sol
+21
-2
ERC721PausableMock.sol
contracts/mocks/ERC721PausableMock.sol
+23
-2
ERC721PresetMinterPauserAutoIdMock.sol
contracts/mocks/ERC721PresetMinterPauserAutoIdMock.sol
+26
-2
ERC721ReceiverMock.sol
contracts/mocks/ERC721ReceiverMock.sol
+18
-2
ERC777Mock.sol
contracts/mocks/ERC777Mock.sol
+32
-2
ERC777SenderRecipientMock.sol
contracts/mocks/ERC777SenderRecipientMock.sol
+21
-2
EnumerableMapMock.sol
contracts/mocks/EnumerableMapMock.sol
+17
-1
EnumerableSetMock.sol
contracts/mocks/EnumerableSetMock.sol
+17
-1
EscrowMock.sol
contracts/mocks/EscrowMock.sol
+20
-1
EtherReceiverMock.sol
contracts/mocks/EtherReceiverMock.sol
+17
-1
GSNRecipientERC20FeeMock.sol
contracts/mocks/GSNRecipientERC20FeeMock.sol
+21
-2
GSNRecipientMock.sol
contracts/mocks/GSNRecipientMock.sol
+24
-5
GSNRecipientSignatureMock.sol
contracts/mocks/GSNRecipientSignatureMock.sol
+21
-2
MathMock.sol
contracts/mocks/MathMock.sol
+17
-1
MerkleProofWrapper.sol
contracts/mocks/MerkleProofWrapper.sol
+17
-1
OwnableMock.sol
contracts/mocks/OwnableMock.sol
+19
-1
PausableMock.sol
contracts/mocks/PausableMock.sol
+20
-2
PaymentSplitterMock.sol
contracts/mocks/PaymentSplitterMock.sol
+20
-2
PullPaymentMock.sol
contracts/mocks/PullPaymentMock.sol
+19
-2
ReentrancyAttack.sol
contracts/mocks/ReentrancyAttack.sol
+18
-1
ReentrancyMock.sol
contracts/mocks/ReentrancyMock.sol
+20
-3
RefundEscrowMock.sol
contracts/mocks/RefundEscrowMock.sol
+23
-2
SafeCastMock.sol
contracts/mocks/SafeCastMock.sol
+17
-1
SafeERC20Helper.sol
contracts/mocks/SafeERC20Helper.sol
+71
-6
SafeMathMock.sol
contracts/mocks/SafeMathMock.sol
+17
-1
SignedSafeMathMock.sol
contracts/mocks/SignedSafeMathMock.sol
+17
-1
StringsMock.sol
contracts/mocks/StringsMock.sol
+17
-1
TokenTimelockMock.sol
contracts/mocks/TokenTimelockMock.sol
+19
-2
PaymentSplitter.sol
contracts/payment/PaymentSplitter.sol
+15
-2
PullPayment.sol
contracts/payment/PullPayment.sol
+16
-4
ConditionalEscrow.sol
contracts/payment/escrow/ConditionalEscrow.sol
+16
-1
Escrow.sol
contracts/payment/escrow/Escrow.sol
+19
-1
RefundEscrow.sol
contracts/payment/escrow/RefundEscrow.sol
+18
-2
ERC20PresetMinterPauser.sol
contracts/presets/ERC20PresetMinterPauser.sol
+25
-3
ERC721PresetMinterPauserAutoId.sol
contracts/presets/ERC721PresetMinterPauserAutoId.sol
+26
-3
ERC20.sol
contracts/token/ERC20/ERC20.sol
+15
-2
ERC20Burnable.sol
contracts/token/ERC20/ERC20Burnable.sol
+14
-1
ERC20Capped.sol
contracts/token/ERC20/ERC20Capped.sol
+15
-2
ERC20Pausable.sol
contracts/token/ERC20/ERC20Pausable.sol
+15
-1
ERC20Snapshot.sol
contracts/token/ERC20/ERC20Snapshot.sol
+14
-1
TokenTimelock.sol
contracts/token/ERC20/TokenTimelock.sol
+14
-2
ERC721.sol
contracts/token/ERC721/ERC721.sol
+16
-2
ERC721Burnable.sol
contracts/token/ERC721/ERC721Burnable.sol
+15
-1
ERC721Holder.sol
contracts/token/ERC721/ERC721Holder.sol
+13
-1
ERC721Pausable.sol
contracts/token/ERC721/ERC721Pausable.sol
+16
-1
ERC777.sol
contracts/token/ERC777/ERC777.sol
+20
-3
Pausable.sol
contracts/utils/Pausable.sol
+15
-2
ReentrancyGuard.sol
contracts/utils/ReentrancyGuard.sol
+14
-2
Context.behavior.js
test/GSN/Context.behavior.js
+1
-1
Context.test.js
test/GSN/Context.test.js
+2
-2
ERC721GSNRecipientMock.test.js
test/GSN/ERC721GSNRecipientMock.test.js
+1
-1
GSNRecipient.test.js
test/GSN/GSNRecipient.test.js
+2
-2
GSNRecipientERC20Fee.test.js
test/GSN/GSNRecipientERC20Fee.test.js
+2
-2
GSNRecipientSignature.test.js
test/GSN/GSNRecipientSignature.test.js
+1
-1
AccessControl.test.js
test/access/AccessControl.test.js
+1
-1
Ownable.test.js
test/access/Ownable.test.js
+1
-1
ECDSA.test.js
test/cryptography/ECDSA.test.js
+1
-1
MerkleProof.test.js
test/cryptography/MerkleProof.test.js
+1
-1
ERC165.test.js
test/introspection/ERC165.test.js
+1
-1
ERC165Checker.test.js
test/introspection/ERC165Checker.test.js
+3
-3
ERC1820Implementer.test.js
test/introspection/ERC1820Implementer.test.js
+1
-1
Math.test.js
test/math/Math.test.js
+1
-1
SafeMath.test.js
test/math/SafeMath.test.js
+1
-1
SignedSafeMath.test.js
test/math/SignedSafeMath.test.js
+1
-1
PaymentSplitter.test.js
test/payment/PaymentSplitter.test.js
+1
-1
PullPayment.test.js
test/payment/PullPayment.test.js
+1
-1
ConditionalEscrow.test.js
test/payment/escrow/ConditionalEscrow.test.js
+1
-1
Escrow.test.js
test/payment/escrow/Escrow.test.js
+1
-1
RefundEscrow.test.js
test/payment/escrow/RefundEscrow.test.js
+1
-1
ERC20PresetMinterPauser.test.js
test/presets/ERC20PresetMinterPauser.test.js
+1
-1
ERC721PresetMinterPauserAutoId.js
test/presets/ERC721PresetMinterPauserAutoId.js
+1
-1
ERC20.test.js
test/token/ERC20/ERC20.test.js
+2
-2
ERC20Burnable.test.js
test/token/ERC20/ERC20Burnable.test.js
+1
-1
ERC20Capped.test.js
test/token/ERC20/ERC20Capped.test.js
+1
-1
ERC20Pausable.test.js
test/token/ERC20/ERC20Pausable.test.js
+1
-1
ERC20Snapshot.test.js
test/token/ERC20/ERC20Snapshot.test.js
+1
-1
SafeERC20.test.js
test/token/ERC20/SafeERC20.test.js
+4
-4
TokenTimelock.test.js
test/token/ERC20/TokenTimelock.test.js
+2
-2
ERC721.test.js
test/token/ERC721/ERC721.test.js
+2
-2
ERC721Burnable.test.js
test/token/ERC721/ERC721Burnable.test.js
+1
-1
ERC721Holder.test.js
test/token/ERC721/ERC721Holder.test.js
+2
-2
ERC721Pausable.test.js
test/token/ERC721/ERC721Pausable.test.js
+1
-1
ERC777.behavior.js
test/token/ERC777/ERC777.behavior.js
+1
-1
ERC777.test.js
test/token/ERC777/ERC777.test.js
+2
-2
Address.test.js
test/utils/Address.test.js
+2
-2
Arrays.test.js
test/utils/Arrays.test.js
+1
-1
Counters.test.js
test/utils/Counters.test.js
+1
-1
Create2.test.js
test/utils/Create2.test.js
+3
-3
EnumerableMap.test.js
test/utils/EnumerableMap.test.js
+1
-1
EnumerableSet.test.js
test/utils/EnumerableSet.test.js
+1
-1
Pausable.test.js
test/utils/Pausable.test.js
+1
-1
ReentrancyGuard.test.js
test/utils/ReentrancyGuard.test.js
+2
-2
SafeCast.test.js
test/utils/SafeCast.test.js
+1
-1
Strings.test.js
test/utils/Strings.test.js
+1
-1
No files found.
contracts/GSN/Context.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../Initializable.sol";
/*
/*
* @dev Provides information about the current execution context, including the
* @dev Provides information about the current execution context, including the
...
@@ -10,10 +11,19 @@ pragma solidity ^0.6.0;
...
@@ -10,10 +11,19 @@ pragma solidity ^0.6.0;
*
*
* This contract is only required for intermediate, library-like contracts.
* This contract is only required for intermediate, library-like contracts.
*/
*/
contract Context {
contract Context
Upgradeable is Initializable
{
// Empty internal constructor, to prevent people from mistakenly deploying
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
function __Context_init() internal initializer {
__Context_init_unchained();
}
function __Context_init_unchained() internal initializer {
}
function _msgSender() internal view virtual returns (address payable) {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
return msg.sender;
...
@@ -23,4 +33,6 @@ contract Context {
...
@@ -23,4 +33,6 @@ contract Context {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
return msg.data;
}
}
uint256[50] private __gap;
}
}
contracts/GSN/GSNRecipient.sol
View file @
37f74c7d
...
@@ -3,6 +3,7 @@ pragma solidity ^0.6.0;
...
@@ -3,6 +3,7 @@ pragma solidity ^0.6.0;
import "./IRelayRecipient.sol";
import "./IRelayRecipient.sol";
import "./IRelayHub.sol";
import "./IRelayHub.sol";
import "./Context.sol";
import "./Context.sol";
import "../Initializable.sol";
/**
/**
* @dev Base GSN recipient contract: includes the {IRelayRecipient} interface
* @dev Base GSN recipient contract: includes the {IRelayRecipient} interface
...
@@ -15,9 +16,20 @@ import "./Context.sol";
...
@@ -15,9 +16,20 @@ import "./Context.sol";
* information on how to use the pre-built {GSNRecipientSignature} and
* information on how to use the pre-built {GSNRecipientSignature} and
* {GSNRecipientERC20Fee}, or how to write your own.
* {GSNRecipientERC20Fee}, or how to write your own.
*/
*/
abstract contract GSNRecipient is IRelayRecipient, Context {
abstract contract GSNRecipientUpgradeable is Initializable, IRelayRecipient, ContextUpgradeable {
function __GSNRecipient_init() internal initializer {
__Context_init_unchained();
__GSNRecipient_init_unchained();
}
function __GSNRecipient_init_unchained() internal initializer {
_relayHub = 0xD216153c06E857cD7f72665E0aF1d7D82172F494;
}
// Default RelayHub address, deployed on mainnet and all testnets at the same address
// Default RelayHub address, deployed on mainnet and all testnets at the same address
address private _relayHub
= 0xD216153c06E857cD7f72665E0aF1d7D82172F494
;
address private _relayHub ;
uint256 constant private _RELAYED_CALL_ACCEPTED = 0;
uint256 constant private _RELAYED_CALL_ACCEPTED = 0;
uint256 constant private _RELAYED_CALL_REJECTED = 11;
uint256 constant private _RELAYED_CALL_REJECTED = 11;
...
@@ -225,4 +237,6 @@ abstract contract GSNRecipient is IRelayRecipient, Context {
...
@@ -225,4 +237,6 @@ abstract contract GSNRecipient is IRelayRecipient, Context {
return actualData;
return actualData;
}
}
uint256[49] private __gap;
}
}
contracts/GSN/GSNRecipientERC20Fee.sol
View file @
37f74c7d
...
@@ -5,6 +5,7 @@ import "../math/SafeMath.sol";
...
@@ -5,6 +5,7 @@ import "../math/SafeMath.sol";
import "../access/Ownable.sol";
import "../access/Ownable.sol";
import "../token/ERC20/SafeERC20.sol";
import "../token/ERC20/SafeERC20.sol";
import "../token/ERC20/ERC20.sol";
import "../token/ERC20/ERC20.sol";
import "../Initializable.sol";
/**
/**
* @dev A xref:ROOT:gsn-strategies.adoc#gsn-strategies[GSN strategy] that charges transaction fees in a special purpose ERC20
* @dev A xref:ROOT:gsn-strategies.adoc#gsn-strategies[GSN strategy] that charges transaction fees in a special purpose ERC20
...
@@ -15,7 +16,7 @@ import "../token/ERC20/ERC20.sol";
...
@@ -15,7 +16,7 @@ import "../token/ERC20/ERC20.sol";
* whose only minter is the recipient, so the strategy must be implemented in a derived contract, making use of the
* whose only minter is the recipient, so the strategy must be implemented in a derived contract, making use of the
* internal {_mint} function.
* internal {_mint} function.
*/
*/
contract GSNRecipientERC20Fee
is GSNRecipient
{
contract GSNRecipientERC20Fee
Upgradeable is Initializable, GSNRecipientUpgradeable
{
using SafeERC20 for __unstable__ERC20Owned;
using SafeERC20 for __unstable__ERC20Owned;
using SafeMath for uint256;
using SafeMath for uint256;
...
@@ -28,10 +29,21 @@ contract GSNRecipientERC20Fee is GSNRecipient {
...
@@ -28,10 +29,21 @@ contract GSNRecipientERC20Fee is GSNRecipient {
/**
/**
* @dev The arguments to the constructor are the details that the gas payment token will have: `name` and `symbol`. `decimals` is hard-coded to 18.
* @dev The arguments to the constructor are the details that the gas payment token will have: `name` and `symbol`. `decimals` is hard-coded to 18.
*/
*/
constructor(string memory name, string memory symbol) public {
function __GSNRecipientERC20Fee_init(string memory name, string memory symbol) internal initializer {
__Context_init_unchained();
__GSNRecipient_init_unchained();
__GSNRecipientERC20Fee_init_unchained(name, symbol);
}
function __GSNRecipientERC20Fee_init_unchained(string memory name, string memory symbol) internal initializer {
_token = new __unstable__ERC20Owned(name, symbol);
_token = new __unstable__ERC20Owned(name, symbol);
}
}
/**
/**
* @dev Returns the gas payment token.
* @dev Returns the gas payment token.
*/
*/
...
@@ -102,6 +114,8 @@ contract GSNRecipientERC20Fee is GSNRecipient {
...
@@ -102,6 +114,8 @@ contract GSNRecipientERC20Fee is GSNRecipient {
// After the relayed call has been executed and the actual charge estimated, the excess pre-charge is returned
// After the relayed call has been executed and the actual charge estimated, the excess pre-charge is returned
_token.safeTransfer(from, maxPossibleCharge.sub(actualCharge));
_token.safeTransfer(from, maxPossibleCharge.sub(actualCharge));
}
}
uint256[49] private __gap;
}
}
/**
/**
...
@@ -111,10 +125,26 @@ contract GSNRecipientERC20Fee is GSNRecipient {
...
@@ -111,10 +125,26 @@ contract GSNRecipientERC20Fee is GSNRecipient {
* outside of this context.
* outside of this context.
*/
*/
// solhint-disable-next-line contract-name-camelcase
// solhint-disable-next-line contract-name-camelcase
contract __unstable__ERC20Owned is
ERC20, Own
able {
contract __unstable__ERC20Owned is
Initializable, ERC20Upgradeable, OwnableUpgrade
able {
uint256 private constant _UINT256_MAX = 2**256 - 1;
uint256 private constant _UINT256_MAX = 2**256 - 1;
constructor(string memory name, string memory symbol) public ERC20(name, symbol) { }
constructor(string memory name, string memory symbol) public {
____unstable__ERC20Owned_init(name, symbol);
}
function ____unstable__ERC20Owned_init(string memory name, string memory symbol) internal initializer {
__Context_init_unchained();
__ERC20_init_unchained(name, symbol);
__Ownable_init_unchained();
____unstable__ERC20Owned_init_unchained(name, symbol);
}
function ____unstable__ERC20Owned_init_unchained(string memory name, string memory symbol) internal initializer {
}
// The owner (GSNRecipientERC20Fee) can mint tokens
// The owner (GSNRecipientERC20Fee) can mint tokens
function mint(address account, uint256 amount) public onlyOwner {
function mint(address account, uint256 amount) public onlyOwner {
...
@@ -147,4 +177,6 @@ contract __unstable__ERC20Owned is ERC20, Ownable {
...
@@ -147,4 +177,6 @@ contract __unstable__ERC20Owned is ERC20, Ownable {
return super.transferFrom(sender, recipient, amount);
return super.transferFrom(sender, recipient, amount);
}
}
}
}
uint256[50] private __gap;
}
}
contracts/GSN/GSNRecipientSignature.sol
View file @
37f74c7d
...
@@ -2,6 +2,7 @@ pragma solidity ^0.6.0;
...
@@ -2,6 +2,7 @@ pragma solidity ^0.6.0;
import "./GSNRecipient.sol";
import "./GSNRecipient.sol";
import "../cryptography/ECDSA.sol";
import "../cryptography/ECDSA.sol";
import "../Initializable.sol";
/**
/**
* @dev A xref:ROOT:gsn-strategies.adoc#gsn-strategies[GSN strategy] that allows relayed transactions through when they are
* @dev A xref:ROOT:gsn-strategies.adoc#gsn-strategies[GSN strategy] that allows relayed transactions through when they are
...
@@ -9,7 +10,7 @@ import "../cryptography/ECDSA.sol";
...
@@ -9,7 +10,7 @@ import "../cryptography/ECDSA.sol";
* performs validations off-chain. Note that nothing is charged to the user in this scheme. Thus, the server should make
* performs validations off-chain. Note that nothing is charged to the user in this scheme. Thus, the server should make
* sure to account for this in their economic and threat model.
* sure to account for this in their economic and threat model.
*/
*/
contract GSNRecipientSignature
is GSNRecipient
{
contract GSNRecipientSignature
Upgradeable is Initializable, GSNRecipientUpgradeable
{
using ECDSA for bytes32;
using ECDSA for bytes32;
address private _trustedSigner;
address private _trustedSigner;
...
@@ -21,11 +22,22 @@ contract GSNRecipientSignature is GSNRecipient {
...
@@ -21,11 +22,22 @@ contract GSNRecipientSignature is GSNRecipient {
/**
/**
* @dev Sets the trusted signer that is going to be producing signatures to approve relayed calls.
* @dev Sets the trusted signer that is going to be producing signatures to approve relayed calls.
*/
*/
constructor(address trustedSigner) public {
function __GSNRecipientSignature_init(address trustedSigner) internal initializer {
__Context_init_unchained();
__GSNRecipient_init_unchained();
__GSNRecipientSignature_init_unchained(trustedSigner);
}
function __GSNRecipientSignature_init_unchained(address trustedSigner) internal initializer {
require(trustedSigner != address(0), "GSNRecipientSignature: trusted signer is the zero address");
require(trustedSigner != address(0), "GSNRecipientSignature: trusted signer is the zero address");
_trustedSigner = trustedSigner;
_trustedSigner = trustedSigner;
}
}
/**
/**
* @dev Ensures that only transactions with a trusted signature can be relayed through the GSN.
* @dev Ensures that only transactions with a trusted signature can be relayed through the GSN.
*/
*/
...
@@ -67,4 +79,6 @@ contract GSNRecipientSignature is GSNRecipient {
...
@@ -67,4 +79,6 @@ contract GSNRecipientSignature is GSNRecipient {
function _preRelayedCall(bytes memory) internal virtual override returns (bytes32) { }
function _preRelayedCall(bytes memory) internal virtual override returns (bytes32) { }
function _postRelayedCall(bytes memory, bool, uint256, bytes32) internal virtual override { }
function _postRelayedCall(bytes memory, bool, uint256, bytes32) internal virtual override { }
uint256[49] private __gap;
}
}
contracts/Initializable.sol
0 → 100644
View file @
37f74c7d
pragma solidity >=0.4.24 <0.7.0;
/**
* @title Initializable
*
* @dev Helper contract to support initializer functions. To use it, replace
* the constructor with a function that has the `initializer` modifier.
* WARNING: Unlike constructors, initializer functions must be manually
* invoked. This applies both to deploying an Initializable contract, as well
* as extending an Initializable contract via inheritance.
* WARNING: When used with inheritance, manual care must be taken to not invoke
* a parent initializer twice, or ensure that all initializers are idempotent,
* because this is not dealt with automatically as with constructors.
*/
contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private initializing;
/**
* @dev Modifier to use in the initializer function of a contract.
*/
modifier initializer() {
require(initializing || isConstructor() || !initialized, "Contract instance has already been initialized");
bool isTopLevelCall = !initializing;
if (isTopLevelCall) {
initializing = true;
initialized = true;
}
_;
if (isTopLevelCall) {
initializing = false;
}
}
/// @dev Returns true if and only if the function is running in the constructor
function isConstructor() private view returns (bool) {
// extcodesize checks the size of the code stored in an address, and
// address returns the current address. Since the code is still not
// deployed when running a constructor, any checks on its code size will
// yield zero, making it an effective way to detect if a contract is
// under construction or not.
address self = address(this);
uint256 cs;
assembly { cs := extcodesize(self) }
return cs == 0;
}
// Reserved storage space to allow for layout changes in the future.
uint256[50] private ______gap;
}
contracts/access/AccessControl.sol
View file @
37f74c7d
...
@@ -3,6 +3,7 @@ pragma solidity ^0.6.0;
...
@@ -3,6 +3,7 @@ pragma solidity ^0.6.0;
import "../utils/EnumerableSet.sol";
import "../utils/EnumerableSet.sol";
import "../utils/Address.sol";
import "../utils/Address.sol";
import "../GSN/Context.sol";
import "../GSN/Context.sol";
import "../Initializable.sol";
/**
/**
* @dev Contract module that allows children to implement role-based access
* @dev Contract module that allows children to implement role-based access
...
@@ -35,7 +36,17 @@ import "../GSN/Context.sol";
...
@@ -35,7 +36,17 @@ import "../GSN/Context.sol";
* roles. More complex role relationships can be created by using
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
* {_setRoleAdmin}.
*/
*/
abstract contract AccessControl is Context {
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable {
function __AccessControl_init() internal initializer {
__Context_init_unchained();
__AccessControl_init_unchained();
}
function __AccessControl_init_unchained() internal initializer {
}
using EnumerableSet for EnumerableSet.AddressSet;
using EnumerableSet for EnumerableSet.AddressSet;
using Address for address;
using Address for address;
...
@@ -195,4 +206,6 @@ abstract contract AccessControl is Context {
...
@@ -195,4 +206,6 @@ abstract contract AccessControl is Context {
emit RoleRevoked(role, account, _msgSender());
emit RoleRevoked(role, account, _msgSender());
}
}
}
}
uint256[49] private __gap;
}
}
contracts/access/Ownable.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../GSN/Context.sol";
import "../GSN/Context.sol";
import "../Initializable.sol";
/**
/**
* @dev Contract module which provides a basic access control mechanism, where
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* there is an account (an owner) that can be granted exclusive access to
...
@@ -13,7 +14,7 @@ import "../GSN/Context.sol";
...
@@ -13,7 +14,7 @@ import "../GSN/Context.sol";
* `onlyOwner`, which can be applied to your functions to restrict their use to
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
* the owner.
*/
*/
contract Ownable
is Context
{
contract Ownable
Upgradeable is Initializable, ContextUpgradeable
{
address private _owner;
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
...
@@ -21,12 +22,22 @@ contract Ownable is Context {
...
@@ -21,12 +22,22 @@ contract Ownable is Context {
/**
/**
* @dev Initializes the contract setting the deployer as the initial owner.
* @dev Initializes the contract setting the deployer as the initial owner.
*/
*/
constructor () internal {
function __Ownable_init() internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal initializer {
address msgSender = _msgSender();
address msgSender = _msgSender();
_owner = msgSender;
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
emit OwnershipTransferred(address(0), msgSender);
}
}
/**
/**
* @dev Returns the address of the current owner.
* @dev Returns the address of the current owner.
*/
*/
...
@@ -63,4 +74,6 @@ contract Ownable is Context {
...
@@ -63,4 +74,6 @@ contract Ownable is Context {
emit OwnershipTransferred(_owner, newOwner);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
_owner = newOwner;
}
}
uint256[49] private __gap;
}
}
contracts/drafts/TokenVesting.sol
View file @
37f74c7d
...
@@ -3,6 +3,7 @@ pragma solidity ^0.6.0;
...
@@ -3,6 +3,7 @@ pragma solidity ^0.6.0;
import "../token/ERC20/SafeERC20.sol";
import "../token/ERC20/SafeERC20.sol";
import "../access/Ownable.sol";
import "../access/Ownable.sol";
import "../math/SafeMath.sol";
import "../math/SafeMath.sol";
import "../Initializable.sol";
/**
/**
* @title TokenVesting
* @title TokenVesting
...
@@ -10,7 +11,7 @@ import "../math/SafeMath.sol";
...
@@ -10,7 +11,7 @@ import "../math/SafeMath.sol";
* typical vesting scheme, with a cliff and vesting period. Optionally revocable by the
* typical vesting scheme, with a cliff and vesting period. Optionally revocable by the
* owner.
* owner.
*/
*/
contract TokenVesting
is Own
able {
contract TokenVesting
Upgradeable is Initializable, OwnableUpgrade
able {
// The vesting schedule is time-based (i.e. using block timestamps as opposed to e.g. block numbers), and is
// The vesting schedule is time-based (i.e. using block timestamps as opposed to e.g. block numbers), and is
// therefore sensitive to timestamp manipulation (which is something miners can do, to a certain degree). Therefore,
// therefore sensitive to timestamp manipulation (which is something miners can do, to a certain degree). Therefore,
// it is recommended to avoid using short time durations (less than a minute). Typical vesting schemes, with a
// it is recommended to avoid using short time durations (less than a minute). Typical vesting schemes, with a
...
@@ -46,7 +47,16 @@ contract TokenVesting is Ownable {
...
@@ -46,7 +47,16 @@ contract TokenVesting is Ownable {
* @param duration duration in seconds of the period in which the tokens will vest
* @param duration duration in seconds of the period in which the tokens will vest
* @param revocable whether the vesting is revocable or not
* @param revocable whether the vesting is revocable or not
*/
*/
constructor (address beneficiary, uint256 start, uint256 cliffDuration, uint256 duration, bool revocable) public {
function __TokenVesting_init(address beneficiary, uint256 start, uint256 cliffDuration, uint256 duration, bool revocable) internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
__TokenVesting_init_unchained(beneficiary, start, cliffDuration, duration, revocable);
}
function __TokenVesting_init_unchained(address beneficiary, uint256 start, uint256 cliffDuration, uint256 duration, bool revocable) internal initializer {
require(beneficiary != address(0), "TokenVesting: beneficiary is the zero address");
require(beneficiary != address(0), "TokenVesting: beneficiary is the zero address");
// solhint-disable-next-line max-line-length
// solhint-disable-next-line max-line-length
require(cliffDuration <= duration, "TokenVesting: cliff is longer than duration");
require(cliffDuration <= duration, "TokenVesting: cliff is longer than duration");
...
@@ -59,8 +69,10 @@ contract TokenVesting is Ownable {
...
@@ -59,8 +69,10 @@ contract TokenVesting is Ownable {
_duration = duration;
_duration = duration;
_cliff = start.add(cliffDuration);
_cliff = start.add(cliffDuration);
_start = start;
_start = start;
}
}
/**
/**
* @return the beneficiary of the tokens.
* @return the beneficiary of the tokens.
*/
*/
...
@@ -171,4 +183,6 @@ contract TokenVesting is Ownable {
...
@@ -171,4 +183,6 @@ contract TokenVesting is Ownable {
return totalBalance.mul(block.timestamp.sub(_start)).div(_duration);
return totalBalance.mul(block.timestamp.sub(_start)).div(_duration);
}
}
}
}
uint256[44] private __gap;
}
}
contracts/introspection/ERC165.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "./IERC165.sol";
import "./IERC165.sol";
import "../Initializable.sol";
/**
/**
* @dev Implementation of the {IERC165} interface.
* @dev Implementation of the {IERC165} interface.
...
@@ -8,7 +9,7 @@ import "./IERC165.sol";
...
@@ -8,7 +9,7 @@ import "./IERC165.sol";
* Contracts may inherit from this and call {_registerInterface} to declare
* Contracts may inherit from this and call {_registerInterface} to declare
* their support of an interface.
* their support of an interface.
*/
*/
contract ERC165
is
IERC165 {
contract ERC165
Upgradeable is Initializable,
IERC165 {
/*
/*
* bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
* bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
*/
*/
...
@@ -19,12 +20,21 @@ contract ERC165 is IERC165 {
...
@@ -19,12 +20,21 @@ contract ERC165 is IERC165 {
*/
*/
mapping(bytes4 => bool) private _supportedInterfaces;
mapping(bytes4 => bool) private _supportedInterfaces;
constructor () internal {
function __ERC165_init() internal initializer {
__ERC165_init_unchained();
}
function __ERC165_init_unchained() internal initializer {
// Derived contracts need only register support for their own interfaces,
// Derived contracts need only register support for their own interfaces,
// we register support for ERC165 itself here
// we register support for ERC165 itself here
_registerInterface(_INTERFACE_ID_ERC165);
_registerInterface(_INTERFACE_ID_ERC165);
}
}
/**
/**
* @dev See {IERC165-supportsInterface}.
* @dev See {IERC165-supportsInterface}.
*
*
...
@@ -49,4 +59,6 @@ contract ERC165 is IERC165 {
...
@@ -49,4 +59,6 @@ contract ERC165 is IERC165 {
require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
_supportedInterfaces[interfaceId] = true;
_supportedInterfaces[interfaceId] = true;
}
}
uint256[49] private __gap;
}
}
contracts/introspection/ERC1820Implementer.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "./IERC1820Implementer.sol";
import "./IERC1820Implementer.sol";
import "../Initializable.sol";
/**
/**
* @dev Implementation of the {IERC1820Implementer} interface.
* @dev Implementation of the {IERC1820Implementer} interface.
...
@@ -10,7 +11,16 @@ import "./IERC1820Implementer.sol";
...
@@ -10,7 +11,16 @@ import "./IERC1820Implementer.sol";
* {IERC1820Registry-setInterfaceImplementer} should then be called for the
* {IERC1820Registry-setInterfaceImplementer} should then be called for the
* registration to be complete.
* registration to be complete.
*/
*/
contract ERC1820Implementer is IERC1820Implementer {
contract ERC1820ImplementerUpgradeable is Initializable, IERC1820Implementer {
function __ERC1820Implementer_init() internal initializer {
__ERC1820Implementer_init_unchained();
}
function __ERC1820Implementer_init_unchained() internal initializer {
}
bytes32 constant private _ERC1820_ACCEPT_MAGIC = keccak256(abi.encodePacked("ERC1820_ACCEPT_MAGIC"));
bytes32 constant private _ERC1820_ACCEPT_MAGIC = keccak256(abi.encodePacked("ERC1820_ACCEPT_MAGIC"));
mapping(bytes32 => mapping(address => bool)) private _supportedInterfaces;
mapping(bytes32 => mapping(address => bool)) private _supportedInterfaces;
...
@@ -32,4 +42,6 @@ contract ERC1820Implementer is IERC1820Implementer {
...
@@ -32,4 +42,6 @@ contract ERC1820Implementer is IERC1820Implementer {
function _registerInterfaceForAddress(bytes32 interfaceHash, address account) internal virtual {
function _registerInterfaceForAddress(bytes32 interfaceHash, address account) internal virtual {
_supportedInterfaces[interfaceHash][account] = true;
_supportedInterfaces[interfaceHash][account] = true;
}
}
uint256[49] private __gap;
}
}
contracts/mocks/AccessControlMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../access/AccessControl.sol";
import "../access/AccessControl.sol";
import "../Initializable.sol";
contract AccessControlMockUpgradeable is Initializable, AccessControlUpgradeable {
contract AccessControlMock is AccessControl {
constructor() public {
constructor() public {
__AccessControlMock_init();
}
function __AccessControlMock_init() internal initializer {
__Context_init_unchained();
__AccessControl_init_unchained();
__AccessControlMock_init_unchained();
}
function __AccessControlMock_init_unchained() internal initializer {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
}
function setRoleAdmin(bytes32 roleId, bytes32 adminRoleId) public {
function setRoleAdmin(bytes32 roleId, bytes32 adminRoleId) public {
_setRoleAdmin(roleId, adminRoleId);
_setRoleAdmin(roleId, adminRoleId);
}
}
uint256[50] private __gap;
}
}
contracts/mocks/AddressImpl.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../utils/Address.sol";
import "../utils/Address.sol";
import "../Initializable.sol";
contract AddressMockUpgradeable is Initializable {
constructor() public {
__AddressMock_init();
}
function __AddressMock_init() internal initializer {
__AddressMock_init_unchained();
}
function __AddressMock_init_unchained() internal initializer {
}
contract AddressMock {
function isContract(address account) external view returns (bool) {
function isContract(address account) external view returns (bool) {
return Address.isContract(account);
return Address.isContract(account);
}
}
...
@@ -13,4 +27,6 @@ contract AddressMock {
...
@@ -13,4 +27,6 @@ contract AddressMock {
// sendValue's tests require the contract to hold Ether
// sendValue's tests require the contract to hold Ether
receive () external payable { }
receive () external payable { }
uint256[50] private __gap;
}
}
contracts/mocks/ArraysImpl.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../utils/Arrays.sol";
import "../utils/Arrays.sol";
import "../Initializable.sol";
contract ArraysMock {
contract ArraysMock
Upgradeable is Initializable
{
using Arrays for uint256[];
using Arrays for uint256[];
uint256[] private _array;
uint256[] private _array;
constructor (uint256[] memory array) public {
constructor(uint256[] memory array) public {
__ArraysMock_init(array);
}
function __ArraysMock_init(uint256[] memory array) internal initializer {
__ArraysMock_init_unchained(array);
}
function __ArraysMock_init_unchained(uint256[] memory array) internal initializer {
_array = array;
_array = array;
}
}
function findUpperBound(uint256 element) external view returns (uint256) {
function findUpperBound(uint256 element) external view returns (uint256) {
return _array.findUpperBound(element);
return _array.findUpperBound(element);
}
}
uint256[49] private __gap;
}
}
contracts/mocks/ConditionalEscrowMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../payment/escrow/ConditionalEscrow.sol";
import "../payment/escrow/ConditionalEscrow.sol";
import "../Initializable.sol";
// mock class using ConditionalEscrow
// mock class using ConditionalEscrow
contract ConditionalEscrowMock is ConditionalEscrow {
contract ConditionalEscrowMockUpgradeable is Initializable, ConditionalEscrowUpgradeable {
constructor() public {
__ConditionalEscrowMock_init();
}
function __ConditionalEscrowMock_init() internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
__Escrow_init_unchained();
__ConditionalEscrow_init_unchained();
__ConditionalEscrowMock_init_unchained();
}
function __ConditionalEscrowMock_init_unchained() internal initializer {
}
mapping(address => bool) private _allowed;
mapping(address => bool) private _allowed;
function setAllowed(address payee, bool allowed) public {
function setAllowed(address payee, bool allowed) public {
...
@@ -13,4 +31,6 @@ contract ConditionalEscrowMock is ConditionalEscrow {
...
@@ -13,4 +31,6 @@ contract ConditionalEscrowMock is ConditionalEscrow {
function withdrawalAllowed(address payee) public view override returns (bool) {
function withdrawalAllowed(address payee) public view override returns (bool) {
return _allowed[payee];
return _allowed[payee];
}
}
uint256[49] private __gap;
}
}
contracts/mocks/ContextMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../GSN/Context.sol";
import "../GSN/Context.sol";
import "../Initializable.sol";
contract ContextMockUpgradeable is Initializable, ContextUpgradeable {
constructor() public {
__ContextMock_init();
}
function __ContextMock_init() internal initializer {
__Context_init_unchained();
__ContextMock_init_unchained();
}
function __ContextMock_init_unchained() internal initializer {
}
contract ContextMock is Context {
event Sender(address sender);
event Sender(address sender);
function msgSender() public {
function msgSender() public {
...
@@ -14,14 +29,31 @@ contract ContextMock is Context {
...
@@ -14,14 +29,31 @@ contract ContextMock is Context {
function msgData(uint256 integerValue, string memory stringValue) public {
function msgData(uint256 integerValue, string memory stringValue) public {
emit Data(_msgData(), integerValue, stringValue);
emit Data(_msgData(), integerValue, stringValue);
}
}
uint256[50] private __gap;
}
}
contract ContextMockCaller {
contract ContextMockCallerUpgradeable is Initializable {
function callSender(ContextMock context) public {
constructor() public {
__ContextMockCaller_init();
}
function __ContextMockCaller_init() internal initializer {
__ContextMockCaller_init_unchained();
}
function __ContextMockCaller_init_unchained() internal initializer {
}
function callSender(ContextMockUpgradeable context) public {
context.msgSender();
context.msgSender();
}
}
function callData(ContextMock context, uint256 integerValue, string memory stringValue) public {
function callData(ContextMock
Upgradeable
context, uint256 integerValue, string memory stringValue) public {
context.msgData(integerValue, stringValue);
context.msgData(integerValue, stringValue);
}
}
uint256[50] private __gap;
}
}
contracts/mocks/CountersImpl.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../utils/Counters.sol";
import "../utils/Counters.sol";
import "../Initializable.sol";
contract CountersMockUpgradeable is Initializable {
constructor() public {
__CountersMock_init();
}
function __CountersMock_init() internal initializer {
__CountersMock_init_unchained();
}
function __CountersMock_init_unchained() internal initializer {
}
contract CountersMock {
using Counters for Counters.Counter;
using Counters for Counters.Counter;
Counters.Counter private _counter;
Counters.Counter private _counter;
...
@@ -18,4 +32,6 @@ contract CountersMock {
...
@@ -18,4 +32,6 @@ contract CountersMock {
function decrement() public {
function decrement() public {
_counter.decrement();
_counter.decrement();
}
}
uint256[49] private __gap;
}
}
contracts/mocks/Create2Impl.sol
View file @
37f74c7d
...
@@ -2,15 +2,29 @@ pragma solidity ^0.6.0;
...
@@ -2,15 +2,29 @@ pragma solidity ^0.6.0;
import "../utils/Create2.sol";
import "../utils/Create2.sol";
import "../introspection/ERC1820Implementer.sol";
import "../introspection/ERC1820Implementer.sol";
import "../Initializable.sol";
contract Create2MockUpgradeable is Initializable {
constructor() public {
__Create2Mock_init();
}
function __Create2Mock_init() internal initializer {
__Create2Mock_init_unchained();
}
function __Create2Mock_init_unchained() internal initializer {
}
contract Create2Mock {
function deploy(uint256 value, bytes32 salt, bytes memory code) public {
function deploy(uint256 value, bytes32 salt, bytes memory code) public {
Create2.deploy(value, salt, code);
Create2.deploy(value, salt, code);
}
}
function deployERC1820Implementer(uint256 value, bytes32 salt) public {
function deployERC1820Implementer(uint256 value, bytes32 salt) public {
// solhint-disable-next-line indent
// solhint-disable-next-line indent
Create2.deploy(value, salt, type(ERC1820Implementer).creationCode);
Create2.deploy(value, salt, type(ERC1820Implementer
Upgradeable
).creationCode);
}
}
function computeAddress(bytes32 salt, bytes32 codeHash) public view returns (address) {
function computeAddress(bytes32 salt, bytes32 codeHash) public view returns (address) {
...
@@ -22,4 +36,6 @@ contract Create2Mock {
...
@@ -22,4 +36,6 @@ contract Create2Mock {
}
}
receive() payable external {}
receive() payable external {}
uint256[50] private __gap;
}
}
contracts/mocks/ECDSAMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../cryptography/ECDSA.sol";
import "../cryptography/ECDSA.sol";
import "../Initializable.sol";
contract ECDSAMockUpgradeable is Initializable {
constructor() public {
__ECDSAMock_init();
}
function __ECDSAMock_init() internal initializer {
__ECDSAMock_init_unchained();
}
function __ECDSAMock_init_unchained() internal initializer {
}
contract ECDSAMock {
using ECDSA for bytes32;
using ECDSA for bytes32;
function recover(bytes32 hash, bytes memory signature) public pure returns (address) {
function recover(bytes32 hash, bytes memory signature) public pure returns (address) {
...
@@ -12,4 +26,6 @@ contract ECDSAMock {
...
@@ -12,4 +26,6 @@ contract ECDSAMock {
function toEthSignedMessageHash(bytes32 hash) public pure returns (bytes32) {
function toEthSignedMessageHash(bytes32 hash) public pure returns (bytes32) {
return hash.toEthSignedMessageHash();
return hash.toEthSignedMessageHash();
}
}
uint256[50] private __gap;
}
}
contracts/mocks/ERC165/ERC165InterfacesSupported.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../../introspection/IERC165.sol";
import "../../introspection/IERC165.sol";
import "../../Initializable.sol";
/**
/**
* https://eips.ethereum.org/EIPS/eip-214#specification
* https://eips.ethereum.org/EIPS/eip-214#specification
...
@@ -12,7 +13,7 @@ import "../../introspection/IERC165.sol";
...
@@ -12,7 +13,7 @@ import "../../introspection/IERC165.sol";
* therefore, because this contract is staticcall'd we need to not emit events (which is how solidity-coverage works)
* therefore, because this contract is staticcall'd we need to not emit events (which is how solidity-coverage works)
* solidity-coverage ignores the /mocks folder, so we duplicate its implementation here to avoid instrumenting it
* solidity-coverage ignores the /mocks folder, so we duplicate its implementation here to avoid instrumenting it
*/
*/
contract SupportsInterfaceWithLookupMock
is
IERC165 {
contract SupportsInterfaceWithLookupMock
Upgradeable is Initializable,
IERC165 {
/*
/*
* bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
* bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
*/
*/
...
@@ -27,10 +28,23 @@ contract SupportsInterfaceWithLookupMock is IERC165 {
...
@@ -27,10 +28,23 @@ contract SupportsInterfaceWithLookupMock is IERC165 {
* @dev A contract implementing SupportsInterfaceWithLookup
* @dev A contract implementing SupportsInterfaceWithLookup
* implement ERC165 itself.
* implement ERC165 itself.
*/
*/
constructor () public {
constructor() public {
__SupportsInterfaceWithLookupMock_init();
}
function __SupportsInterfaceWithLookupMock_init() internal initializer {
__SupportsInterfaceWithLookupMock_init_unchained();
}
function __SupportsInterfaceWithLookupMock_init_unchained() internal initializer {
_registerInterface(INTERFACE_ID_ERC165);
_registerInterface(INTERFACE_ID_ERC165);
}
}
/**
/**
* @dev Implement supportsInterface(bytes4) using a lookup table.
* @dev Implement supportsInterface(bytes4) using a lookup table.
*/
*/
...
@@ -45,12 +59,30 @@ contract SupportsInterfaceWithLookupMock is IERC165 {
...
@@ -45,12 +59,30 @@ contract SupportsInterfaceWithLookupMock is IERC165 {
require(interfaceId != 0xffffffff, "ERC165InterfacesSupported: invalid interface id");
require(interfaceId != 0xffffffff, "ERC165InterfacesSupported: invalid interface id");
_supportedInterfaces[interfaceId] = true;
_supportedInterfaces[interfaceId] = true;
}
}
uint256[49] private __gap;
}
}
contract ERC165InterfacesSupported is SupportsInterfaceWithLookupMock {
contract ERC165InterfacesSupportedUpgradeable is Initializable, SupportsInterfaceWithLookupMockUpgradeable {
constructor (bytes4[] memory interfaceIds) public {
constructor(bytes4[] memory interfaceIds) public {
__ERC165InterfacesSupported_init(interfaceIds);
}
function __ERC165InterfacesSupported_init(bytes4[] memory interfaceIds) internal initializer {
__SupportsInterfaceWithLookupMock_init_unchained();
__ERC165InterfacesSupported_init_unchained(interfaceIds);
}
function __ERC165InterfacesSupported_init_unchained(bytes4[] memory interfaceIds) internal initializer {
for (uint256 i = 0; i < interfaceIds.length; i++) {
for (uint256 i = 0; i < interfaceIds.length; i++) {
_registerInterface(interfaceIds[i]);
_registerInterface(interfaceIds[i]);
}
}
}
}
uint256[50] private __gap;
}
}
contracts/mocks/ERC165/ERC165NotSupported.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../../Initializable.sol";
contract ERC165NotSupported { }
contract ERC165NotSupportedUpgradeable is Initializable {
constructor() public {
__ERC165NotSupported_init();
}
function __ERC165NotSupported_init() internal initializer {
__ERC165NotSupported_init_unchained();
}
function __ERC165NotSupported_init_unchained() internal initializer {
}
uint256[50] private __gap;
}
contracts/mocks/ERC165CheckerMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../introspection/ERC165Checker.sol";
import "../introspection/ERC165Checker.sol";
import "../Initializable.sol";
contract ERC165CheckerMockUpgradeable is Initializable {
constructor() public {
__ERC165CheckerMock_init();
}
function __ERC165CheckerMock_init() internal initializer {
__ERC165CheckerMock_init_unchained();
}
function __ERC165CheckerMock_init_unchained() internal initializer {
}
contract ERC165CheckerMock {
using ERC165Checker for address;
using ERC165Checker for address;
function supportsERC165(address account) public view returns (bool) {
function supportsERC165(address account) public view returns (bool) {
...
@@ -16,4 +30,6 @@ contract ERC165CheckerMock {
...
@@ -16,4 +30,6 @@ contract ERC165CheckerMock {
function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) public view returns (bool) {
function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) public view returns (bool) {
return account.supportsAllInterfaces(interfaceIds);
return account.supportsAllInterfaces(interfaceIds);
}
}
uint256[50] private __gap;
}
}
contracts/mocks/ERC165Mock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../introspection/ERC165.sol";
import "../introspection/ERC165.sol";
import "../Initializable.sol";
contract ERC165MockUpgradeable is Initializable, ERC165Upgradeable {
constructor() public {
__ERC165Mock_init();
}
function __ERC165Mock_init() internal initializer {
__ERC165_init_unchained();
__ERC165Mock_init_unchained();
}
function __ERC165Mock_init_unchained() internal initializer {
}
contract ERC165Mock is ERC165 {
function registerInterface(bytes4 interfaceId) public {
function registerInterface(bytes4 interfaceId) public {
_registerInterface(interfaceId);
_registerInterface(interfaceId);
}
}
uint256[50] private __gap;
}
}
contracts/mocks/ERC1820ImplementerMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../introspection/ERC1820Implementer.sol";
import "../introspection/ERC1820Implementer.sol";
import "../Initializable.sol";
contract ERC1820ImplementerMockUpgradeable is Initializable, ERC1820ImplementerUpgradeable {
constructor() public {
__ERC1820ImplementerMock_init();
}
function __ERC1820ImplementerMock_init() internal initializer {
__ERC1820Implementer_init_unchained();
__ERC1820ImplementerMock_init_unchained();
}
function __ERC1820ImplementerMock_init_unchained() internal initializer {
}
contract ERC1820ImplementerMock is ERC1820Implementer {
function registerInterfaceForAddress(bytes32 interfaceHash, address account) public {
function registerInterfaceForAddress(bytes32 interfaceHash, address account) public {
_registerInterfaceForAddress(interfaceHash, account);
_registerInterfaceForAddress(interfaceHash, account);
}
}
uint256[50] private __gap;
}
}
contracts/mocks/ERC20BurnableMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../token/ERC20/ERC20Burnable.sol";
import "../token/ERC20/ERC20Burnable.sol";
import "../Initializable.sol";
contract ERC20BurnableMock is ERC20Burnable {
contract ERC20BurnableMockUpgradeable is Initializable, ERC20BurnableUpgradeable {
constructor (
constructor(
string memory name,
string memory symbol,
address initialAccount,
uint256 initialBalance
) public {
__ERC20BurnableMock_init(name, symbol, initialAccount, initialBalance);
}
function __ERC20BurnableMock_init(
string memory name,
string memory symbol,
address initialAccount,
uint256 initialBalance
) internal initializer {
__Context_init_unchained();
__ERC20_init_unchained(name, symbol);
__ERC20Burnable_init_unchained();
__ERC20BurnableMock_init_unchained(name, symbol, initialAccount, initialBalance);
}
function __ERC20BurnableMock_init_unchained(
string memory name,
string memory name,
string memory symbol,
string memory symbol,
address initialAccount,
address initialAccount,
uint256 initialBalance
uint256 initialBalance
) public ERC20(name, symbol) {
) internal initializer {
_mint(initialAccount, initialBalance);
_mint(initialAccount, initialBalance);
}
}
uint256[50] private __gap;
}
}
contracts/mocks/ERC20CappedMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../token/ERC20/ERC20Capped.sol";
import "../token/ERC20/ERC20Capped.sol";
import "../Initializable.sol";
contract ERC20CappedMockUpgradeable is Initializable, ERC20CappedUpgradeable {
constructor(string memory name, string memory symbol, uint256 cap) public {
__ERC20CappedMock_init(name, symbol, cap);
}
function __ERC20CappedMock_init(string memory name, string memory symbol, uint256 cap) internal initializer {
__Context_init_unchained();
__ERC20_init_unchained(name, symbol);
__ERC20Capped_init_unchained(cap);
__ERC20CappedMock_init_unchained(name, symbol, cap);
}
function __ERC20CappedMock_init_unchained(string memory name, string memory symbol, uint256 cap) internal initializer {
}
contract ERC20CappedMock is ERC20Capped {
constructor (string memory name, string memory symbol, uint256 cap)
public ERC20(name, symbol) ERC20Capped(cap)
{ }
function mint(address to, uint256 tokenId) public {
function mint(address to, uint256 tokenId) public {
_mint(to, tokenId);
_mint(to, tokenId);
}
}
uint256[50] private __gap;
}
}
contracts/mocks/ERC20DecimalsMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../token/ERC20/ERC20.sol";
import "../token/ERC20/ERC20.sol";
import "../Initializable.sol";
contract ERC20DecimalsMockUpgradeable is Initializable, ERC20Upgradeable {
constructor(string memory name, string memory symbol, uint8 decimals) public {
__ERC20DecimalsMock_init(name, symbol, decimals);
}
function __ERC20DecimalsMock_init(string memory name, string memory symbol, uint8 decimals) internal initializer {
__Context_init_unchained();
__ERC20_init_unchained(name, symbol);
__ERC20DecimalsMock_init_unchained(name, symbol, decimals);
}
function __ERC20DecimalsMock_init_unchained(string memory name, string memory symbol, uint8 decimals) internal initializer {
contract ERC20DecimalsMock is ERC20 {
constructor (string memory name, string memory symbol, uint8 decimals) public ERC20(name, symbol) {
_setupDecimals(decimals);
_setupDecimals(decimals);
}
}
uint256[50] private __gap;
}
}
contracts/mocks/ERC20Mock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../token/ERC20/ERC20.sol";
import "../token/ERC20/ERC20.sol";
import "../Initializable.sol";
// mock class using ERC20
// mock class using ERC20
contract ERC20Mock is ERC20 {
contract ERC20MockUpgradeable is Initializable, ERC20Upgradeable {
constructor (
constructor(
string memory name,
string memory symbol,
address initialAccount,
uint256 initialBalance
) public payable {
__ERC20Mock_init(name, symbol, initialAccount, initialBalance);
}
function __ERC20Mock_init(
string memory name,
string memory symbol,
address initialAccount,
uint256 initialBalance
) internal initializer {
__Context_init_unchained();
__ERC20_init_unchained(name, symbol);
__ERC20Mock_init_unchained(name, symbol, initialAccount, initialBalance);
}
function __ERC20Mock_init_unchained(
string memory name,
string memory name,
string memory symbol,
string memory symbol,
address initialAccount,
address initialAccount,
uint256 initialBalance
uint256 initialBalance
) public payable ERC20(name, symbol) {
) internal initializer {
_mint(initialAccount, initialBalance);
_mint(initialAccount, initialBalance);
}
}
function mint(address account, uint256 amount) public {
function mint(address account, uint256 amount) public {
_mint(account, amount);
_mint(account, amount);
}
}
...
@@ -28,4 +54,6 @@ contract ERC20Mock is ERC20 {
...
@@ -28,4 +54,6 @@ contract ERC20Mock is ERC20 {
function approveInternal(address owner, address spender, uint256 value) public {
function approveInternal(address owner, address spender, uint256 value) public {
_approve(owner, spender, value);
_approve(owner, spender, value);
}
}
uint256[50] private __gap;
}
}
contracts/mocks/ERC20PausableMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../token/ERC20/ERC20Pausable.sol";
import "../token/ERC20/ERC20Pausable.sol";
import "../Initializable.sol";
// mock class using ERC20Pausable
// mock class using ERC20Pausable
contract ERC20PausableMock is ERC20Pausable {
contract ERC20PausableMockUpgradeable is Initializable, ERC20PausableUpgradeable {
constructor (
constructor(
string memory name,
string memory symbol,
address initialAccount,
uint256 initialBalance
) public {
__ERC20PausableMock_init(name, symbol, initialAccount, initialBalance);
}
function __ERC20PausableMock_init(
string memory name,
string memory symbol,
address initialAccount,
uint256 initialBalance
) internal initializer {
__Context_init_unchained();
__ERC20_init_unchained(name, symbol);
__Pausable_init_unchained();
__ERC20Pausable_init_unchained();
__ERC20PausableMock_init_unchained(name, symbol, initialAccount, initialBalance);
}
function __ERC20PausableMock_init_unchained(
string memory name,
string memory name,
string memory symbol,
string memory symbol,
address initialAccount,
address initialAccount,
uint256 initialBalance
uint256 initialBalance
) public ERC20(name, symbol) {
) internal initializer {
_mint(initialAccount, initialBalance);
_mint(initialAccount, initialBalance);
}
}
function pause() external {
function pause() external {
_pause();
_pause();
}
}
...
@@ -28,4 +56,6 @@ contract ERC20PausableMock is ERC20Pausable {
...
@@ -28,4 +56,6 @@ contract ERC20PausableMock is ERC20Pausable {
function burn(address from, uint256 amount) public {
function burn(address from, uint256 amount) public {
_burn(from, amount);
_burn(from, amount);
}
}
uint256[50] private __gap;
}
}
contracts/mocks/ERC20PresetMinterPauserMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import '../presets/ERC20PresetMinterPauser.sol';
import '../presets/ERC20PresetMinterPauser.sol';
import "../Initializable.sol";
contract ERC20PresetMinterPauserMockUpgradeable is Initializable, ERC20PresetMinterPauserUpgradeable {
constructor(string memory name, string memory symbol) public payable {
__ERC20PresetMinterPauserMock_init(name, symbol);
}
function __ERC20PresetMinterPauserMock_init(string memory name, string memory symbol) internal initializer {
__Context_init_unchained();
__AccessControl_init_unchained();
__ERC20_init_unchained(name, symbol);
__ERC20Burnable_init_unchained();
__Pausable_init_unchained();
__ERC20Pausable_init_unchained();
__ERC20PresetMinterPauser_init_unchained(name, symbol);
__ERC20PresetMinterPauserMock_init_unchained(name, symbol);
}
function __ERC20PresetMinterPauserMock_init_unchained(string memory name, string memory symbol) internal initializer {
contract ERC20PresetMinterPauserMock is ERC20PresetMinterPauser {
constructor (string memory name, string memory symbol) public payable ERC20PresetMinterPauser(name, symbol) {
}
}
uint256[50] private __gap;
}
}
contracts/mocks/ERC20SnapshotMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../token/ERC20/ERC20Snapshot.sol";
import "../token/ERC20/ERC20Snapshot.sol";
import "../Initializable.sol";
contract ERC20SnapshotMock is ERC20Snapshot {
contract ERC20SnapshotMockUpgradeable is Initializable, ERC20SnapshotUpgradeable {
constructor(
constructor(
string memory name,
string memory name,
string memory symbol,
string memory symbol,
address initialAccount,
address initialAccount,
uint256 initialBalance
uint256 initialBalance
) public ERC20(name, symbol) {
) public {
__ERC20SnapshotMock_init(name, symbol, initialAccount, initialBalance);
}
function __ERC20SnapshotMock_init(
string memory name,
string memory symbol,
address initialAccount,
uint256 initialBalance
) internal initializer {
__Context_init_unchained();
__ERC20_init_unchained(name, symbol);
__ERC20Snapshot_init_unchained();
__ERC20SnapshotMock_init_unchained(name, symbol, initialAccount, initialBalance);
}
function __ERC20SnapshotMock_init_unchained(
string memory name,
string memory symbol,
address initialAccount,
uint256 initialBalance
) internal initializer {
_mint(initialAccount, initialBalance);
_mint(initialAccount, initialBalance);
}
}
function snapshot() public {
function snapshot() public {
_snapshot();
_snapshot();
}
}
...
@@ -24,4 +51,6 @@ contract ERC20SnapshotMock is ERC20Snapshot {
...
@@ -24,4 +51,6 @@ contract ERC20SnapshotMock is ERC20Snapshot {
function burn(address account, uint256 amount) public {
function burn(address account, uint256 amount) public {
_burn(account, amount);
_burn(account, amount);
}
}
uint256[50] private __gap;
}
}
contracts/mocks/ERC721BurnableMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../token/ERC721/ERC721Burnable.sol";
import "../token/ERC721/ERC721Burnable.sol";
import "../Initializable.sol";
contract ERC721BurnableMockUpgradeable is Initializable, ERC721BurnableUpgradeable {
constructor(string memory name, string memory symbol) public {
__ERC721BurnableMock_init(name, symbol);
}
function __ERC721BurnableMock_init(string memory name, string memory symbol) internal initializer {
__Context_init_unchained();
__ERC165_init_unchained();
__ERC721_init_unchained(name, symbol);
__ERC721Burnable_init_unchained();
__ERC721BurnableMock_init_unchained(name, symbol);
}
function __ERC721BurnableMock_init_unchained(string memory name, string memory symbol) internal initializer {
}
contract ERC721BurnableMock is ERC721Burnable {
constructor(string memory name, string memory symbol) public ERC721(name, symbol) { }
function mint(address to, uint256 tokenId) public {
function mint(address to, uint256 tokenId) public {
_mint(to, tokenId);
_mint(to, tokenId);
}
}
uint256[50] private __gap;
}
}
contracts/mocks/ERC721GSNRecipientMock.sol
View file @
37f74c7d
...
@@ -3,27 +3,44 @@ pragma solidity ^0.6.0;
...
@@ -3,27 +3,44 @@ pragma solidity ^0.6.0;
import "../token/ERC721/ERC721.sol";
import "../token/ERC721/ERC721.sol";
import "../GSN/GSNRecipient.sol";
import "../GSN/GSNRecipient.sol";
import "../GSN/GSNRecipientSignature.sol";
import "../GSN/GSNRecipientSignature.sol";
import "../Initializable.sol";
/**
/**
* @title ERC721GSNRecipientMock
* @title ERC721GSNRecipientMock
* A simple ERC721 mock that has GSN support enabled
* A simple ERC721 mock that has GSN support enabled
*/
*/
contract ERC721GSNRecipientMock is ERC721, GSNRecipient, GSNRecipientSignature {
contract ERC721GSNRecipientMockUpgradeable is Initializable, ERC721Upgradeable, GSNRecipientUpgradeable, GSNRecipientSignatureUpgradeable {
constructor(string memory name, string memory symbol, address trustedSigner)
public
constructor(string memory name, string memory symbol, address trustedSigner) public {
ERC721(name, symbol)
__ERC721GSNRecipientMock_init(name, symbol, trustedSigner);
GSNRecipientSignature(trustedSigner)
}
{ }
function __ERC721GSNRecipientMock_init(string memory name, string memory symbol, address trustedSigner) internal initializer {
__Context_init_unchained();
__ERC165_init_unchained();
__ERC721_init_unchained(name, symbol);
__GSNRecipient_init_unchained();
__GSNRecipientSignature_init_unchained(trustedSigner);
__ERC721GSNRecipientMock_init_unchained(name, symbol, trustedSigner);
}
function __ERC721GSNRecipientMock_init_unchained(string memory name, string memory symbol, address trustedSigner) internal initializer {
}
function mint(uint256 tokenId) public {
function mint(uint256 tokenId) public {
_mint(_msgSender(), tokenId);
_mint(_msgSender(), tokenId);
}
}
function _msgSender() internal view override(Context
, GSNRecipient
) returns (address payable) {
function _msgSender() internal view override(Context
Upgradeable, GSNRecipientUpgradeable
) returns (address payable) {
return GSNRecipient._msgSender();
return GSNRecipient
Upgradeable
._msgSender();
}
}
function _msgData() internal view override(Context
, GSNRecipient
) returns (bytes memory) {
function _msgData() internal view override(Context
Upgradeable, GSNRecipientUpgradeable
) returns (bytes memory) {
return GSNRecipient._msgData();
return GSNRecipient
Upgradeable
._msgData();
}
}
uint256[50] private __gap;
}
}
contracts/mocks/ERC721Mock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../token/ERC721/ERC721.sol";
import "../token/ERC721/ERC721.sol";
import "../Initializable.sol";
/**
/**
* @title ERC721Mock
* @title ERC721Mock
* This mock just provides a public safeMint, mint, and burn functions for testing purposes
* This mock just provides a public safeMint, mint, and burn functions for testing purposes
*/
*/
contract ERC721Mock is ERC721 {
contract ERC721MockUpgradeable is Initializable, ERC721Upgradeable {
constructor (string memory name, string memory symbol) public ERC721(name, symbol) { }
constructor(string memory name, string memory symbol) public {
__ERC721Mock_init(name, symbol);
}
function __ERC721Mock_init(string memory name, string memory symbol) internal initializer {
__Context_init_unchained();
__ERC165_init_unchained();
__ERC721_init_unchained(name, symbol);
__ERC721Mock_init_unchained(name, symbol);
}
function __ERC721Mock_init_unchained(string memory name, string memory symbol) internal initializer {
}
function exists(uint256 tokenId) public view returns (bool) {
function exists(uint256 tokenId) public view returns (bool) {
return _exists(tokenId);
return _exists(tokenId);
...
@@ -36,4 +53,6 @@ contract ERC721Mock is ERC721 {
...
@@ -36,4 +53,6 @@ contract ERC721Mock is ERC721 {
function burn(uint256 tokenId) public {
function burn(uint256 tokenId) public {
_burn(tokenId);
_burn(tokenId);
}
}
uint256[50] private __gap;
}
}
contracts/mocks/ERC721PausableMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../token/ERC721/ERC721Pausable.sol";
import "../token/ERC721/ERC721Pausable.sol";
import "../Initializable.sol";
/**
/**
* @title ERC721PausableMock
* @title ERC721PausableMock
* This mock just provides a public mint, burn and exists functions for testing purposes
* This mock just provides a public mint, burn and exists functions for testing purposes
*/
*/
contract ERC721PausableMock is ERC721Pausable {
contract ERC721PausableMockUpgradeable is Initializable, ERC721PausableUpgradeable {
constructor (string memory name, string memory symbol) public ERC721(name, symbol) { }
constructor(string memory name, string memory symbol) public {
__ERC721PausableMock_init(name, symbol);
}
function __ERC721PausableMock_init(string memory name, string memory symbol) internal initializer {
__Context_init_unchained();
__ERC165_init_unchained();
__ERC721_init_unchained(name, symbol);
__Pausable_init_unchained();
__ERC721Pausable_init_unchained();
__ERC721PausableMock_init_unchained(name, symbol);
}
function __ERC721PausableMock_init_unchained(string memory name, string memory symbol) internal initializer {
}
function mint(address to, uint256 tokenId) public {
function mint(address to, uint256 tokenId) public {
super._mint(to, tokenId);
super._mint(to, tokenId);
...
@@ -28,4 +47,6 @@ contract ERC721PausableMock is ERC721Pausable {
...
@@ -28,4 +47,6 @@ contract ERC721PausableMock is ERC721Pausable {
function unpause() external {
function unpause() external {
_unpause();
_unpause();
}
}
uint256[50] private __gap;
}
}
contracts/mocks/ERC721PresetMinterPauserAutoIdMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import '../presets/ERC721PresetMinterPauserAutoId.sol';
import '../presets/ERC721PresetMinterPauserAutoId.sol';
import "../Initializable.sol";
contract ERC721PresetMinterPauserAutoIdMockUpgradeable is Initializable, ERC721PresetMinterPauserAutoIdUpgradeable {
constructor(string memory name, string memory symbol, string memory baseURI) public payable {
__ERC721PresetMinterPauserAutoIdMock_init(name, symbol, baseURI);
}
function __ERC721PresetMinterPauserAutoIdMock_init(string memory name, string memory symbol, string memory baseURI) internal initializer {
__Context_init_unchained();
__AccessControl_init_unchained();
__ERC165_init_unchained();
__ERC721_init_unchained(name, symbol);
__ERC721Burnable_init_unchained();
__Pausable_init_unchained();
__ERC721Pausable_init_unchained();
__ERC721PresetMinterPauserAutoId_init_unchained(name, symbol, baseURI);
__ERC721PresetMinterPauserAutoIdMock_init_unchained(name, symbol, baseURI);
}
function __ERC721PresetMinterPauserAutoIdMock_init_unchained(string memory name, string memory symbol, string memory baseURI) internal initializer {
contract ERC721PresetMinterPauserAutoIdMock is ERC721PresetMinterPauserAutoId {
constructor (string memory name, string memory symbol, string memory baseURI) public payable ERC721PresetMinterPauserAutoId(name, symbol, baseURI) {
}
}
uint256[50] private __gap;
}
}
contracts/mocks/ERC721ReceiverMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../token/ERC721/IERC721Receiver.sol";
import "../token/ERC721/IERC721Receiver.sol";
import "../Initializable.sol";
contract ERC721ReceiverMock
is
IERC721Receiver {
contract ERC721ReceiverMock
Upgradeable is Initializable,
IERC721Receiver {
bytes4 private _retval;
bytes4 private _retval;
bool private _reverts;
bool private _reverts;
event Received(address operator, address from, uint256 tokenId, bytes data, uint256 gas);
event Received(address operator, address from, uint256 tokenId, bytes data, uint256 gas);
constructor (bytes4 retval, bool reverts) public {
constructor(bytes4 retval, bool reverts) public {
__ERC721ReceiverMock_init(retval, reverts);
}
function __ERC721ReceiverMock_init(bytes4 retval, bool reverts) internal initializer {
__ERC721ReceiverMock_init_unchained(retval, reverts);
}
function __ERC721ReceiverMock_init_unchained(bytes4 retval, bool reverts) internal initializer {
_retval = retval;
_retval = retval;
_reverts = reverts;
_reverts = reverts;
}
}
function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data)
function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data)
public override returns (bytes4)
public override returns (bytes4)
{
{
...
@@ -20,4 +34,6 @@ contract ERC721ReceiverMock is IERC721Receiver {
...
@@ -20,4 +34,6 @@ contract ERC721ReceiverMock is IERC721Receiver {
emit Received(operator, from, tokenId, data, gasleft());
emit Received(operator, from, tokenId, data, gasleft());
return _retval;
return _retval;
}
}
uint256[49] private __gap;
}
}
contracts/mocks/ERC777Mock.sol
View file @
37f74c7d
...
@@ -2,18 +2,46 @@ pragma solidity ^0.6.0;
...
@@ -2,18 +2,46 @@ pragma solidity ^0.6.0;
import "../GSN/Context.sol";
import "../GSN/Context.sol";
import "../token/ERC777/ERC777.sol";
import "../token/ERC777/ERC777.sol";
import "../Initializable.sol";
contract ERC777MockUpgradeable is Initializable, ContextUpgradeable, ERC777Upgradeable {
contract ERC777Mock is Context, ERC777 {
constructor(
constructor(
address initialHolder,
address initialHolder,
uint256 initialBalance,
uint256 initialBalance,
string memory name,
string memory name,
string memory symbol,
string memory symbol,
address[] memory defaultOperators
address[] memory defaultOperators
) public ERC777(name, symbol, defaultOperators) {
) public {
__ERC777Mock_init(initialHolder, initialBalance, name, symbol, defaultOperators);
}
function __ERC777Mock_init(
address initialHolder,
uint256 initialBalance,
string memory name,
string memory symbol,
address[] memory defaultOperators
) internal initializer {
__Context_init_unchained();
__ERC777_init_unchained(name, symbol, defaultOperators);
__ERC777Mock_init_unchained(initialHolder, initialBalance, name, symbol, defaultOperators);
}
function __ERC777Mock_init_unchained(
address initialHolder,
uint256 initialBalance,
string memory name,
string memory symbol,
address[] memory defaultOperators
) internal initializer {
_mint(initialHolder, initialBalance, "", "");
_mint(initialHolder, initialBalance, "", "");
}
}
function mintInternal (
function mintInternal (
address to,
address to,
uint256 amount,
uint256 amount,
...
@@ -22,4 +50,6 @@ contract ERC777Mock is Context, ERC777 {
...
@@ -22,4 +50,6 @@ contract ERC777Mock is Context, ERC777 {
) public {
) public {
_mint(to, amount, userData, operatorData);
_mint(to, amount, userData, operatorData);
}
}
uint256[50] private __gap;
}
}
contracts/mocks/ERC777SenderRecipientMock.sol
View file @
37f74c7d
...
@@ -6,8 +6,25 @@ import "../token/ERC777/IERC777Sender.sol";
...
@@ -6,8 +6,25 @@ import "../token/ERC777/IERC777Sender.sol";
import "../token/ERC777/IERC777Recipient.sol";
import "../token/ERC777/IERC777Recipient.sol";
import "../introspection/IERC1820Registry.sol";
import "../introspection/IERC1820Registry.sol";
import "../introspection/ERC1820Implementer.sol";
import "../introspection/ERC1820Implementer.sol";
import "../Initializable.sol";
contract ERC777SenderRecipientMockUpgradeable is Initializable, ContextUpgradeable, IERC777Sender, IERC777Recipient, ERC1820ImplementerUpgradeable {
constructor() public {
__ERC777SenderRecipientMock_init();
}
function __ERC777SenderRecipientMock_init() internal initializer {
__Context_init_unchained();
__ERC1820Implementer_init_unchained();
__ERC777SenderRecipientMock_init_unchained();
}
function __ERC777SenderRecipientMock_init_unchained() internal initializer {
_erc1820 = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);
}
contract ERC777SenderRecipientMock is Context, IERC777Sender, IERC777Recipient, ERC1820Implementer {
event TokensToSendCalled(
event TokensToSendCalled(
address operator,
address operator,
address from,
address from,
...
@@ -35,7 +52,7 @@ contract ERC777SenderRecipientMock is Context, IERC777Sender, IERC777Recipient,
...
@@ -35,7 +52,7 @@ contract ERC777SenderRecipientMock is Context, IERC777Sender, IERC777Recipient,
bool private _shouldRevertSend;
bool private _shouldRevertSend;
bool private _shouldRevertReceive;
bool private _shouldRevertReceive;
IERC1820Registry private _erc1820
= IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24)
;
IERC1820Registry private _erc1820 ;
bytes32 constant private _TOKENS_SENDER_INTERFACE_HASH = keccak256("ERC777TokensSender");
bytes32 constant private _TOKENS_SENDER_INTERFACE_HASH = keccak256("ERC777TokensSender");
bytes32 constant private _TOKENS_RECIPIENT_INTERFACE_HASH = keccak256("ERC777TokensRecipient");
bytes32 constant private _TOKENS_RECIPIENT_INTERFACE_HASH = keccak256("ERC777TokensRecipient");
...
@@ -144,5 +161,7 @@ contract ERC777SenderRecipientMock is Context, IERC777Sender, IERC777Recipient,
...
@@ -144,5 +161,7 @@ contract ERC777SenderRecipientMock is Context, IERC777Sender, IERC777Recipient,
function burn(IERC777 token, uint256 amount, bytes memory data) public {
function burn(IERC777 token, uint256 amount, bytes memory data) public {
token.burn(amount, data);
token.burn(amount, data);
}
}
uint256[49] private __gap;
}
}
contracts/mocks/EnumerableMapMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../utils/EnumerableMap.sol";
import "../utils/EnumerableMap.sol";
import "../Initializable.sol";
contract EnumerableMapMockUpgradeable is Initializable {
constructor() public {
__EnumerableMapMock_init();
}
function __EnumerableMapMock_init() internal initializer {
__EnumerableMapMock_init_unchained();
}
function __EnumerableMapMock_init_unchained() internal initializer {
}
contract EnumerableMapMock {
using EnumerableMap for EnumerableMap.UintToAddressMap;
using EnumerableMap for EnumerableMap.UintToAddressMap;
event OperationResult(bool result);
event OperationResult(bool result);
...
@@ -35,4 +49,6 @@ contract EnumerableMapMock {
...
@@ -35,4 +49,6 @@ contract EnumerableMapMock {
function get(uint256 key) public view returns (address) {
function get(uint256 key) public view returns (address) {
return _map.get(key);
return _map.get(key);
}
}
uint256[48] private __gap;
}
}
contracts/mocks/EnumerableSetMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../utils/EnumerableSet.sol";
import "../utils/EnumerableSet.sol";
import "../Initializable.sol";
contract EnumerableSetMockUpgradeable is Initializable {
constructor() public {
__EnumerableSetMock_init();
}
function __EnumerableSetMock_init() internal initializer {
__EnumerableSetMock_init_unchained();
}
function __EnumerableSetMock_init_unchained() internal initializer {
}
contract EnumerableSetMock {
using EnumerableSet for EnumerableSet.AddressSet;
using EnumerableSet for EnumerableSet.AddressSet;
event OperationResult(bool result);
event OperationResult(bool result);
...
@@ -30,4 +44,6 @@ contract EnumerableSetMock {
...
@@ -30,4 +44,6 @@ contract EnumerableSetMock {
function at(uint256 index) public view returns (address) {
function at(uint256 index) public view returns (address) {
return _set.at(index);
return _set.at(index);
}
}
uint256[48] private __gap;
}
}
contracts/mocks/EscrowMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import '../payment/escrow/Escrow.sol';
import '../payment/escrow/Escrow.sol';
import "../Initializable.sol";
contract EscrowMock is Escrow {
contract EscrowMockUpgradeable is Initializable, EscrowUpgradeable {
constructor() public {
__EscrowMock_init();
}
function __EscrowMock_init() internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
__Escrow_init_unchained();
__EscrowMock_init_unchained();
}
function __EscrowMock_init_unchained() internal initializer {
}
uint256[50] private __gap;
}
}
contracts/mocks/EtherReceiverMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../Initializable.sol";
contract EtherReceiverMockUpgradeable is Initializable {
constructor() public {
__EtherReceiverMock_init();
}
function __EtherReceiverMock_init() internal initializer {
__EtherReceiverMock_init_unchained();
}
function __EtherReceiverMock_init_unchained() internal initializer {
}
contract EtherReceiverMock {
bool private _acceptEther;
bool private _acceptEther;
function setAcceptEther(bool acceptEther) public {
function setAcceptEther(bool acceptEther) public {
...
@@ -12,4 +26,6 @@ contract EtherReceiverMock {
...
@@ -12,4 +26,6 @@ contract EtherReceiverMock {
revert();
revert();
}
}
}
}
uint256[49] private __gap;
}
}
contracts/mocks/GSNRecipientERC20FeeMock.sol
View file @
37f74c7d
...
@@ -2,9 +2,26 @@ pragma solidity ^0.6.0;
...
@@ -2,9 +2,26 @@ pragma solidity ^0.6.0;
import "../GSN/GSNRecipient.sol";
import "../GSN/GSNRecipient.sol";
import "../GSN/GSNRecipientERC20Fee.sol";
import "../GSN/GSNRecipientERC20Fee.sol";
import "../Initializable.sol";
contract GSNRecipientERC20FeeMockUpgradeable is Initializable, GSNRecipientUpgradeable, GSNRecipientERC20FeeUpgradeable {
constructor(string memory name, string memory symbol) public {
__GSNRecipientERC20FeeMock_init(name, symbol);
}
function __GSNRecipientERC20FeeMock_init(string memory name, string memory symbol) internal initializer {
__Context_init_unchained();
__GSNRecipient_init_unchained();
__GSNRecipientERC20Fee_init_unchained(name, symbol);
__GSNRecipientERC20FeeMock_init_unchained(name, symbol);
}
function __GSNRecipientERC20FeeMock_init_unchained(string memory name, string memory symbol) internal initializer {
}
contract GSNRecipientERC20FeeMock is GSNRecipient, GSNRecipientERC20Fee {
constructor(string memory name, string memory symbol) public GSNRecipientERC20Fee(name, symbol) { }
function mint(address account, uint256 amount) public {
function mint(address account, uint256 amount) public {
_mint(account, amount);
_mint(account, amount);
...
@@ -15,4 +32,6 @@ contract GSNRecipientERC20FeeMock is GSNRecipient, GSNRecipientERC20Fee {
...
@@ -15,4 +32,6 @@ contract GSNRecipientERC20FeeMock is GSNRecipient, GSNRecipientERC20Fee {
function mockFunction() public {
function mockFunction() public {
emit MockFunctionCalled(token().balanceOf(_msgSender()));
emit MockFunctionCalled(token().balanceOf(_msgSender()));
}
}
uint256[50] private __gap;
}
}
contracts/mocks/GSNRecipientMock.sol
View file @
37f74c7d
...
@@ -2,9 +2,26 @@ pragma solidity ^0.6.0;
...
@@ -2,9 +2,26 @@ pragma solidity ^0.6.0;
import "./ContextMock.sol";
import "./ContextMock.sol";
import "../GSN/GSNRecipient.sol";
import "../GSN/GSNRecipient.sol";
import "../Initializable.sol";
// By inheriting from GSNRecipient, Context's internal functions are overridden automatically
// By inheriting from GSNRecipient, Context's internal functions are overridden automatically
contract GSNRecipientMock is ContextMock, GSNRecipient {
contract GSNRecipientMockUpgradeable is Initializable, ContextMockUpgradeable, GSNRecipientUpgradeable {
constructor() public {
__GSNRecipientMock_init();
}
function __GSNRecipientMock_init() internal initializer {
__Context_init_unchained();
__ContextMock_init_unchained();
__GSNRecipient_init_unchained();
__GSNRecipientMock_init_unchained();
}
function __GSNRecipientMock_init_unchained() internal initializer {
}
function withdrawDeposits(uint256 amount, address payable payee) public {
function withdrawDeposits(uint256 amount, address payable payee) public {
_withdrawDeposits(amount, payee);
_withdrawDeposits(amount, payee);
}
}
...
@@ -26,11 +43,13 @@ contract GSNRecipientMock is ContextMock, GSNRecipient {
...
@@ -26,11 +43,13 @@ contract GSNRecipientMock is ContextMock, GSNRecipient {
return _upgradeRelayHub(newRelayHub);
return _upgradeRelayHub(newRelayHub);
}
}
function _msgSender() internal override(Context
, GSNRecipient
) view virtual returns (address payable) {
function _msgSender() internal override(Context
Upgradeable, GSNRecipientUpgradeable
) view virtual returns (address payable) {
return GSNRecipient._msgSender();
return GSNRecipient
Upgradeable
._msgSender();
}
}
function _msgData() internal override(Context
, GSNRecipient
) view virtual returns (bytes memory) {
function _msgData() internal override(Context
Upgradeable, GSNRecipientUpgradeable
) view virtual returns (bytes memory) {
return GSNRecipient._msgData();
return GSNRecipient
Upgradeable
._msgData();
}
}
uint256[50] private __gap;
}
}
contracts/mocks/GSNRecipientSignatureMock.sol
View file @
37f74c7d
...
@@ -2,13 +2,32 @@ pragma solidity ^0.6.0;
...
@@ -2,13 +2,32 @@ pragma solidity ^0.6.0;
import "../GSN/GSNRecipient.sol";
import "../GSN/GSNRecipient.sol";
import "../GSN/GSNRecipientSignature.sol";
import "../GSN/GSNRecipientSignature.sol";
import "../Initializable.sol";
contract GSNRecipientSignatureMockUpgradeable is Initializable, GSNRecipientUpgradeable, GSNRecipientSignatureUpgradeable {
constructor(address trustedSigner) public {
__GSNRecipientSignatureMock_init(trustedSigner);
}
function __GSNRecipientSignatureMock_init(address trustedSigner) internal initializer {
__Context_init_unchained();
__GSNRecipient_init_unchained();
__GSNRecipientSignature_init_unchained(trustedSigner);
__GSNRecipientSignatureMock_init_unchained(trustedSigner);
}
function __GSNRecipientSignatureMock_init_unchained(address trustedSigner) internal initializer {
}
contract GSNRecipientSignatureMock is GSNRecipient, GSNRecipientSignature {
constructor(address trustedSigner) public GSNRecipientSignature(trustedSigner) { }
event MockFunctionCalled();
event MockFunctionCalled();
function mockFunction() public {
function mockFunction() public {
emit MockFunctionCalled();
emit MockFunctionCalled();
}
}
uint256[50] private __gap;
}
}
contracts/mocks/MathMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../math/Math.sol";
import "../math/Math.sol";
import "../Initializable.sol";
contract MathMockUpgradeable is Initializable {
constructor() public {
__MathMock_init();
}
function __MathMock_init() internal initializer {
__MathMock_init_unchained();
}
function __MathMock_init_unchained() internal initializer {
}
contract MathMock {
function max(uint256 a, uint256 b) public pure returns (uint256) {
function max(uint256 a, uint256 b) public pure returns (uint256) {
return Math.max(a, b);
return Math.max(a, b);
}
}
...
@@ -14,4 +28,6 @@ contract MathMock {
...
@@ -14,4 +28,6 @@ contract MathMock {
function average(uint256 a, uint256 b) public pure returns (uint256) {
function average(uint256 a, uint256 b) public pure returns (uint256) {
return Math.average(a, b);
return Math.average(a, b);
}
}
uint256[50] private __gap;
}
}
contracts/mocks/MerkleProofWrapper.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import { MerkleProof } from "../cryptography/MerkleProof.sol";
import { MerkleProof } from "../cryptography/MerkleProof.sol";
import "../Initializable.sol";
contract MerkleProofWrapperUpgradeable is Initializable {
constructor() public {
__MerkleProofWrapper_init();
}
function __MerkleProofWrapper_init() internal initializer {
__MerkleProofWrapper_init_unchained();
}
function __MerkleProofWrapper_init_unchained() internal initializer {
}
contract MerkleProofWrapper {
function verify(bytes32[] memory 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);
return MerkleProof.verify(proof, root, leaf);
}
}
uint256[50] private __gap;
}
}
contracts/mocks/OwnableMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../access/Ownable.sol";
import "../access/Ownable.sol";
import "../Initializable.sol";
contract OwnableMock is Ownable { }
contract OwnableMockUpgradeable is Initializable, OwnableUpgradeable {
constructor() public {
__OwnableMock_init();
}
function __OwnableMock_init() internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
__OwnableMock_init_unchained();
}
function __OwnableMock_init_unchained() internal initializer {
}
uint256[50] private __gap;
}
contracts/mocks/PausableMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../utils/Pausable.sol";
import "../utils/Pausable.sol";
import "../Initializable.sol";
contract PausableMock
is Paus
able {
contract PausableMock
Upgradeable is Initializable, PausableUpgrade
able {
bool public drasticMeasureTaken;
bool public drasticMeasureTaken;
uint256 public count;
uint256 public count;
constructor () public {
constructor() public {
__PausableMock_init();
}
function __PausableMock_init() internal initializer {
__Context_init_unchained();
__Pausable_init_unchained();
__PausableMock_init_unchained();
}
function __PausableMock_init_unchained() internal initializer {
drasticMeasureTaken = false;
drasticMeasureTaken = false;
count = 0;
count = 0;
}
}
function normalProcess() external whenNotPaused {
function normalProcess() external whenNotPaused {
count++;
count++;
}
}
...
@@ -26,4 +42,6 @@ contract PausableMock is Pausable {
...
@@ -26,4 +42,6 @@ contract PausableMock is Pausable {
function unpause() external {
function unpause() external {
_unpause();
_unpause();
}
}
uint256[48] private __gap;
}
}
contracts/mocks/PaymentSplitterMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import '../payment/PaymentSplitter.sol';
import '../payment/PaymentSplitter.sol';
import "../Initializable.sol";
contract PaymentSplitterMockUpgradeable is Initializable, PaymentSplitterUpgradeable {
constructor(address[] memory payees, uint256[] memory shares) public payable {
__PaymentSplitterMock_init(payees, shares);
}
function __PaymentSplitterMock_init(address[] memory payees, uint256[] memory shares) internal initializer {
__Context_init_unchained();
__PaymentSplitter_init_unchained(payees, shares);
__PaymentSplitterMock_init_unchained(payees, shares);
}
function __PaymentSplitterMock_init_unchained(address[] memory payees, uint256[] memory shares) internal initializer {
contract PaymentSplitterMock is PaymentSplitter {
constructor (address[] memory payees, uint256[] memory shares) public payable PaymentSplitter(payees, shares) {
}
}
uint256[50] private __gap;
}
}
contracts/mocks/PullPaymentMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../payment/PullPayment.sol";
import "../payment/PullPayment.sol";
import "../Initializable.sol";
// mock class using PullPayment
// mock class using PullPayment
contract PullPaymentMock is PullPayment {
contract PullPaymentMockUpgradeable is Initializable, PullPaymentUpgradeable {
constructor () public payable { }
constructor() public payable {
__PullPaymentMock_init();
}
function __PullPaymentMock_init() internal initializer {
__PullPayment_init_unchained();
__PullPaymentMock_init_unchained();
}
function __PullPaymentMock_init_unchained() internal initializer {
}
// test helper function to call asyncTransfer
// test helper function to call asyncTransfer
function callTransfer(address dest, uint256 amount) public {
function callTransfer(address dest, uint256 amount) public {
_asyncTransfer(dest, amount);
_asyncTransfer(dest, amount);
}
}
uint256[50] private __gap;
}
}
contracts/mocks/ReentrancyAttack.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../GSN/Context.sol";
import "../GSN/Context.sol";
contract ReentrancyAttack is Context {
import "../Initializable.sol";
contract ReentrancyAttackUpgradeable is Initializable, ContextUpgradeable {
constructor() public {
__ReentrancyAttack_init();
}
function __ReentrancyAttack_init() internal initializer {
__Context_init_unchained();
__ReentrancyAttack_init_unchained();
}
function __ReentrancyAttack_init_unchained() internal initializer {
}
function callSender(bytes4 data) public {
function callSender(bytes4 data) public {
// solhint-disable-next-line avoid-low-level-calls
// solhint-disable-next-line avoid-low-level-calls
(bool success,) = _msgSender().call(abi.encodeWithSelector(data));
(bool success,) = _msgSender().call(abi.encodeWithSelector(data));
require(success, "ReentrancyAttack: failed call");
require(success, "ReentrancyAttack: failed call");
}
}
uint256[50] private __gap;
}
}
contracts/mocks/ReentrancyMock.sol
View file @
37f74c7d
...
@@ -2,14 +2,29 @@ pragma solidity ^0.6.0;
...
@@ -2,14 +2,29 @@ pragma solidity ^0.6.0;
import "../utils/ReentrancyGuard.sol";
import "../utils/ReentrancyGuard.sol";
import "./ReentrancyAttack.sol";
import "./ReentrancyAttack.sol";
import "../Initializable.sol";
contract ReentrancyMock
is ReentrancyGuard
{
contract ReentrancyMock
Upgradeable is Initializable, ReentrancyGuardUpgradeable
{
uint256 public counter;
uint256 public counter;
constructor () public {
constructor() public {
__ReentrancyMock_init();
}
function __ReentrancyMock_init() internal initializer {
__ReentrancyGuard_init_unchained();
__ReentrancyMock_init_unchained();
}
function __ReentrancyMock_init_unchained() internal initializer {
counter = 0;
counter = 0;
}
}
function callback() external nonReentrant {
function callback() external nonReentrant {
_count();
_count();
}
}
...
@@ -30,7 +45,7 @@ contract ReentrancyMock is ReentrancyGuard {
...
@@ -30,7 +45,7 @@ contract ReentrancyMock is ReentrancyGuard {
}
}
}
}
function countAndCall(ReentrancyAttack attacker) public nonReentrant {
function countAndCall(ReentrancyAttack
Upgradeable
attacker) public nonReentrant {
_count();
_count();
bytes4 func = bytes4(keccak256("callback()"));
bytes4 func = bytes4(keccak256("callback()"));
attacker.callSender(func);
attacker.callSender(func);
...
@@ -39,4 +54,6 @@ contract ReentrancyMock is ReentrancyGuard {
...
@@ -39,4 +54,6 @@ contract ReentrancyMock is ReentrancyGuard {
function _count() private {
function _count() private {
counter += 1;
counter += 1;
}
}
uint256[49] private __gap;
}
}
contracts/mocks/RefundEscrowMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import '../payment/escrow/RefundEscrow.sol';
import '../payment/escrow/RefundEscrow.sol';
import "../Initializable.sol";
contract RefundEscrowMockUpgradeable is Initializable, RefundEscrowUpgradeable {
constructor(address payable beneficiary) public payable {
__RefundEscrowMock_init(beneficiary);
}
function __RefundEscrowMock_init(address payable beneficiary) internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
__Escrow_init_unchained();
__ConditionalEscrow_init_unchained();
__RefundEscrow_init_unchained(beneficiary);
__RefundEscrowMock_init_unchained(beneficiary);
}
function __RefundEscrowMock_init_unchained(address payable beneficiary) internal initializer {
contract RefundEscrowMock is RefundEscrow {
constructor (address payable beneficiary) public payable RefundEscrow(beneficiary) {
}
}
uint256[50] private __gap;
}
}
contracts/mocks/SafeCastMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../utils/SafeCast.sol";
import "../utils/SafeCast.sol";
import "../Initializable.sol";
contract SafeCastMockUpgradeable is Initializable {
constructor() public {
__SafeCastMock_init();
}
function __SafeCastMock_init() internal initializer {
__SafeCastMock_init_unchained();
}
function __SafeCastMock_init_unchained() internal initializer {
}
contract SafeCastMock {
using SafeCast for uint;
using SafeCast for uint;
using SafeCast for int;
using SafeCast for int;
...
@@ -33,4 +47,6 @@ contract SafeCastMock {
...
@@ -33,4 +47,6 @@ contract SafeCastMock {
function toUint8(uint a) public pure returns (uint8) {
function toUint8(uint a) public pure returns (uint8) {
return a.toUint8();
return a.toUint8();
}
}
uint256[50] private __gap;
}
}
contracts/mocks/SafeERC20Helper.sol
View file @
37f74c7d
...
@@ -3,8 +3,23 @@ pragma solidity ^0.6.0;
...
@@ -3,8 +3,23 @@ pragma solidity ^0.6.0;
import "../GSN/Context.sol";
import "../GSN/Context.sol";
import "../token/ERC20/IERC20.sol";
import "../token/ERC20/IERC20.sol";
import "../token/ERC20/SafeERC20.sol";
import "../token/ERC20/SafeERC20.sol";
import "../Initializable.sol";
contract ERC20ReturnFalseMockUpgradeable is Initializable, ContextUpgradeable {
constructor() public {
__ERC20ReturnFalseMock_init();
}
function __ERC20ReturnFalseMock_init() internal initializer {
__Context_init_unchained();
__ERC20ReturnFalseMock_init_unchained();
}
function __ERC20ReturnFalseMock_init_unchained() internal initializer {
}
contract ERC20ReturnFalseMock is Context {
uint256 private _allowance;
uint256 private _allowance;
// IERC20's functions are not pure, but these mock implementations are: to prevent Solidity from issuing warnings,
// IERC20's functions are not pure, but these mock implementations are: to prevent Solidity from issuing warnings,
...
@@ -30,9 +45,25 @@ contract ERC20ReturnFalseMock is Context {
...
@@ -30,9 +45,25 @@ contract ERC20ReturnFalseMock is Context {
require(_dummy == 0); // Duummy read from a state variable so that the function is view
require(_dummy == 0); // Duummy read from a state variable so that the function is view
return 0;
return 0;
}
}
uint256[48] private __gap;
}
}
contract ERC20ReturnTrueMock is Context {
contract ERC20ReturnTrueMockUpgradeable is Initializable, ContextUpgradeable {
constructor() public {
__ERC20ReturnTrueMock_init();
}
function __ERC20ReturnTrueMock_init() internal initializer {
__Context_init_unchained();
__ERC20ReturnTrueMock_init_unchained();
}
function __ERC20ReturnTrueMock_init_unchained() internal initializer {
}
mapping (address => uint256) private _allowances;
mapping (address => uint256) private _allowances;
// IERC20's functions are not pure, but these mock implementations are: to prevent Solidity from issuing warnings,
// IERC20's functions are not pure, but these mock implementations are: to prevent Solidity from issuing warnings,
...
@@ -61,9 +92,25 @@ contract ERC20ReturnTrueMock is Context {
...
@@ -61,9 +92,25 @@ contract ERC20ReturnTrueMock is Context {
function allowance(address owner, address) public view returns (uint256) {
function allowance(address owner, address) public view returns (uint256) {
return _allowances[owner];
return _allowances[owner];
}
}
uint256[48] private __gap;
}
}
contract ERC20NoReturnMock is Context {
contract ERC20NoReturnMockUpgradeable is Initializable, ContextUpgradeable {
constructor() public {
__ERC20NoReturnMock_init();
}
function __ERC20NoReturnMock_init() internal initializer {
__Context_init_unchained();
__ERC20NoReturnMock_init_unchained();
}
function __ERC20NoReturnMock_init_unchained() internal initializer {
}
mapping (address => uint256) private _allowances;
mapping (address => uint256) private _allowances;
// IERC20's functions are not pure, but these mock implementations are: to prevent Solidity from issuing warnings,
// IERC20's functions are not pure, but these mock implementations are: to prevent Solidity from issuing warnings,
...
@@ -89,17 +136,33 @@ contract ERC20NoReturnMock is Context {
...
@@ -89,17 +136,33 @@ contract ERC20NoReturnMock is Context {
function allowance(address owner, address) public view returns (uint256) {
function allowance(address owner, address) public view returns (uint256) {
return _allowances[owner];
return _allowances[owner];
}
}
uint256[48] private __gap;
}
}
contract SafeERC20Mock
is Context
{
contract SafeERC20Mock
Upgradeable is Initializable, ContextUpgradeable
{
using SafeERC20 for IERC20;
using SafeERC20 for IERC20;
IERC20 private _token;
IERC20 private _token;
constructor (IERC20 token) public {
constructor(IERC20 token) public {
__SafeERC20Mock_init(token);
}
function __SafeERC20Mock_init(IERC20 token) internal initializer {
__Context_init_unchained();
__SafeERC20Mock_init_unchained(token);
}
function __SafeERC20Mock_init_unchained(IERC20 token) internal initializer {
_token = token;
_token = token;
}
}
function transfer() public {
function transfer() public {
_token.safeTransfer(address(0), 0);
_token.safeTransfer(address(0), 0);
}
}
...
@@ -121,10 +184,12 @@ contract SafeERC20Mock is Context {
...
@@ -121,10 +184,12 @@ contract SafeERC20Mock is Context {
}
}
function setAllowance(uint256 allowance_) public {
function setAllowance(uint256 allowance_) public {
ERC20ReturnTrueMock(address(_token)).setAllowance(allowance_);
ERC20ReturnTrueMock
Upgradeable
(address(_token)).setAllowance(allowance_);
}
}
function allowance() public view returns (uint256) {
function allowance() public view returns (uint256) {
return _token.allowance(address(0), address(0));
return _token.allowance(address(0), address(0));
}
}
uint256[49] private __gap;
}
}
contracts/mocks/SafeMathMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../math/SafeMath.sol";
import "../math/SafeMath.sol";
import "../Initializable.sol";
contract SafeMathMockUpgradeable is Initializable {
constructor() public {
__SafeMathMock_init();
}
function __SafeMathMock_init() internal initializer {
__SafeMathMock_init_unchained();
}
function __SafeMathMock_init_unchained() internal initializer {
}
contract SafeMathMock {
function mul(uint256 a, uint256 b) public pure returns (uint256) {
function mul(uint256 a, uint256 b) public pure returns (uint256) {
return SafeMath.mul(a, b);
return SafeMath.mul(a, b);
}
}
...
@@ -22,4 +36,6 @@ contract SafeMathMock {
...
@@ -22,4 +36,6 @@ contract SafeMathMock {
function mod(uint256 a, uint256 b) public pure returns (uint256) {
function mod(uint256 a, uint256 b) public pure returns (uint256) {
return SafeMath.mod(a, b);
return SafeMath.mod(a, b);
}
}
uint256[50] private __gap;
}
}
contracts/mocks/SignedSafeMathMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../math/SignedSafeMath.sol";
import "../math/SignedSafeMath.sol";
import "../Initializable.sol";
contract SignedSafeMathMockUpgradeable is Initializable {
constructor() public {
__SignedSafeMathMock_init();
}
function __SignedSafeMathMock_init() internal initializer {
__SignedSafeMathMock_init_unchained();
}
function __SignedSafeMathMock_init_unchained() internal initializer {
}
contract SignedSafeMathMock {
function mul(int256 a, int256 b) public pure returns (int256) {
function mul(int256 a, int256 b) public pure returns (int256) {
return SignedSafeMath.mul(a, b);
return SignedSafeMath.mul(a, b);
}
}
...
@@ -18,4 +32,6 @@ contract SignedSafeMathMock {
...
@@ -18,4 +32,6 @@ contract SignedSafeMathMock {
function add(int256 a, int256 b) public pure returns (int256) {
function add(int256 a, int256 b) public pure returns (int256) {
return SignedSafeMath.add(a, b);
return SignedSafeMath.add(a, b);
}
}
uint256[50] private __gap;
}
}
contracts/mocks/StringsMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../utils/Strings.sol";
import "../utils/Strings.sol";
import "../Initializable.sol";
contract StringsMockUpgradeable is Initializable {
constructor() public {
__StringsMock_init();
}
function __StringsMock_init() internal initializer {
__StringsMock_init_unchained();
}
function __StringsMock_init_unchained() internal initializer {
}
contract StringsMock {
function fromUint256(uint256 value) public pure returns (string memory) {
function fromUint256(uint256 value) public pure returns (string memory) {
return Strings.toString(value);
return Strings.toString(value);
}
}
uint256[50] private __gap;
}
}
contracts/mocks/TokenTimelockMock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import '../token/ERC20/TokenTimelock.sol';
import '../token/ERC20/TokenTimelock.sol';
import "../Initializable.sol";
contract TokenTimelockMockUpgradeable is Initializable, TokenTimelockUpgradeable {
constructor(IERC20 token, address beneficiary, uint256 releaseTime) public {
__TokenTimelockMock_init(token, beneficiary, releaseTime);
}
function __TokenTimelockMock_init(IERC20 token, address beneficiary, uint256 releaseTime) internal initializer {
__TokenTimelock_init_unchained(token, beneficiary, releaseTime);
__TokenTimelockMock_init_unchained(token, beneficiary, releaseTime);
}
function __TokenTimelockMock_init_unchained(IERC20 token, address beneficiary, uint256 releaseTime) internal initializer {
contract TokenTimelockMock is TokenTimelock {
constructor (IERC20 token, address beneficiary, uint256 releaseTime) TokenTimelock(token, beneficiary, releaseTime) public {
}
}
uint256[50] private __gap;
}
}
contracts/payment/PaymentSplitter.sol
View file @
37f74c7d
...
@@ -2,6 +2,7 @@ pragma solidity ^0.6.0;
...
@@ -2,6 +2,7 @@ pragma solidity ^0.6.0;
import "../GSN/Context.sol";
import "../GSN/Context.sol";
import "../math/SafeMath.sol";
import "../math/SafeMath.sol";
import "../Initializable.sol";
/**
/**
* @title PaymentSplitter
* @title PaymentSplitter
...
@@ -16,7 +17,7 @@ import "../math/SafeMath.sol";
...
@@ -16,7 +17,7 @@ import "../math/SafeMath.sol";
* accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release}
* accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release}
* function.
* function.
*/
*/
contract PaymentSplitter
is Context
{
contract PaymentSplitter
Upgradeable is Initializable, ContextUpgradeable
{
using SafeMath for uint256;
using SafeMath for uint256;
event PayeeAdded(address account, uint256 shares);
event PayeeAdded(address account, uint256 shares);
...
@@ -37,7 +38,15 @@ contract PaymentSplitter is Context {
...
@@ -37,7 +38,15 @@ contract PaymentSplitter is Context {
* All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no
* All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no
* duplicates in `payees`.
* duplicates in `payees`.
*/
*/
constructor (address[] memory payees, uint256[] memory shares) public payable {
function __PaymentSplitter_init(address[] memory payees, uint256[] memory shares) internal initializer {
__Context_init_unchained();
__PaymentSplitter_init_unchained(payees, shares);
}
function __PaymentSplitter_init_unchained(address[] memory payees, uint256[] memory shares) internal initializer {
// solhint-disable-next-line max-line-length
// solhint-disable-next-line max-line-length
require(payees.length == shares.length, "PaymentSplitter: payees and shares length mismatch");
require(payees.length == shares.length, "PaymentSplitter: payees and shares length mismatch");
require(payees.length > 0, "PaymentSplitter: no payees");
require(payees.length > 0, "PaymentSplitter: no payees");
...
@@ -45,8 +54,10 @@ contract PaymentSplitter is Context {
...
@@ -45,8 +54,10 @@ contract PaymentSplitter is Context {
for (uint256 i = 0; i < payees.length; i++) {
for (uint256 i = 0; i < payees.length; i++) {
_addPayee(payees[i], shares[i]);
_addPayee(payees[i], shares[i]);
}
}
}
}
/**
/**
* @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully
* @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully
* reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the
* reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the
...
@@ -129,4 +140,6 @@ contract PaymentSplitter is Context {
...
@@ -129,4 +140,6 @@ contract PaymentSplitter is Context {
_totalShares = _totalShares.add(shares_);
_totalShares = _totalShares.add(shares_);
emit PayeeAdded(account, shares_);
emit PayeeAdded(account, shares_);
}
}
uint256[45] private __gap;
}
}
contracts/payment/PullPayment.sol
View file @
37f74c7d
pragma solidity ^0.6.2;
pragma solidity ^0.6.2;
import "./escrow/Escrow.sol";
import "./escrow/Escrow.sol";
import "../Initializable.sol";
/**
/**
* @dev Simple implementation of a
* @dev Simple implementation of a
...
@@ -20,13 +21,22 @@ import "./escrow/Escrow.sol";
...
@@ -20,13 +21,22 @@ import "./escrow/Escrow.sol";
* instead of Solidity's `transfer` function. Payees can query their due
* instead of Solidity's `transfer` function. Payees can query their due
* payments with {payments}, and retrieve them with {withdrawPayments}.
* payments with {payments}, and retrieve them with {withdrawPayments}.
*/
*/
contract PullPayment {
contract PullPayment
Upgradeable is Initializable
{
Escrow private _escrow;
Escrow
Upgradeable
private _escrow;
constructor () internal {
_escrow = new Escrow();
function __PullPayment_init() internal initializer {
__PullPayment_init_unchained();
}
}
function __PullPayment_init_unchained() internal initializer {
_escrow = new EscrowUpgradeable();
_escrow.initialize();
}
/**
/**
* @dev Withdraw accumulated payments, forwarding all gas to the recipient.
* @dev Withdraw accumulated payments, forwarding all gas to the recipient.
*
*
...
@@ -68,4 +78,6 @@ contract PullPayment {
...
@@ -68,4 +78,6 @@ contract PullPayment {
// https://github.com/protofire/solhint/issues/170 is fixed
// https://github.com/protofire/solhint/issues/170 is fixed
_escrow.deposit{ value: amount }(dest);
_escrow.deposit{ value: amount }(dest);
}
}
uint256[49] private __gap;
}
}
contracts/payment/escrow/ConditionalEscrow.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "./Escrow.sol";
import "./Escrow.sol";
import "../../Initializable.sol";
/**
/**
* @title ConditionalEscrow
* @title ConditionalEscrow
* @dev Base abstract escrow to only allow withdrawal if a condition is met.
* @dev Base abstract escrow to only allow withdrawal if a condition is met.
* @dev Intended usage: See {Escrow}. Same usage guidelines apply here.
* @dev Intended usage: See {Escrow}. Same usage guidelines apply here.
*/
*/
abstract contract ConditionalEscrow is Escrow {
abstract contract ConditionalEscrowUpgradeable is Initializable, EscrowUpgradeable {
function __ConditionalEscrow_init() internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
__Escrow_init_unchained();
__ConditionalEscrow_init_unchained();
}
function __ConditionalEscrow_init_unchained() internal initializer {
}
/**
/**
* @dev Returns whether an address is allowed to withdraw their funds. To be
* @dev Returns whether an address is allowed to withdraw their funds. To be
* implemented by derived contracts.
* implemented by derived contracts.
...
@@ -19,4 +32,6 @@ abstract contract ConditionalEscrow is Escrow {
...
@@ -19,4 +32,6 @@ abstract contract ConditionalEscrow is Escrow {
require(withdrawalAllowed(payee), "ConditionalEscrow: payee is not allowed to withdraw");
require(withdrawalAllowed(payee), "ConditionalEscrow: payee is not allowed to withdraw");
super.withdraw(payee);
super.withdraw(payee);
}
}
uint256[50] private __gap;
}
}
contracts/payment/escrow/Escrow.sol
View file @
37f74c7d
...
@@ -3,6 +3,7 @@ pragma solidity ^0.6.0;
...
@@ -3,6 +3,7 @@ pragma solidity ^0.6.0;
import "../../math/SafeMath.sol";
import "../../math/SafeMath.sol";
import "../../access/Ownable.sol";
import "../../access/Ownable.sol";
import "../../utils/Address.sol";
import "../../utils/Address.sol";
import "../../Initializable.sol";
/**
/**
* @title Escrow
* @title Escrow
...
@@ -17,7 +18,22 @@ import "../../utils/Address.sol";
...
@@ -17,7 +18,22 @@ import "../../utils/Address.sol";
* payment method should be its owner, and provide public methods redirecting
* payment method should be its owner, and provide public methods redirecting
* to the escrow's deposit and withdraw.
* to the escrow's deposit and withdraw.
*/
*/
contract Escrow is Ownable {
contract EscrowUpgradeable is Initializable, OwnableUpgradeable {
function initialize() public {
__Escrow_init();
}
function __Escrow_init() internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
__Escrow_init_unchained();
}
function __Escrow_init_unchained() internal initializer {
}
using SafeMath for uint256;
using SafeMath for uint256;
using Address for address payable;
using Address for address payable;
...
@@ -60,4 +76,6 @@ contract Escrow is Ownable {
...
@@ -60,4 +76,6 @@ contract Escrow is Ownable {
emit Withdrawn(payee, payment);
emit Withdrawn(payee, payment);
}
}
uint256[49] private __gap;
}
}
contracts/payment/escrow/RefundEscrow.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "./ConditionalEscrow.sol";
import "./ConditionalEscrow.sol";
import "../../Initializable.sol";
/**
/**
* @title RefundEscrow
* @title RefundEscrow
...
@@ -12,7 +13,7 @@ import "./ConditionalEscrow.sol";
...
@@ -12,7 +13,7 @@ import "./ConditionalEscrow.sol";
* withdrawal by the beneficiary, or refunds to the depositors. All interactions
* withdrawal by the beneficiary, or refunds to the depositors. All interactions
* with `RefundEscrow` will be made through the owner contract.
* with `RefundEscrow` will be made through the owner contract.
*/
*/
contract RefundEscrow
is ConditionalEscrow
{
contract RefundEscrow
Upgradeable is Initializable, ConditionalEscrowUpgradeable
{
enum State { Active, Refunding, Closed }
enum State { Active, Refunding, Closed }
event RefundsClosed();
event RefundsClosed();
...
@@ -25,12 +26,25 @@ contract RefundEscrow is ConditionalEscrow {
...
@@ -25,12 +26,25 @@ contract RefundEscrow is ConditionalEscrow {
* @dev Constructor.
* @dev Constructor.
* @param beneficiary The beneficiary of the deposits.
* @param beneficiary The beneficiary of the deposits.
*/
*/
constructor (address payable beneficiary) public {
function __RefundEscrow_init(address payable beneficiary) internal initializer {
__Context_init_unchained();
__Ownable_init_unchained();
__Escrow_init_unchained();
__ConditionalEscrow_init_unchained();
__RefundEscrow_init_unchained(beneficiary);
}
function __RefundEscrow_init_unchained(address payable beneficiary) internal initializer {
require(beneficiary != address(0), "RefundEscrow: beneficiary is the zero address");
require(beneficiary != address(0), "RefundEscrow: beneficiary is the zero address");
_beneficiary = beneficiary;
_beneficiary = beneficiary;
_state = State.Active;
_state = State.Active;
}
}
/**
/**
* @return The current state of the escrow.
* @return The current state of the escrow.
*/
*/
...
@@ -88,4 +102,6 @@ contract RefundEscrow is ConditionalEscrow {
...
@@ -88,4 +102,6 @@ contract RefundEscrow is ConditionalEscrow {
function withdrawalAllowed(address) public view override returns (bool) {
function withdrawalAllowed(address) public view override returns (bool) {
return _state == State.Refunding;
return _state == State.Refunding;
}
}
uint256[49] private __gap;
}
}
contracts/presets/ERC20PresetMinterPauser.sol
View file @
37f74c7d
...
@@ -5,6 +5,7 @@ import "../GSN/Context.sol";
...
@@ -5,6 +5,7 @@ import "../GSN/Context.sol";
import "../token/ERC20/ERC20.sol";
import "../token/ERC20/ERC20.sol";
import "../token/ERC20/ERC20Burnable.sol";
import "../token/ERC20/ERC20Burnable.sol";
import "../token/ERC20/ERC20Pausable.sol";
import "../token/ERC20/ERC20Pausable.sol";
import "../Initializable.sol";
/**
/**
* @dev {ERC20} token, including:
* @dev {ERC20} token, including:
...
@@ -20,7 +21,7 @@ import "../token/ERC20/ERC20Pausable.sol";
...
@@ -20,7 +21,7 @@ import "../token/ERC20/ERC20Pausable.sol";
* roles, as well as the default admin role, which will let it grant both minter
* roles, as well as the default admin role, which will let it grant both minter
* and pauser roles to aother accounts
* and pauser roles to aother accounts
*/
*/
contract ERC20PresetMinterPauser
is Context, AccessControl, ERC20Burnable, ERC20Paus
able {
contract ERC20PresetMinterPauser
Upgradeable is Initializable, ContextUpgradeable, AccessControlUpgradeable, ERC20BurnableUpgradeable, ERC20PausableUpgrade
able {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
...
@@ -30,13 +31,32 @@ contract ERC20PresetMinterPauser is Context, AccessControl, ERC20Burnable, ERC20
...
@@ -30,13 +31,32 @@ contract ERC20PresetMinterPauser is Context, AccessControl, ERC20Burnable, ERC20
*
*
* See {ERC20-constructor}.
* See {ERC20-constructor}.
*/
*/
constructor(string memory name, string memory symbol) public ERC20(name, symbol) {
function initialize(string memory name, string memory symbol) public {
__ERC20PresetMinterPauser_init(name, symbol);
}
function __ERC20PresetMinterPauser_init(string memory name, string memory symbol) internal initializer {
__Context_init_unchained();
__AccessControl_init_unchained();
__ERC20_init_unchained(name, symbol);
__ERC20Burnable_init_unchained();
__Pausable_init_unchained();
__ERC20Pausable_init_unchained();
__ERC20PresetMinterPauser_init_unchained(name, symbol);
}
function __ERC20PresetMinterPauser_init_unchained(string memory name, string memory symbol) internal initializer {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
}
}
/**
/**
* @dev Creates `amount` new tokens for `to`.
* @dev Creates `amount` new tokens for `to`.
*
*
...
@@ -79,7 +99,9 @@ contract ERC20PresetMinterPauser is Context, AccessControl, ERC20Burnable, ERC20
...
@@ -79,7 +99,9 @@ contract ERC20PresetMinterPauser is Context, AccessControl, ERC20Burnable, ERC20
_unpause();
_unpause();
}
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal override(ERC20
, ERC20Paus
able) {
function _beforeTokenTransfer(address from, address to, uint256 amount) internal override(ERC20
Upgradeable, ERC20PausableUpgrade
able) {
super._beforeTokenTransfer(from, to, amount);
super._beforeTokenTransfer(from, to, amount);
}
}
uint256[50] private __gap;
}
}
contracts/presets/ERC721PresetMinterPauserAutoId.sol
View file @
37f74c7d
...
@@ -6,6 +6,7 @@ import "../utils/Counters.sol";
...
@@ -6,6 +6,7 @@ import "../utils/Counters.sol";
import "../token/ERC721/ERC721.sol";
import "../token/ERC721/ERC721.sol";
import "../token/ERC721/ERC721Burnable.sol";
import "../token/ERC721/ERC721Burnable.sol";
import "../token/ERC721/ERC721Pausable.sol";
import "../token/ERC721/ERC721Pausable.sol";
import "../Initializable.sol";
/**
/**
* @dev {ERC721} token, including:
* @dev {ERC721} token, including:
...
@@ -22,7 +23,7 @@ import "../token/ERC721/ERC721Pausable.sol";
...
@@ -22,7 +23,7 @@ import "../token/ERC721/ERC721Pausable.sol";
* roles, as well as the default admin role, which will let it grant both minter
* roles, as well as the default admin role, which will let it grant both minter
* and pauser roles to aother accounts
* and pauser roles to aother accounts
*/
*/
contract ERC721PresetMinterPauserAutoId
is Context, AccessControl, ERC721Burnable, ERC721Paus
able {
contract ERC721PresetMinterPauserAutoId
Upgradeable is Initializable, ContextUpgradeable, AccessControlUpgradeable, ERC721BurnableUpgradeable, ERC721PausableUpgrade
able {
using Counters for Counters.Counter;
using Counters for Counters.Counter;
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
...
@@ -37,15 +38,35 @@ contract ERC721PresetMinterPauserAutoId is Context, AccessControl, ERC721Burnabl
...
@@ -37,15 +38,35 @@ contract ERC721PresetMinterPauserAutoId is Context, AccessControl, ERC721Burnabl
* Token URIs will be autogenerated based on `baseURI` and their token IDs.
* Token URIs will be autogenerated based on `baseURI` and their token IDs.
* See {ERC721-tokenURI}.
* See {ERC721-tokenURI}.
*/
*/
constructor(string memory name, string memory symbol, string memory baseURI) public ERC721(name, symbol) {
function initialize(string memory name, string memory symbol, string memory baseURI) public {
__ERC721PresetMinterPauserAutoId_init(name, symbol, baseURI);
}
function __ERC721PresetMinterPauserAutoId_init(string memory name, string memory symbol, string memory baseURI) internal initializer {
__Context_init_unchained();
__AccessControl_init_unchained();
__ERC165_init_unchained();
__ERC721_init_unchained(name, symbol);
__ERC721Burnable_init_unchained();
__Pausable_init_unchained();
__ERC721Pausable_init_unchained();
__ERC721PresetMinterPauserAutoId_init_unchained(name, symbol, baseURI);
}
function __ERC721PresetMinterPauserAutoId_init_unchained(string memory name, string memory symbol, string memory baseURI) internal initializer {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
_setBaseURI(baseURI);
_setBaseURI(baseURI);
}
}
/**
/**
* @dev Creates a new token for `to`. Its token ID will be automatically
* @dev Creates a new token for `to`. Its token ID will be automatically
* assigned (and available on the emitted {Transfer} event), and the token
* assigned (and available on the emitted {Transfer} event), and the token
...
@@ -94,7 +115,9 @@ contract ERC721PresetMinterPauserAutoId is Context, AccessControl, ERC721Burnabl
...
@@ -94,7 +115,9 @@ contract ERC721PresetMinterPauserAutoId is Context, AccessControl, ERC721Burnabl
_unpause();
_unpause();
}
}
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override(ERC721
, ERC721Paus
able) {
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override(ERC721
Upgradeable, ERC721PausableUpgrade
able) {
super._beforeTokenTransfer(from, to, tokenId);
super._beforeTokenTransfer(from, to, tokenId);
}
}
uint256[49] private __gap;
}
}
contracts/token/ERC20/ERC20.sol
View file @
37f74c7d
...
@@ -4,6 +4,7 @@ import "../../GSN/Context.sol";
...
@@ -4,6 +4,7 @@ import "../../GSN/Context.sol";
import "./IERC20.sol";
import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";
import "../../utils/Address.sol";
import "../../Initializable.sol";
/**
/**
* @dev Implementation of the {IERC20} interface.
* @dev Implementation of the {IERC20} interface.
...
@@ -29,7 +30,7 @@ import "../../utils/Address.sol";
...
@@ -29,7 +30,7 @@ import "../../utils/Address.sol";
* functions have been added to mitigate the well-known issues around setting
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
* allowances. See {IERC20-approve}.
*/
*/
contract ERC20
is Context
, IERC20 {
contract ERC20
Upgradeable is Initializable, ContextUpgradeable
, IERC20 {
using SafeMath for uint256;
using SafeMath for uint256;
using Address for address;
using Address for address;
...
@@ -52,12 +53,22 @@ contract ERC20 is Context, IERC20 {
...
@@ -52,12 +53,22 @@ contract ERC20 is Context, IERC20 {
* All three of these values are immutable: they can only be set once during
* All three of these values are immutable: they can only be set once during
* construction.
* construction.
*/
*/
constructor (string memory name, string memory symbol) public {
function __ERC20_init(string memory name, string memory symbol) internal initializer {
__Context_init_unchained();
__ERC20_init_unchained(name, symbol);
}
function __ERC20_init_unchained(string memory name, string memory symbol) internal initializer {
_name = name;
_name = name;
_symbol = symbol;
_symbol = symbol;
_decimals = 18;
_decimals = 18;
}
}
/**
/**
* @dev Returns the name of the token.
* @dev Returns the name of the token.
*/
*/
...
@@ -302,4 +313,6 @@ contract ERC20 is Context, IERC20 {
...
@@ -302,4 +313,6 @@ contract ERC20 is Context, IERC20 {
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
uint256[44] private __gap;
}
}
contracts/token/ERC20/ERC20Burnable.sol
View file @
37f74c7d
...
@@ -2,13 +2,24 @@ pragma solidity ^0.6.0;
...
@@ -2,13 +2,24 @@ pragma solidity ^0.6.0;
import "../../GSN/Context.sol";
import "../../GSN/Context.sol";
import "./ERC20.sol";
import "./ERC20.sol";
import "../../Initializable.sol";
/**
/**
* @dev Extension of {ERC20} that allows token holders to destroy both their own
* @dev Extension of {ERC20} that allows token holders to destroy both their own
* tokens and those that they have an allowance for, in a way that can be
* tokens and those that they have an allowance for, in a way that can be
* recognized off-chain (via event analysis).
* recognized off-chain (via event analysis).
*/
*/
abstract contract ERC20Burnable is Context, ERC20 {
abstract contract ERC20BurnableUpgradeable is Initializable, ContextUpgradeable, ERC20Upgradeable {
function __ERC20Burnable_init() internal initializer {
__Context_init_unchained();
__ERC20Burnable_init_unchained();
}
function __ERC20Burnable_init_unchained() internal initializer {
}
/**
/**
* @dev Destroys `amount` tokens from the caller.
* @dev Destroys `amount` tokens from the caller.
*
*
...
@@ -35,4 +46,6 @@ abstract contract ERC20Burnable is Context, ERC20 {
...
@@ -35,4 +46,6 @@ abstract contract ERC20Burnable is Context, ERC20 {
_approve(account, _msgSender(), decreasedAllowance);
_approve(account, _msgSender(), decreasedAllowance);
_burn(account, amount);
_burn(account, amount);
}
}
uint256[50] private __gap;
}
}
contracts/token/ERC20/ERC20Capped.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "./ERC20.sol";
import "./ERC20.sol";
import "../../Initializable.sol";
/**
/**
* @dev Extension of {ERC20} that adds a cap to the supply of tokens.
* @dev Extension of {ERC20} that adds a cap to the supply of tokens.
*/
*/
abstract contract ERC20Capped
is ERC20
{
abstract contract ERC20Capped
Upgradeable is Initializable, ERC20Upgradeable
{
uint256 private _cap;
uint256 private _cap;
/**
/**
* @dev Sets the value of the `cap`. This value is immutable, it can only be
* @dev Sets the value of the `cap`. This value is immutable, it can only be
* set once during construction.
* set once during construction.
*/
*/
constructor (uint256 cap) public {
function __ERC20Capped_init(uint256 cap) internal initializer {
__Context_init_unchained();
__ERC20Capped_init_unchained(cap);
}
function __ERC20Capped_init_unchained(uint256 cap) internal initializer {
require(cap > 0, "ERC20Capped: cap is 0");
require(cap > 0, "ERC20Capped: cap is 0");
_cap = cap;
_cap = cap;
}
}
/**
/**
* @dev Returns the cap on the token's total supply.
* @dev Returns the cap on the token's total supply.
*/
*/
...
@@ -38,4 +49,6 @@ abstract contract ERC20Capped is ERC20 {
...
@@ -38,4 +49,6 @@ abstract contract ERC20Capped is ERC20 {
require(totalSupply().add(amount) <= _cap, "ERC20Capped: cap exceeded");
require(totalSupply().add(amount) <= _cap, "ERC20Capped: cap exceeded");
}
}
}
}
uint256[49] private __gap;
}
}
contracts/token/ERC20/ERC20Pausable.sol
View file @
37f74c7d
...
@@ -2,6 +2,7 @@ pragma solidity ^0.6.0;
...
@@ -2,6 +2,7 @@ pragma solidity ^0.6.0;
import "./ERC20.sol";
import "./ERC20.sol";
import "../../utils/Pausable.sol";
import "../../utils/Pausable.sol";
import "../../Initializable.sol";
/**
/**
* @dev ERC20 token with pausable token transfers, minting and burning.
* @dev ERC20 token with pausable token transfers, minting and burning.
...
@@ -10,7 +11,18 @@ import "../../utils/Pausable.sol";
...
@@ -10,7 +11,18 @@ import "../../utils/Pausable.sol";
* period, or having an emergency switch for freezing all token transfers in the
* period, or having an emergency switch for freezing all token transfers in the
* event of a large bug.
* event of a large bug.
*/
*/
abstract contract ERC20Pausable is ERC20, Pausable {
abstract contract ERC20PausableUpgradeable is Initializable, ERC20Upgradeable, PausableUpgradeable {
function __ERC20Pausable_init() internal initializer {
__Context_init_unchained();
__Pausable_init_unchained();
__ERC20Pausable_init_unchained();
}
function __ERC20Pausable_init_unchained() internal initializer {
}
/**
/**
* @dev See {ERC20-_beforeTokenTransfer}.
* @dev See {ERC20-_beforeTokenTransfer}.
*
*
...
@@ -23,4 +35,6 @@ abstract contract ERC20Pausable is ERC20, Pausable {
...
@@ -23,4 +35,6 @@ abstract contract ERC20Pausable is ERC20, Pausable {
require(!paused(), "ERC20Pausable: token transfer while paused");
require(!paused(), "ERC20Pausable: token transfer while paused");
}
}
uint256[50] private __gap;
}
}
contracts/token/ERC20/ERC20Snapshot.sol
View file @
37f74c7d
...
@@ -4,6 +4,7 @@ import "../../math/SafeMath.sol";
...
@@ -4,6 +4,7 @@ import "../../math/SafeMath.sol";
import "../../utils/Arrays.sol";
import "../../utils/Arrays.sol";
import "../../utils/Counters.sol";
import "../../utils/Counters.sol";
import "./ERC20.sol";
import "./ERC20.sol";
import "../../Initializable.sol";
/**
/**
* @dev This contract extends an ERC20 token with a snapshot mechanism. When a snapshot is created, the balances and
* @dev This contract extends an ERC20 token with a snapshot mechanism. When a snapshot is created, the balances and
...
@@ -29,7 +30,17 @@ import "./ERC20.sol";
...
@@ -29,7 +30,17 @@ import "./ERC20.sol";
* only significant for the first transfer that immediately follows a snapshot for a particular account. Subsequent
* only significant for the first transfer that immediately follows a snapshot for a particular account. Subsequent
* transfers will have normal cost until the next snapshot, and so on.
* transfers will have normal cost until the next snapshot, and so on.
*/
*/
abstract contract ERC20Snapshot is ERC20 {
abstract contract ERC20SnapshotUpgradeable is Initializable, ERC20Upgradeable {
function __ERC20Snapshot_init() internal initializer {
__Context_init_unchained();
__ERC20Snapshot_init_unchained();
}
function __ERC20Snapshot_init_unchained() internal initializer {
}
// Inspired by Jordi Baylina's MiniMeToken to record historical balances:
// Inspired by Jordi Baylina's MiniMeToken to record historical balances:
// https://github.com/Giveth/minimd/blob/ea04d950eea153a04c51fa510b068b9dded390cb/contracts/MiniMeToken.sol
// https://github.com/Giveth/minimd/blob/ea04d950eea153a04c51fa510b068b9dded390cb/contracts/MiniMeToken.sol
...
@@ -179,4 +190,6 @@ abstract contract ERC20Snapshot is ERC20 {
...
@@ -179,4 +190,6 @@ abstract contract ERC20Snapshot is ERC20 {
return ids[ids.length - 1];
return ids[ids.length - 1];
}
}
}
}
uint256[46] private __gap;
}
}
contracts/token/ERC20/TokenTimelock.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "./SafeERC20.sol";
import "./SafeERC20.sol";
import "../../Initializable.sol";
/**
/**
* @dev A token holder contract that will allow a beneficiary to extract the
* @dev A token holder contract that will allow a beneficiary to extract the
...
@@ -11,7 +12,7 @@ import "./SafeERC20.sol";
...
@@ -11,7 +12,7 @@ import "./SafeERC20.sol";
*
*
* For a more complete vesting schedule, see {TokenVesting}.
* For a more complete vesting schedule, see {TokenVesting}.
*/
*/
contract TokenTimelock {
contract TokenTimelock
Upgradeable is Initializable
{
using SafeERC20 for IERC20;
using SafeERC20 for IERC20;
// ERC20 basic token contract being held
// ERC20 basic token contract being held
...
@@ -23,14 +24,23 @@ contract TokenTimelock {
...
@@ -23,14 +24,23 @@ contract TokenTimelock {
// timestamp when token release is enabled
// timestamp when token release is enabled
uint256 private _releaseTime;
uint256 private _releaseTime;
constructor (IERC20 token, address beneficiary, uint256 releaseTime) public {
function __TokenTimelock_init(IERC20 token, address beneficiary, uint256 releaseTime) internal initializer {
__TokenTimelock_init_unchained(token, beneficiary, releaseTime);
}
function __TokenTimelock_init_unchained(IERC20 token, address beneficiary, uint256 releaseTime) internal initializer {
// solhint-disable-next-line not-rely-on-time
// solhint-disable-next-line not-rely-on-time
require(releaseTime > block.timestamp, "TokenTimelock: release time is before current time");
require(releaseTime > block.timestamp, "TokenTimelock: release time is before current time");
_token = token;
_token = token;
_beneficiary = beneficiary;
_beneficiary = beneficiary;
_releaseTime = releaseTime;
_releaseTime = releaseTime;
}
}
/**
/**
* @return the token being held.
* @return the token being held.
*/
*/
...
@@ -64,4 +74,6 @@ contract TokenTimelock {
...
@@ -64,4 +74,6 @@ contract TokenTimelock {
_token.safeTransfer(_beneficiary, amount);
_token.safeTransfer(_beneficiary, amount);
}
}
uint256[47] private __gap;
}
}
contracts/token/ERC721/ERC721.sol
View file @
37f74c7d
...
@@ -11,12 +11,13 @@ import "../../utils/Address.sol";
...
@@ -11,12 +11,13 @@ import "../../utils/Address.sol";
import "../../utils/EnumerableSet.sol";
import "../../utils/EnumerableSet.sol";
import "../../utils/EnumerableMap.sol";
import "../../utils/EnumerableMap.sol";
import "../../utils/Strings.sol";
import "../../utils/Strings.sol";
import "../../Initializable.sol";
/**
/**
* @title ERC721 Non-Fungible Token Standard basic implementation
* @title ERC721 Non-Fungible Token Standard basic implementation
* @dev see https://eips.ethereum.org/EIPS/eip-721
* @dev see https://eips.ethereum.org/EIPS/eip-721
*/
*/
contract ERC721
is Context, ERC165
, IERC721, IERC721Metadata, IERC721Enumerable {
contract ERC721
Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable
, IERC721, IERC721Metadata, IERC721Enumerable {
using SafeMath for uint256;
using SafeMath for uint256;
using Address for address;
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableSet for EnumerableSet.UintSet;
...
@@ -85,7 +86,16 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
...
@@ -85,7 +86,16 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
*/
*/
bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;
bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;
constructor (string memory name, string memory symbol) public {
function __ERC721_init(string memory name, string memory symbol) internal initializer {
__Context_init_unchained();
__ERC165_init_unchained();
__ERC721_init_unchained(name, symbol);
}
function __ERC721_init_unchained(string memory name, string memory symbol) internal initializer {
_name = name;
_name = name;
_symbol = symbol;
_symbol = symbol;
...
@@ -93,8 +103,10 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
...
@@ -93,8 +103,10 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
_registerInterface(_INTERFACE_ID_ERC721);
_registerInterface(_INTERFACE_ID_ERC721);
_registerInterface(_INTERFACE_ID_ERC721_METADATA);
_registerInterface(_INTERFACE_ID_ERC721_METADATA);
_registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
_registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
}
}
/**
/**
* @dev Gets the balance of the specified address.
* @dev Gets the balance of the specified address.
* @param owner address to query the balance of
* @param owner address to query the balance of
...
@@ -539,4 +551,6 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
...
@@ -539,4 +551,6 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
*/
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }
uint256[41] private __gap;
}
}
contracts/token/ERC721/ERC721Burnable.sol
View file @
37f74c7d
...
@@ -2,12 +2,24 @@ pragma solidity ^0.6.0;
...
@@ -2,12 +2,24 @@ pragma solidity ^0.6.0;
import "../../GSN/Context.sol";
import "../../GSN/Context.sol";
import "./ERC721.sol";
import "./ERC721.sol";
import "../../Initializable.sol";
/**
/**
* @title ERC721 Burnable Token
* @title ERC721 Burnable Token
* @dev ERC721 Token that can be irreversibly burned (destroyed).
* @dev ERC721 Token that can be irreversibly burned (destroyed).
*/
*/
abstract contract ERC721Burnable is Context, ERC721 {
abstract contract ERC721BurnableUpgradeable is Initializable, ContextUpgradeable, ERC721Upgradeable {
function __ERC721Burnable_init() internal initializer {
__Context_init_unchained();
__ERC165_init_unchained();
__ERC721Burnable_init_unchained();
}
function __ERC721Burnable_init_unchained() internal initializer {
}
/**
/**
* @dev Burns a specific ERC721 token.
* @dev Burns a specific ERC721 token.
* @param tokenId uint256 id of the ERC721 token to be burned.
* @param tokenId uint256 id of the ERC721 token to be burned.
...
@@ -17,4 +29,6 @@ abstract contract ERC721Burnable is Context, ERC721 {
...
@@ -17,4 +29,6 @@ abstract contract ERC721Burnable is Context, ERC721 {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
_burn(tokenId);
_burn(tokenId);
}
}
uint256[50] private __gap;
}
}
contracts/token/ERC721/ERC721Holder.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "./IERC721Receiver.sol";
import "./IERC721Receiver.sol";
import "../../Initializable.sol";
contract ERC721HolderUpgradeable is Initializable, IERC721Receiver {
function __ERC721Holder_init() internal initializer {
__ERC721Holder_init_unchained();
}
function __ERC721Holder_init_unchained() internal initializer {
}
contract ERC721Holder is IERC721Receiver {
function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) {
function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) {
return this.onERC721Received.selector;
return this.onERC721Received.selector;
}
}
uint256[50] private __gap;
}
}
contracts/token/ERC721/ERC721Pausable.sol
View file @
37f74c7d
...
@@ -2,6 +2,7 @@ pragma solidity ^0.6.0;
...
@@ -2,6 +2,7 @@ pragma solidity ^0.6.0;
import "./ERC721.sol";
import "./ERC721.sol";
import "../../utils/Pausable.sol";
import "../../utils/Pausable.sol";
import "../../Initializable.sol";
/**
/**
* @dev ERC721 token with pausable token transfers, minting and burning.
* @dev ERC721 token with pausable token transfers, minting and burning.
...
@@ -10,7 +11,19 @@ import "../../utils/Pausable.sol";
...
@@ -10,7 +11,19 @@ import "../../utils/Pausable.sol";
* period, or having an emergency switch for freezing all token transfers in the
* period, or having an emergency switch for freezing all token transfers in the
* event of a large bug.
* event of a large bug.
*/
*/
abstract contract ERC721Pausable is ERC721, Pausable {
abstract contract ERC721PausableUpgradeable is Initializable, ERC721Upgradeable, PausableUpgradeable {
function __ERC721Pausable_init() internal initializer {
__Context_init_unchained();
__ERC165_init_unchained();
__Pausable_init_unchained();
__ERC721Pausable_init_unchained();
}
function __ERC721Pausable_init_unchained() internal initializer {
}
/**
/**
* @dev See {ERC721-_beforeTokenTransfer}.
* @dev See {ERC721-_beforeTokenTransfer}.
*
*
...
@@ -23,4 +36,6 @@ abstract contract ERC721Pausable is ERC721, Pausable {
...
@@ -23,4 +36,6 @@ abstract contract ERC721Pausable is ERC721, Pausable {
require(!paused(), "ERC721Pausable: token transfer while paused");
require(!paused(), "ERC721Pausable: token transfer while paused");
}
}
uint256[50] private __gap;
}
}
contracts/token/ERC777/ERC777.sol
View file @
37f74c7d
...
@@ -8,6 +8,7 @@ import "../../token/ERC20/IERC20.sol";
...
@@ -8,6 +8,7 @@ import "../../token/ERC20/IERC20.sol";
import "../../math/SafeMath.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";
import "../../utils/Address.sol";
import "../../introspection/IERC1820Registry.sol";
import "../../introspection/IERC1820Registry.sol";
import "../../Initializable.sol";
/**
/**
* @dev Implementation of the {IERC777} interface.
* @dev Implementation of the {IERC777} interface.
...
@@ -24,7 +25,7 @@ import "../../introspection/IERC1820Registry.sol";
...
@@ -24,7 +25,7 @@ import "../../introspection/IERC1820Registry.sol";
* are no special restrictions in the amount of tokens that created, moved, or
* are no special restrictions in the amount of tokens that created, moved, or
* destroyed. This makes integration with ERC20 applications seamless.
* destroyed. This makes integration with ERC20 applications seamless.
*/
*/
contract ERC777
is Context
, IERC777, IERC20 {
contract ERC777
Upgradeable is Initializable, ContextUpgradeable
, IERC777, IERC20 {
using SafeMath for uint256;
using SafeMath for uint256;
using Address for address;
using Address for address;
...
@@ -64,11 +65,23 @@ contract ERC777 is Context, IERC777, IERC20 {
...
@@ -64,11 +65,23 @@ contract ERC777 is Context, IERC777, IERC20 {
/**
/**
* @dev `defaultOperators` may be an empty array.
* @dev `defaultOperators` may be an empty array.
*/
*/
constructor(
function __ERC777_init(
string memory name,
string memory symbol,
address[] memory defaultOperators
) internal initializer {
__Context_init_unchained();
__ERC777_init_unchained(name, symbol, defaultOperators);
}
function __ERC777_init_unchained(
string memory name,
string memory name,
string memory symbol,
string memory symbol,
address[] memory defaultOperators
address[] memory defaultOperators
) public {
) internal initializer {
_name = name;
_name = name;
_symbol = symbol;
_symbol = symbol;
...
@@ -80,8 +93,10 @@ contract ERC777 is Context, IERC777, IERC20 {
...
@@ -80,8 +93,10 @@ contract ERC777 is Context, IERC777, IERC20 {
// register interfaces
// register interfaces
_ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256("ERC777Token"), address(this));
_ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256("ERC777Token"), address(this));
_ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256("ERC20Token"), address(this));
_ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256("ERC20Token"), address(this));
}
}
/**
/**
* @dev See {IERC777-name}.
* @dev See {IERC777-name}.
*/
*/
...
@@ -495,4 +510,6 @@ contract ERC777 is Context, IERC777, IERC20 {
...
@@ -495,4 +510,6 @@ contract ERC777 is Context, IERC777, IERC20 {
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
*/
function _beforeTokenTransfer(address operator, address from, address to, uint256 tokenId) internal virtual { }
function _beforeTokenTransfer(address operator, address from, address to, uint256 tokenId) internal virtual { }
uint256[41] private __gap;
}
}
contracts/utils/Pausable.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../GSN/Context.sol";
import "../GSN/Context.sol";
import "../Initializable.sol";
/**
/**
* @dev Contract module which allows children to implement an emergency stop
* @dev Contract module which allows children to implement an emergency stop
...
@@ -11,7 +12,7 @@ import "../GSN/Context.sol";
...
@@ -11,7 +12,7 @@ import "../GSN/Context.sol";
* the functions of your contract. Note that they will not be pausable by
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
* simply including this module, only once the modifiers are put in place.
*/
*/
contract Pausable
is Context
{
contract Pausable
Upgradeable is Initializable, ContextUpgradeable
{
/**
/**
* @dev Emitted when the pause is triggered by `account`.
* @dev Emitted when the pause is triggered by `account`.
*/
*/
...
@@ -27,10 +28,20 @@ contract Pausable is Context {
...
@@ -27,10 +28,20 @@ contract Pausable is Context {
/**
/**
* @dev Initializes the contract in unpaused state.
* @dev Initializes the contract in unpaused state.
*/
*/
constructor () internal {
function __Pausable_init() internal initializer {
__Context_init_unchained();
__Pausable_init_unchained();
}
function __Pausable_init_unchained() internal initializer {
_paused = false;
_paused = false;
}
}
/**
/**
* @dev Returns true if the contract is paused, and false otherwise.
* @dev Returns true if the contract is paused, and false otherwise.
*/
*/
...
@@ -69,4 +80,6 @@ contract Pausable is Context {
...
@@ -69,4 +80,6 @@ contract Pausable is Context {
_paused = false;
_paused = false;
emit Unpaused(_msgSender());
emit Unpaused(_msgSender());
}
}
uint256[49] private __gap;
}
}
contracts/utils/ReentrancyGuard.sol
View file @
37f74c7d
pragma solidity ^0.6.0;
pragma solidity ^0.6.0;
import "../Initializable.sol";
/**
/**
* @dev Contract module that helps prevent reentrant calls to a function.
* @dev Contract module that helps prevent reentrant calls to a function.
...
@@ -16,10 +17,17 @@ pragma solidity ^0.6.0;
...
@@ -16,10 +17,17 @@ pragma solidity ^0.6.0;
* to protect against it, check out our blog post
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
*/
contract ReentrancyGuard {
contract ReentrancyGuard
Upgradeable is Initializable
{
bool private _notEntered;
bool private _notEntered;
constructor () internal {
function __ReentrancyGuard_init() internal initializer {
__ReentrancyGuard_init_unchained();
}
function __ReentrancyGuard_init_unchained() internal initializer {
// Storing an initial non-zero value makes deployment a bit more
// Storing an initial non-zero value makes deployment a bit more
// expensive, but in exchange the refund on every call to nonReentrant
// expensive, but in exchange the refund on every call to nonReentrant
// will be lower in amount. Since refunds are capped to a percetange of
// will be lower in amount. Since refunds are capped to a percetange of
...
@@ -27,8 +35,10 @@ contract ReentrancyGuard {
...
@@ -27,8 +35,10 @@ contract ReentrancyGuard {
// like this one, to increase the likelihood of the full refund coming
// like this one, to increase the likelihood of the full refund coming
// into effect.
// into effect.
_notEntered = true;
_notEntered = true;
}
}
/**
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* Calling a `nonReentrant` function from another `nonReentrant`
...
@@ -49,4 +59,6 @@ contract ReentrancyGuard {
...
@@ -49,4 +59,6 @@ contract ReentrancyGuard {
// https://eips.ethereum.org/EIPS/eip-2200)
// https://eips.ethereum.org/EIPS/eip-2200)
_notEntered = true;
_notEntered = true;
}
}
uint256[49] private __gap;
}
}
test/GSN/Context.behavior.js
View file @
37f74c7d
...
@@ -2,7 +2,7 @@ const { contract } = require('@openzeppelin/test-environment');
...
@@ -2,7 +2,7 @@ const { contract } = require('@openzeppelin/test-environment');
const
{
BN
,
expectEvent
}
=
require
(
'@openzeppelin/test-helpers'
);
const
{
BN
,
expectEvent
}
=
require
(
'@openzeppelin/test-helpers'
);
const
ContextMock
=
contract
.
fromArtifact
(
'ContextMock'
);
const
ContextMock
=
contract
.
fromArtifact
(
'ContextMock
Upgradeable
'
);
function
shouldBehaveLikeRegularContext
(
sender
)
{
function
shouldBehaveLikeRegularContext
(
sender
)
{
describe
(
'msgSender'
,
function
()
{
describe
(
'msgSender'
,
function
()
{
...
...
test/GSN/Context.test.js
View file @
37f74c7d
...
@@ -2,8 +2,8 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
...
@@ -2,8 +2,8 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
require
(
'@openzeppelin/test-helpers'
);
require
(
'@openzeppelin/test-helpers'
);
const
ContextMock
=
contract
.
fromArtifact
(
'ContextMock'
);
const
ContextMock
=
contract
.
fromArtifact
(
'ContextMock
Upgradeable
'
);
const
ContextMockCaller
=
contract
.
fromArtifact
(
'ContextMockCaller'
);
const
ContextMockCaller
=
contract
.
fromArtifact
(
'ContextMockCaller
Upgradeable
'
);
const
{
shouldBehaveLikeRegularContext
}
=
require
(
'./Context.behavior'
);
const
{
shouldBehaveLikeRegularContext
}
=
require
(
'./Context.behavior'
);
...
...
test/GSN/ERC721GSNRecipientMock.test.js
View file @
37f74c7d
...
@@ -6,7 +6,7 @@ const gsn = require('@openzeppelin/gsn-helpers');
...
@@ -6,7 +6,7 @@ const gsn = require('@openzeppelin/gsn-helpers');
const
{
fixSignature
}
=
require
(
'../helpers/sign'
);
const
{
fixSignature
}
=
require
(
'../helpers/sign'
);
const
{
utils
:
{
toBN
}
}
=
require
(
'web3'
);
const
{
utils
:
{
toBN
}
}
=
require
(
'web3'
);
const
ERC721GSNRecipientMock
=
contract
.
fromArtifact
(
'ERC721GSNRecipientMock'
);
const
ERC721GSNRecipientMock
=
contract
.
fromArtifact
(
'ERC721GSNRecipientMock
Upgradeable
'
);
describe
(
'ERC721GSNRecipient (integration)'
,
function
()
{
describe
(
'ERC721GSNRecipient (integration)'
,
function
()
{
const
[
signer
,
sender
]
=
accounts
;
const
[
signer
,
sender
]
=
accounts
;
...
...
test/GSN/GSNRecipient.test.js
View file @
37f74c7d
...
@@ -7,8 +7,8 @@ const gsn = require('@openzeppelin/gsn-helpers');
...
@@ -7,8 +7,8 @@ const gsn = require('@openzeppelin/gsn-helpers');
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
GSNRecipientMock
=
contract
.
fromArtifact
(
'GSNRecipientMock'
);
const
GSNRecipientMock
=
contract
.
fromArtifact
(
'GSNRecipientMock
Upgradeable
'
);
const
ContextMockCaller
=
contract
.
fromArtifact
(
'ContextMockCaller'
);
const
ContextMockCaller
=
contract
.
fromArtifact
(
'ContextMockCaller
Upgradeable
'
);
const
{
shouldBehaveLikeRegularContext
}
=
require
(
'./Context.behavior'
);
const
{
shouldBehaveLikeRegularContext
}
=
require
(
'./Context.behavior'
);
...
...
test/GSN/GSNRecipientERC20Fee.test.js
View file @
37f74c7d
...
@@ -5,8 +5,8 @@ const gsn = require('@openzeppelin/gsn-helpers');
...
@@ -5,8 +5,8 @@ const gsn = require('@openzeppelin/gsn-helpers');
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
GSNRecipientERC20FeeMock
=
contract
.
fromArtifact
(
'GSNRecipientERC20FeeMock'
);
const
GSNRecipientERC20FeeMock
=
contract
.
fromArtifact
(
'GSNRecipientERC20FeeMock
Upgradeable
'
);
const
ERC20
=
contract
.
fromArtifact
(
'ERC20'
);
const
ERC20
=
contract
.
fromArtifact
(
'ERC20
Upgradeable
'
);
const
IRelayHub
=
contract
.
fromArtifact
(
'IRelayHub'
);
const
IRelayHub
=
contract
.
fromArtifact
(
'IRelayHub'
);
describe
(
'GSNRecipientERC20Fee'
,
function
()
{
describe
(
'GSNRecipientERC20Fee'
,
function
()
{
...
...
test/GSN/GSNRecipientSignature.test.js
View file @
37f74c7d
...
@@ -6,7 +6,7 @@ const { fixSignature } = require('../helpers/sign');
...
@@ -6,7 +6,7 @@ const { fixSignature } = require('../helpers/sign');
const
{
utils
:
{
toBN
}
}
=
require
(
'web3'
);
const
{
utils
:
{
toBN
}
}
=
require
(
'web3'
);
const
{
ZERO_ADDRESS
}
=
constants
;
const
{
ZERO_ADDRESS
}
=
constants
;
const
GSNRecipientSignatureMock
=
contract
.
fromArtifact
(
'GSNRecipientSignatureMock'
);
const
GSNRecipientSignatureMock
=
contract
.
fromArtifact
(
'GSNRecipientSignatureMock
Upgradeable
'
);
describe
(
'GSNRecipientSignature'
,
function
()
{
describe
(
'GSNRecipientSignature'
,
function
()
{
const
[
signer
,
other
]
=
accounts
;
const
[
signer
,
other
]
=
accounts
;
...
...
test/access/AccessControl.test.js
View file @
37f74c7d
...
@@ -4,7 +4,7 @@ const { expectEvent, expectRevert } = require('@openzeppelin/test-helpers');
...
@@ -4,7 +4,7 @@ const { expectEvent, expectRevert } = require('@openzeppelin/test-helpers');
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
AccessControlMock
=
contract
.
fromArtifact
(
'AccessControlMock'
);
const
AccessControlMock
=
contract
.
fromArtifact
(
'AccessControlMock
Upgradeable
'
);
describe
(
'AccessControl'
,
function
()
{
describe
(
'AccessControl'
,
function
()
{
const
[
admin
,
authorized
,
otherAuthorized
,
other
,
otherAdmin
]
=
accounts
;
const
[
admin
,
authorized
,
otherAuthorized
,
other
,
otherAdmin
]
=
accounts
;
...
...
test/access/Ownable.test.js
View file @
37f74c7d
...
@@ -4,7 +4,7 @@ const { ZERO_ADDRESS } = constants;
...
@@ -4,7 +4,7 @@ const { ZERO_ADDRESS } = constants;
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
Ownable
=
contract
.
fromArtifact
(
'OwnableMock'
);
const
Ownable
=
contract
.
fromArtifact
(
'OwnableMock
Upgradeable
'
);
describe
(
'Ownable'
,
function
()
{
describe
(
'Ownable'
,
function
()
{
const
[
owner
,
other
]
=
accounts
;
const
[
owner
,
other
]
=
accounts
;
...
...
test/cryptography/ECDSA.test.js
View file @
37f74c7d
...
@@ -5,7 +5,7 @@ const { toEthSignedMessageHash, fixSignature } = require('../helpers/sign');
...
@@ -5,7 +5,7 @@ const { toEthSignedMessageHash, fixSignature } = require('../helpers/sign');
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
ECDSAMock
=
contract
.
fromArtifact
(
'ECDSAMock'
);
const
ECDSAMock
=
contract
.
fromArtifact
(
'ECDSAMock
Upgradeable
'
);
const
TEST_MESSAGE
=
web3
.
utils
.
sha3
(
'OpenZeppelin'
);
const
TEST_MESSAGE
=
web3
.
utils
.
sha3
(
'OpenZeppelin'
);
const
WRONG_MESSAGE
=
web3
.
utils
.
sha3
(
'Nope'
);
const
WRONG_MESSAGE
=
web3
.
utils
.
sha3
(
'Nope'
);
...
...
test/cryptography/MerkleProof.test.js
View file @
37f74c7d
...
@@ -7,7 +7,7 @@ const { keccak256, bufferToHex } = require('ethereumjs-util');
...
@@ -7,7 +7,7 @@ const { keccak256, bufferToHex } = require('ethereumjs-util');
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
MerkleProofWrapper
=
contract
.
fromArtifact
(
'MerkleProofWrapper'
);
const
MerkleProofWrapper
=
contract
.
fromArtifact
(
'MerkleProofWrapper
Upgradeable
'
);
describe
(
'MerkleProof'
,
function
()
{
describe
(
'MerkleProof'
,
function
()
{
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
...
...
test/introspection/ERC165.test.js
View file @
37f74c7d
...
@@ -3,7 +3,7 @@ const { expectRevert } = require('@openzeppelin/test-helpers');
...
@@ -3,7 +3,7 @@ const { expectRevert } = require('@openzeppelin/test-helpers');
const
{
shouldSupportInterfaces
}
=
require
(
'./SupportsInterface.behavior'
);
const
{
shouldSupportInterfaces
}
=
require
(
'./SupportsInterface.behavior'
);
const
ERC165Mock
=
contract
.
fromArtifact
(
'ERC165Mock'
);
const
ERC165Mock
=
contract
.
fromArtifact
(
'ERC165Mock
Upgradeable
'
);
describe
(
'ERC165'
,
function
()
{
describe
(
'ERC165'
,
function
()
{
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
...
...
test/introspection/ERC165Checker.test.js
View file @
37f74c7d
...
@@ -3,9 +3,9 @@ require('@openzeppelin/test-helpers');
...
@@ -3,9 +3,9 @@ require('@openzeppelin/test-helpers');
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
ERC165CheckerMock
=
contract
.
fromArtifact
(
'ERC165CheckerMock'
);
const
ERC165CheckerMock
=
contract
.
fromArtifact
(
'ERC165CheckerMock
Upgradeable
'
);
const
ERC165NotSupported
=
contract
.
fromArtifact
(
'ERC165NotSupported'
);
const
ERC165NotSupported
=
contract
.
fromArtifact
(
'ERC165NotSupported
Upgradeable
'
);
const
ERC165InterfacesSupported
=
contract
.
fromArtifact
(
'ERC165InterfacesSupported'
);
const
ERC165InterfacesSupported
=
contract
.
fromArtifact
(
'ERC165InterfacesSupported
Upgradeable
'
);
const
DUMMY_ID
=
'0xdeadbeef'
;
const
DUMMY_ID
=
'0xdeadbeef'
;
const
DUMMY_ID_2
=
'0xcafebabe'
;
const
DUMMY_ID_2
=
'0xcafebabe'
;
...
...
test/introspection/ERC1820Implementer.test.js
View file @
37f74c7d
...
@@ -5,7 +5,7 @@ const { bufferToHex, keccak256 } = require('ethereumjs-util');
...
@@ -5,7 +5,7 @@ const { bufferToHex, keccak256 } = require('ethereumjs-util');
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
ERC1820ImplementerMock
=
contract
.
fromArtifact
(
'ERC1820ImplementerMock'
);
const
ERC1820ImplementerMock
=
contract
.
fromArtifact
(
'ERC1820ImplementerMock
Upgradeable
'
);
describe
(
'ERC1820Implementer'
,
function
()
{
describe
(
'ERC1820Implementer'
,
function
()
{
const
[
registryFunder
,
implementee
,
other
]
=
accounts
;
const
[
registryFunder
,
implementee
,
other
]
=
accounts
;
...
...
test/math/Math.test.js
View file @
37f74c7d
...
@@ -3,7 +3,7 @@ const { BN } = require('@openzeppelin/test-helpers');
...
@@ -3,7 +3,7 @@ const { BN } = require('@openzeppelin/test-helpers');
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
MathMock
=
contract
.
fromArtifact
(
'MathMock'
);
const
MathMock
=
contract
.
fromArtifact
(
'MathMock
Upgradeable
'
);
describe
(
'Math'
,
function
()
{
describe
(
'Math'
,
function
()
{
const
min
=
new
BN
(
'1234'
);
const
min
=
new
BN
(
'1234'
);
...
...
test/math/SafeMath.test.js
View file @
37f74c7d
...
@@ -4,7 +4,7 @@ const { MAX_UINT256 } = constants;
...
@@ -4,7 +4,7 @@ const { MAX_UINT256 } = constants;
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
SafeMathMock
=
contract
.
fromArtifact
(
'SafeMathMock'
);
const
SafeMathMock
=
contract
.
fromArtifact
(
'SafeMathMock
Upgradeable
'
);
describe
(
'SafeMath'
,
function
()
{
describe
(
'SafeMath'
,
function
()
{
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
...
...
test/math/SignedSafeMath.test.js
View file @
37f74c7d
...
@@ -5,7 +5,7 @@ const { MAX_INT256, MIN_INT256 } = constants;
...
@@ -5,7 +5,7 @@ const { MAX_INT256, MIN_INT256 } = constants;
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
SignedSafeMathMock
=
contract
.
fromArtifact
(
'SignedSafeMathMock'
);
const
SignedSafeMathMock
=
contract
.
fromArtifact
(
'SignedSafeMathMock
Upgradeable
'
);
describe
(
'SignedSafeMath'
,
function
()
{
describe
(
'SignedSafeMath'
,
function
()
{
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
...
...
test/payment/PaymentSplitter.test.js
View file @
37f74c7d
...
@@ -5,7 +5,7 @@ const { ZERO_ADDRESS } = constants;
...
@@ -5,7 +5,7 @@ const { ZERO_ADDRESS } = constants;
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
PaymentSplitter
=
contract
.
fromArtifact
(
'PaymentSplitterMock'
);
const
PaymentSplitter
=
contract
.
fromArtifact
(
'PaymentSplitterMock
Upgradeable
'
);
describe
(
'PaymentSplitter'
,
function
()
{
describe
(
'PaymentSplitter'
,
function
()
{
const
[
owner
,
payee1
,
payee2
,
payee3
,
nonpayee1
,
payer1
]
=
accounts
;
const
[
owner
,
payee1
,
payee2
,
payee3
,
nonpayee1
,
payer1
]
=
accounts
;
...
...
test/payment/PullPayment.test.js
View file @
37f74c7d
...
@@ -4,7 +4,7 @@ const { balance, ether } = require('@openzeppelin/test-helpers');
...
@@ -4,7 +4,7 @@ const { balance, ether } = require('@openzeppelin/test-helpers');
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
PullPaymentMock
=
contract
.
fromArtifact
(
'PullPaymentMock'
);
const
PullPaymentMock
=
contract
.
fromArtifact
(
'PullPaymentMock
Upgradeable
'
);
describe
(
'PullPayment'
,
function
()
{
describe
(
'PullPayment'
,
function
()
{
const
[
payer
,
payee1
,
payee2
]
=
accounts
;
const
[
payer
,
payee1
,
payee2
]
=
accounts
;
...
...
test/payment/escrow/ConditionalEscrow.test.js
View file @
37f74c7d
...
@@ -3,7 +3,7 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
...
@@ -3,7 +3,7 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
const
{
ether
,
expectRevert
}
=
require
(
'@openzeppelin/test-helpers'
);
const
{
ether
,
expectRevert
}
=
require
(
'@openzeppelin/test-helpers'
);
const
{
shouldBehaveLikeEscrow
}
=
require
(
'./Escrow.behavior'
);
const
{
shouldBehaveLikeEscrow
}
=
require
(
'./Escrow.behavior'
);
const
ConditionalEscrowMock
=
contract
.
fromArtifact
(
'ConditionalEscrowMock'
);
const
ConditionalEscrowMock
=
contract
.
fromArtifact
(
'ConditionalEscrowMock
Upgradeable
'
);
describe
(
'ConditionalEscrow'
,
function
()
{
describe
(
'ConditionalEscrow'
,
function
()
{
const
[
owner
,
payee
,
...
otherAccounts
]
=
accounts
;
const
[
owner
,
payee
,
...
otherAccounts
]
=
accounts
;
...
...
test/payment/escrow/Escrow.test.js
View file @
37f74c7d
...
@@ -3,7 +3,7 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
...
@@ -3,7 +3,7 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
require
(
'@openzeppelin/test-helpers'
);
require
(
'@openzeppelin/test-helpers'
);
const
{
shouldBehaveLikeEscrow
}
=
require
(
'./Escrow.behavior'
);
const
{
shouldBehaveLikeEscrow
}
=
require
(
'./Escrow.behavior'
);
const
Escrow
=
contract
.
fromArtifact
(
'EscrowMock'
);
const
Escrow
=
contract
.
fromArtifact
(
'EscrowMock
Upgradeable
'
);
describe
(
'Escrow'
,
function
()
{
describe
(
'Escrow'
,
function
()
{
const
[
owner
,
...
otherAccounts
]
=
accounts
;
const
[
owner
,
...
otherAccounts
]
=
accounts
;
...
...
test/payment/escrow/RefundEscrow.test.js
View file @
37f74c7d
...
@@ -5,7 +5,7 @@ const { ZERO_ADDRESS } = constants;
...
@@ -5,7 +5,7 @@ const { ZERO_ADDRESS } = constants;
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
RefundEscrow
=
contract
.
fromArtifact
(
'RefundEscrowMock'
);
const
RefundEscrow
=
contract
.
fromArtifact
(
'RefundEscrowMock
Upgradeable
'
);
describe
(
'RefundEscrow'
,
function
()
{
describe
(
'RefundEscrow'
,
function
()
{
const
[
owner
,
beneficiary
,
refundee1
,
refundee2
]
=
accounts
;
const
[
owner
,
beneficiary
,
refundee1
,
refundee2
]
=
accounts
;
...
...
test/presets/ERC20PresetMinterPauser.test.js
View file @
37f74c7d
...
@@ -5,7 +5,7 @@ const { ZERO_ADDRESS } = constants;
...
@@ -5,7 +5,7 @@ const { ZERO_ADDRESS } = constants;
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
ERC20PresetMinterPauser
=
contract
.
fromArtifact
(
'ERC20PresetMinterPauserMock'
);
const
ERC20PresetMinterPauser
=
contract
.
fromArtifact
(
'ERC20PresetMinterPauserMock
Upgradeable
'
);
describe
(
'ERC20PresetMinterPauser'
,
function
()
{
describe
(
'ERC20PresetMinterPauser'
,
function
()
{
const
[
deployer
,
other
]
=
accounts
;
const
[
deployer
,
other
]
=
accounts
;
...
...
test/presets/ERC721PresetMinterPauserAutoId.js
View file @
37f74c7d
...
@@ -5,7 +5,7 @@ const { ZERO_ADDRESS } = constants;
...
@@ -5,7 +5,7 @@ const { ZERO_ADDRESS } = constants;
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
ERC721PresetMinterPauserAutoId
=
contract
.
fromArtifact
(
'ERC721PresetMinterPauserAutoIdMock'
);
const
ERC721PresetMinterPauserAutoId
=
contract
.
fromArtifact
(
'ERC721PresetMinterPauserAutoIdMock
Upgradeable
'
);
describe
(
'ERC721PresetMinterPauserAutoId'
,
function
()
{
describe
(
'ERC721PresetMinterPauserAutoId'
,
function
()
{
const
[
deployer
,
other
]
=
accounts
;
const
[
deployer
,
other
]
=
accounts
;
...
...
test/token/ERC20/ERC20.test.js
View file @
37f74c7d
...
@@ -10,8 +10,8 @@ const {
...
@@ -10,8 +10,8 @@ const {
shouldBehaveLikeERC20Approve
,
shouldBehaveLikeERC20Approve
,
}
=
require
(
'./ERC20.behavior'
);
}
=
require
(
'./ERC20.behavior'
);
const
ERC20Mock
=
contract
.
fromArtifact
(
'ERC20Mock'
);
const
ERC20Mock
=
contract
.
fromArtifact
(
'ERC20Mock
Upgradeable
'
);
const
ERC20DecimalsMock
=
contract
.
fromArtifact
(
'ERC20DecimalsMock'
);
const
ERC20DecimalsMock
=
contract
.
fromArtifact
(
'ERC20DecimalsMock
Upgradeable
'
);
describe
(
'ERC20'
,
function
()
{
describe
(
'ERC20'
,
function
()
{
const
[
initialHolder
,
recipient
,
anotherAccount
]
=
accounts
;
const
[
initialHolder
,
recipient
,
anotherAccount
]
=
accounts
;
...
...
test/token/ERC20/ERC20Burnable.test.js
View file @
37f74c7d
...
@@ -3,7 +3,7 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
...
@@ -3,7 +3,7 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
const
{
BN
}
=
require
(
'@openzeppelin/test-helpers'
);
const
{
BN
}
=
require
(
'@openzeppelin/test-helpers'
);
const
{
shouldBehaveLikeERC20Burnable
}
=
require
(
'./behaviors/ERC20Burnable.behavior'
);
const
{
shouldBehaveLikeERC20Burnable
}
=
require
(
'./behaviors/ERC20Burnable.behavior'
);
const
ERC20BurnableMock
=
contract
.
fromArtifact
(
'ERC20BurnableMock'
);
const
ERC20BurnableMock
=
contract
.
fromArtifact
(
'ERC20BurnableMock
Upgradeable
'
);
describe
(
'ERC20Burnable'
,
function
()
{
describe
(
'ERC20Burnable'
,
function
()
{
const
[
owner
,
...
otherAccounts
]
=
accounts
;
const
[
owner
,
...
otherAccounts
]
=
accounts
;
...
...
test/token/ERC20/ERC20Capped.test.js
View file @
37f74c7d
...
@@ -3,7 +3,7 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
...
@@ -3,7 +3,7 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
const
{
BN
,
ether
,
expectRevert
}
=
require
(
'@openzeppelin/test-helpers'
);
const
{
BN
,
ether
,
expectRevert
}
=
require
(
'@openzeppelin/test-helpers'
);
const
{
shouldBehaveLikeERC20Capped
}
=
require
(
'./behaviors/ERC20Capped.behavior'
);
const
{
shouldBehaveLikeERC20Capped
}
=
require
(
'./behaviors/ERC20Capped.behavior'
);
const
ERC20Capped
=
contract
.
fromArtifact
(
'ERC20CappedMock'
);
const
ERC20Capped
=
contract
.
fromArtifact
(
'ERC20CappedMock
Upgradeable
'
);
describe
(
'ERC20Capped'
,
function
()
{
describe
(
'ERC20Capped'
,
function
()
{
const
[
minter
,
...
otherAccounts
]
=
accounts
;
const
[
minter
,
...
otherAccounts
]
=
accounts
;
...
...
test/token/ERC20/ERC20Pausable.test.js
View file @
37f74c7d
...
@@ -4,7 +4,7 @@ const { BN, expectRevert } = require('@openzeppelin/test-helpers');
...
@@ -4,7 +4,7 @@ const { BN, expectRevert } = require('@openzeppelin/test-helpers');
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
ERC20PausableMock
=
contract
.
fromArtifact
(
'ERC20PausableMock'
);
const
ERC20PausableMock
=
contract
.
fromArtifact
(
'ERC20PausableMock
Upgradeable
'
);
describe
(
'ERC20Pausable'
,
function
()
{
describe
(
'ERC20Pausable'
,
function
()
{
const
[
holder
,
recipient
,
anotherAccount
]
=
accounts
;
const
[
holder
,
recipient
,
anotherAccount
]
=
accounts
;
...
...
test/token/ERC20/ERC20Snapshot.test.js
View file @
37f74c7d
const
{
accounts
,
contract
}
=
require
(
'@openzeppelin/test-environment'
);
const
{
accounts
,
contract
}
=
require
(
'@openzeppelin/test-environment'
);
const
{
BN
,
expectEvent
,
expectRevert
}
=
require
(
'@openzeppelin/test-helpers'
);
const
{
BN
,
expectEvent
,
expectRevert
}
=
require
(
'@openzeppelin/test-helpers'
);
const
ERC20SnapshotMock
=
contract
.
fromArtifact
(
'ERC20SnapshotMock'
);
const
ERC20SnapshotMock
=
contract
.
fromArtifact
(
'ERC20SnapshotMock
Upgradeable
'
);
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
...
...
test/token/ERC20/SafeERC20.test.js
View file @
37f74c7d
...
@@ -2,10 +2,10 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
...
@@ -2,10 +2,10 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
const
{
expectRevert
}
=
require
(
'@openzeppelin/test-helpers'
);
const
{
expectRevert
}
=
require
(
'@openzeppelin/test-helpers'
);
const
ERC20ReturnFalseMock
=
contract
.
fromArtifact
(
'ERC20ReturnFalseMock'
);
const
ERC20ReturnFalseMock
=
contract
.
fromArtifact
(
'ERC20ReturnFalseMock
Upgradeable
'
);
const
ERC20ReturnTrueMock
=
contract
.
fromArtifact
(
'ERC20ReturnTrueMock'
);
const
ERC20ReturnTrueMock
=
contract
.
fromArtifact
(
'ERC20ReturnTrueMock
Upgradeable
'
);
const
ERC20NoReturnMock
=
contract
.
fromArtifact
(
'ERC20NoReturnMock'
);
const
ERC20NoReturnMock
=
contract
.
fromArtifact
(
'ERC20NoReturnMock
Upgradeable
'
);
const
SafeERC20Mock
=
contract
.
fromArtifact
(
'SafeERC20Mock'
);
const
SafeERC20Mock
=
contract
.
fromArtifact
(
'SafeERC20Mock
Upgradeable
'
);
describe
(
'SafeERC20'
,
function
()
{
describe
(
'SafeERC20'
,
function
()
{
const
[
hasNoCode
]
=
accounts
;
const
[
hasNoCode
]
=
accounts
;
...
...
test/token/ERC20/TokenTimelock.test.js
View file @
37f74c7d
...
@@ -4,8 +4,8 @@ const { BN, expectRevert, time } = require('@openzeppelin/test-helpers');
...
@@ -4,8 +4,8 @@ const { BN, expectRevert, time } = require('@openzeppelin/test-helpers');
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
ERC20Mock
=
contract
.
fromArtifact
(
'ERC20Mock'
);
const
ERC20Mock
=
contract
.
fromArtifact
(
'ERC20Mock
Upgradeable
'
);
const
TokenTimelock
=
contract
.
fromArtifact
(
'TokenTimelockMock'
);
const
TokenTimelock
=
contract
.
fromArtifact
(
'TokenTimelockMock
Upgradeable
'
);
describe
(
'TokenTimelock'
,
function
()
{
describe
(
'TokenTimelock'
,
function
()
{
const
[
beneficiary
]
=
accounts
;
const
[
beneficiary
]
=
accounts
;
...
...
test/token/ERC721/ERC721.test.js
View file @
37f74c7d
...
@@ -7,8 +7,8 @@ const { expect } = require('chai');
...
@@ -7,8 +7,8 @@ const { expect } = require('chai');
const
{
shouldSupportInterfaces
}
=
require
(
'../../introspection/SupportsInterface.behavior'
);
const
{
shouldSupportInterfaces
}
=
require
(
'../../introspection/SupportsInterface.behavior'
);
const
ERC721Mock
=
contract
.
fromArtifact
(
'ERC721Mock'
);
const
ERC721Mock
=
contract
.
fromArtifact
(
'ERC721Mock
Upgradeable
'
);
const
ERC721ReceiverMock
=
contract
.
fromArtifact
(
'ERC721ReceiverMock'
);
const
ERC721ReceiverMock
=
contract
.
fromArtifact
(
'ERC721ReceiverMock
Upgradeable
'
);
describe
(
'ERC721'
,
function
()
{
describe
(
'ERC721'
,
function
()
{
const
[
owner
,
newOwner
,
approved
,
anotherApproved
,
operator
,
other
]
=
accounts
;
const
[
owner
,
newOwner
,
approved
,
anotherApproved
,
operator
,
other
]
=
accounts
;
...
...
test/token/ERC721/ERC721Burnable.test.js
View file @
37f74c7d
...
@@ -5,7 +5,7 @@ const { ZERO_ADDRESS } = constants;
...
@@ -5,7 +5,7 @@ const { ZERO_ADDRESS } = constants;
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
ERC721BurnableMock
=
contract
.
fromArtifact
(
'ERC721BurnableMock'
);
const
ERC721BurnableMock
=
contract
.
fromArtifact
(
'ERC721BurnableMock
Upgradeable
'
);
describe
(
'ERC721Burnable'
,
function
()
{
describe
(
'ERC721Burnable'
,
function
()
{
const
[
owner
,
approved
]
=
accounts
;
const
[
owner
,
approved
]
=
accounts
;
...
...
test/token/ERC721/ERC721Holder.test.js
View file @
37f74c7d
...
@@ -4,8 +4,8 @@ const { BN } = require('@openzeppelin/test-helpers');
...
@@ -4,8 +4,8 @@ const { BN } = require('@openzeppelin/test-helpers');
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
ERC721Holder
=
contract
.
fromArtifact
(
'ERC721Holder'
);
const
ERC721Holder
=
contract
.
fromArtifact
(
'ERC721Holder
Upgradeable
'
);
const
ERC721Mock
=
contract
.
fromArtifact
(
'ERC721Mock'
);
const
ERC721Mock
=
contract
.
fromArtifact
(
'ERC721Mock
Upgradeable
'
);
describe
(
'ERC721Holder'
,
function
()
{
describe
(
'ERC721Holder'
,
function
()
{
const
[
owner
]
=
accounts
;
const
[
owner
]
=
accounts
;
...
...
test/token/ERC721/ERC721Pausable.test.js
View file @
37f74c7d
...
@@ -5,7 +5,7 @@ const { ZERO_ADDRESS } = constants;
...
@@ -5,7 +5,7 @@ const { ZERO_ADDRESS } = constants;
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
ERC721PausableMock
=
contract
.
fromArtifact
(
'ERC721PausableMock'
);
const
ERC721PausableMock
=
contract
.
fromArtifact
(
'ERC721PausableMock
Upgradeable
'
);
describe
(
'ERC721Pausable'
,
function
()
{
describe
(
'ERC721Pausable'
,
function
()
{
const
[
owner
,
receiver
,
operator
]
=
accounts
;
const
[
owner
,
receiver
,
operator
]
=
accounts
;
...
...
test/token/ERC777/ERC777.behavior.js
View file @
37f74c7d
...
@@ -4,7 +4,7 @@ const { ZERO_ADDRESS } = constants;
...
@@ -4,7 +4,7 @@ const { ZERO_ADDRESS } = constants;
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
ERC777SenderRecipientMock
=
contract
.
fromArtifact
(
'ERC777SenderRecipientMock'
);
const
ERC777SenderRecipientMock
=
contract
.
fromArtifact
(
'ERC777SenderRecipientMock
Upgradeable
'
);
function
shouldBehaveLikeERC777DirectSendBurn
(
holder
,
recipient
,
data
)
{
function
shouldBehaveLikeERC777DirectSendBurn
(
holder
,
recipient
,
data
)
{
shouldBehaveLikeERC777DirectSend
(
holder
,
recipient
,
data
);
shouldBehaveLikeERC777DirectSend
(
holder
,
recipient
,
data
);
...
...
test/token/ERC777/ERC777.test.js
View file @
37f74c7d
...
@@ -17,8 +17,8 @@ const {
...
@@ -17,8 +17,8 @@ const {
shouldBehaveLikeERC20
,
shouldBehaveLikeERC20
,
}
=
require
(
'../ERC20/ERC20.behavior'
);
}
=
require
(
'../ERC20/ERC20.behavior'
);
const
ERC777
=
contract
.
fromArtifact
(
'ERC777Mock'
);
const
ERC777
=
contract
.
fromArtifact
(
'ERC777Mock
Upgradeable
'
);
const
ERC777SenderRecipientMock
=
contract
.
fromArtifact
(
'ERC777SenderRecipientMock'
);
const
ERC777SenderRecipientMock
=
contract
.
fromArtifact
(
'ERC777SenderRecipientMock
Upgradeable
'
);
describe
(
'ERC777'
,
function
()
{
describe
(
'ERC777'
,
function
()
{
const
[
registryFunder
,
holder
,
defaultOperatorA
,
defaultOperatorB
,
newOperator
,
anyone
]
=
accounts
;
const
[
registryFunder
,
holder
,
defaultOperatorA
,
defaultOperatorB
,
newOperator
,
anyone
]
=
accounts
;
...
...
test/utils/Address.test.js
View file @
37f74c7d
...
@@ -3,8 +3,8 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
...
@@ -3,8 +3,8 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
const
{
balance
,
ether
,
expectRevert
,
send
}
=
require
(
'@openzeppelin/test-helpers'
);
const
{
balance
,
ether
,
expectRevert
,
send
}
=
require
(
'@openzeppelin/test-helpers'
);
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
AddressMock
=
contract
.
fromArtifact
(
'AddressMock'
);
const
AddressMock
=
contract
.
fromArtifact
(
'AddressMock
Upgradeable
'
);
const
EtherReceiver
=
contract
.
fromArtifact
(
'EtherReceiverMock'
);
const
EtherReceiver
=
contract
.
fromArtifact
(
'EtherReceiverMock
Upgradeable
'
);
describe
(
'Address'
,
function
()
{
describe
(
'Address'
,
function
()
{
const
[
recipient
,
other
]
=
accounts
;
const
[
recipient
,
other
]
=
accounts
;
...
...
test/utils/Arrays.test.js
View file @
37f74c7d
...
@@ -3,7 +3,7 @@ require('@openzeppelin/test-helpers');
...
@@ -3,7 +3,7 @@ require('@openzeppelin/test-helpers');
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
ArraysMock
=
contract
.
fromArtifact
(
'ArraysMock'
);
const
ArraysMock
=
contract
.
fromArtifact
(
'ArraysMock
Upgradeable
'
);
describe
(
'Arrays'
,
function
()
{
describe
(
'Arrays'
,
function
()
{
context
(
'Even number of elements'
,
function
()
{
context
(
'Even number of elements'
,
function
()
{
...
...
test/utils/Counters.test.js
View file @
37f74c7d
...
@@ -3,7 +3,7 @@ const { expectRevert } = require('@openzeppelin/test-helpers');
...
@@ -3,7 +3,7 @@ const { expectRevert } = require('@openzeppelin/test-helpers');
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
CountersMock
=
contract
.
fromArtifact
(
'CountersMock'
);
const
CountersMock
=
contract
.
fromArtifact
(
'CountersMock
Upgradeable
'
);
describe
(
'Counters'
,
function
()
{
describe
(
'Counters'
,
function
()
{
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
...
...
test/utils/Create2.test.js
View file @
37f74c7d
...
@@ -3,9 +3,9 @@ const { balance, BN, ether, expectRevert, send } = require('@openzeppelin/test-h
...
@@ -3,9 +3,9 @@ const { balance, BN, ether, expectRevert, send } = require('@openzeppelin/test-h
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
Create2Mock
=
contract
.
fromArtifact
(
'Create2Mock'
);
const
Create2Mock
=
contract
.
fromArtifact
(
'Create2Mock
Upgradeable
'
);
const
ERC20Mock
=
contract
.
fromArtifact
(
'ERC20Mock'
);
const
ERC20Mock
=
contract
.
fromArtifact
(
'ERC20Mock
Upgradeable
'
);
const
ERC1820Implementer
=
contract
.
fromArtifact
(
'ERC1820Implementer'
);
const
ERC1820Implementer
=
contract
.
fromArtifact
(
'ERC1820Implementer
Upgradeable
'
);
describe
(
'Create2'
,
function
()
{
describe
(
'Create2'
,
function
()
{
const
[
deployerAccount
]
=
accounts
;
const
[
deployerAccount
]
=
accounts
;
...
...
test/utils/EnumerableMap.test.js
View file @
37f74c7d
...
@@ -4,7 +4,7 @@ const { expect } = require('chai');
...
@@ -4,7 +4,7 @@ const { expect } = require('chai');
const
zip
=
require
(
'lodash.zip'
);
const
zip
=
require
(
'lodash.zip'
);
const
EnumerableMapMock
=
contract
.
fromArtifact
(
'EnumerableMapMock'
);
const
EnumerableMapMock
=
contract
.
fromArtifact
(
'EnumerableMapMock
Upgradeable
'
);
describe
(
'EnumerableMap'
,
function
()
{
describe
(
'EnumerableMap'
,
function
()
{
const
[
accountA
,
accountB
,
accountC
]
=
accounts
;
const
[
accountA
,
accountB
,
accountC
]
=
accounts
;
...
...
test/utils/EnumerableSet.test.js
View file @
37f74c7d
...
@@ -2,7 +2,7 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
...
@@ -2,7 +2,7 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
const
{
expectEvent
,
expectRevert
}
=
require
(
'@openzeppelin/test-helpers'
);
const
{
expectEvent
,
expectRevert
}
=
require
(
'@openzeppelin/test-helpers'
);
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
EnumerableSetMock
=
contract
.
fromArtifact
(
'EnumerableSetMock'
);
const
EnumerableSetMock
=
contract
.
fromArtifact
(
'EnumerableSetMock
Upgradeable
'
);
describe
(
'EnumerableSet'
,
function
()
{
describe
(
'EnumerableSet'
,
function
()
{
const
[
accountA
,
accountB
,
accountC
]
=
accounts
;
const
[
accountA
,
accountB
,
accountC
]
=
accounts
;
...
...
test/utils/Pausable.test.js
View file @
37f74c7d
...
@@ -4,7 +4,7 @@ const { expectEvent, expectRevert } = require('@openzeppelin/test-helpers');
...
@@ -4,7 +4,7 @@ const { expectEvent, expectRevert } = require('@openzeppelin/test-helpers');
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
PausableMock
=
contract
.
fromArtifact
(
'PausableMock'
);
const
PausableMock
=
contract
.
fromArtifact
(
'PausableMock
Upgradeable
'
);
describe
(
'Pausable'
,
function
()
{
describe
(
'Pausable'
,
function
()
{
const
[
pauser
]
=
accounts
;
const
[
pauser
]
=
accounts
;
...
...
test/utils/ReentrancyGuard.test.js
View file @
37f74c7d
...
@@ -3,8 +3,8 @@ const { expectRevert } = require('@openzeppelin/test-helpers');
...
@@ -3,8 +3,8 @@ const { expectRevert } = require('@openzeppelin/test-helpers');
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
ReentrancyMock
=
contract
.
fromArtifact
(
'ReentrancyMock'
);
const
ReentrancyMock
=
contract
.
fromArtifact
(
'ReentrancyMock
Upgradeable
'
);
const
ReentrancyAttack
=
contract
.
fromArtifact
(
'ReentrancyAttack'
);
const
ReentrancyAttack
=
contract
.
fromArtifact
(
'ReentrancyAttack
Upgradeable
'
);
describe
(
'ReentrancyGuard'
,
function
()
{
describe
(
'ReentrancyGuard'
,
function
()
{
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
...
...
test/utils/SafeCast.test.js
View file @
37f74c7d
...
@@ -3,7 +3,7 @@ const { BN, expectRevert } = require('@openzeppelin/test-helpers');
...
@@ -3,7 +3,7 @@ const { BN, expectRevert } = require('@openzeppelin/test-helpers');
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
SafeCastMock
=
contract
.
fromArtifact
(
'SafeCastMock'
);
const
SafeCastMock
=
contract
.
fromArtifact
(
'SafeCastMock
Upgradeable
'
);
describe
(
'SafeCast'
,
async
()
=>
{
describe
(
'SafeCast'
,
async
()
=>
{
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
...
...
test/utils/Strings.test.js
View file @
37f74c7d
...
@@ -3,7 +3,7 @@ const { constants } = require('@openzeppelin/test-helpers');
...
@@ -3,7 +3,7 @@ const { constants } = require('@openzeppelin/test-helpers');
const
{
expect
}
=
require
(
'chai'
);
const
{
expect
}
=
require
(
'chai'
);
const
StringsMock
=
contract
.
fromArtifact
(
'StringsMock'
);
const
StringsMock
=
contract
.
fromArtifact
(
'StringsMock
Upgradeable
'
);
describe
(
'Strings'
,
function
()
{
describe
(
'Strings'
,
function
()
{
beforeEach
(
async
function
()
{
beforeEach
(
async
function
()
{
...
...
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