Commit 37f74c7d by Francisco Giordano

transpile contracts

parent fd970c18
pragma solidity ^0.6.0;
import "../Initializable.sol";
/*
* @dev Provides information about the current execution context, including the
......@@ -10,10 +11,19 @@ pragma solidity ^0.6.0;
*
* This contract is only required for intermediate, library-like contracts.
*/
contract Context {
contract ContextUpgradeable is Initializable {
// Empty internal constructor, to prevent people from mistakenly deploying
// 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) {
return msg.sender;
......@@ -23,4 +33,6 @@ contract Context {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
uint256[50] private __gap;
}
......@@ -3,6 +3,7 @@ pragma solidity ^0.6.0;
import "./IRelayRecipient.sol";
import "./IRelayHub.sol";
import "./Context.sol";
import "../Initializable.sol";
/**
* @dev Base GSN recipient contract: includes the {IRelayRecipient} interface
......@@ -15,9 +16,20 @@ import "./Context.sol";
* information on how to use the pre-built {GSNRecipientSignature} and
* {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
address private _relayHub = 0xD216153c06E857cD7f72665E0aF1d7D82172F494;
address private _relayHub ;
uint256 constant private _RELAYED_CALL_ACCEPTED = 0;
uint256 constant private _RELAYED_CALL_REJECTED = 11;
......@@ -225,4 +237,6 @@ abstract contract GSNRecipient is IRelayRecipient, Context {
return actualData;
}
uint256[49] private __gap;
}
......@@ -5,6 +5,7 @@ import "../math/SafeMath.sol";
import "../access/Ownable.sol";
import "../token/ERC20/SafeERC20.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
......@@ -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
* internal {_mint} function.
*/
contract GSNRecipientERC20Fee is GSNRecipient {
contract GSNRecipientERC20FeeUpgradeable is Initializable, GSNRecipientUpgradeable {
using SafeERC20 for __unstable__ERC20Owned;
using SafeMath for uint256;
......@@ -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.
*/
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);
}
/**
* @dev Returns the gas payment token.
*/
......@@ -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
_token.safeTransfer(from, maxPossibleCharge.sub(actualCharge));
}
uint256[49] private __gap;
}
/**
......@@ -111,10 +125,26 @@ contract GSNRecipientERC20Fee is GSNRecipient {
* outside of this context.
*/
// solhint-disable-next-line contract-name-camelcase
contract __unstable__ERC20Owned is ERC20, Ownable {
contract __unstable__ERC20Owned is Initializable, ERC20Upgradeable, OwnableUpgradeable {
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
function mint(address account, uint256 amount) public onlyOwner {
......@@ -147,4 +177,6 @@ contract __unstable__ERC20Owned is ERC20, Ownable {
return super.transferFrom(sender, recipient, amount);
}
}
uint256[50] private __gap;
}
......@@ -2,6 +2,7 @@ pragma solidity ^0.6.0;
import "./GSNRecipient.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
......@@ -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
* sure to account for this in their economic and threat model.
*/
contract GSNRecipientSignature is GSNRecipient {
contract GSNRecipientSignatureUpgradeable is Initializable, GSNRecipientUpgradeable {
using ECDSA for bytes32;
address private _trustedSigner;
......@@ -21,11 +22,22 @@ contract GSNRecipientSignature is GSNRecipient {
/**
* @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");
_trustedSigner = trustedSigner;
}
/**
* @dev Ensures that only transactions with a trusted signature can be relayed through the GSN.
*/
......@@ -67,4 +79,6 @@ contract GSNRecipientSignature is GSNRecipient {
function _preRelayedCall(bytes memory) internal virtual override returns (bytes32) { }
function _postRelayedCall(bytes memory, bool, uint256, bytes32) internal virtual override { }
uint256[49] private __gap;
}
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;
}
......@@ -3,6 +3,7 @@ pragma solidity ^0.6.0;
import "../utils/EnumerableSet.sol";
import "../utils/Address.sol";
import "../GSN/Context.sol";
import "../Initializable.sol";
/**
* @dev Contract module that allows children to implement role-based access
......@@ -35,7 +36,17 @@ import "../GSN/Context.sol";
* roles. More complex role relationships can be created by using
* {_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 Address for address;
......@@ -195,4 +206,6 @@ abstract contract AccessControl is Context {
emit RoleRevoked(role, account, _msgSender());
}
}
uint256[49] private __gap;
}
pragma solidity ^0.6.0;
import "../GSN/Context.sol";
import "../Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
......@@ -13,7 +14,7 @@ import "../GSN/Context.sol";
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
contract OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
......@@ -21,12 +22,22 @@ contract Ownable is Context {
/**
* @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();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
......@@ -63,4 +74,6 @@ contract Ownable is Context {
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
uint256[49] private __gap;
}
......@@ -3,6 +3,7 @@ pragma solidity ^0.6.0;
import "../token/ERC20/SafeERC20.sol";
import "../access/Ownable.sol";
import "../math/SafeMath.sol";
import "../Initializable.sol";
/**
* @title TokenVesting
......@@ -10,7 +11,7 @@ import "../math/SafeMath.sol";
* typical vesting scheme, with a cliff and vesting period. Optionally revocable by the
* owner.
*/
contract TokenVesting is Ownable {
contract TokenVestingUpgradeable is Initializable, OwnableUpgradeable {
// 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,
// 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 {
* @param duration duration in seconds of the period in which the tokens will vest
* @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");
// solhint-disable-next-line max-line-length
require(cliffDuration <= duration, "TokenVesting: cliff is longer than duration");
......@@ -59,8 +69,10 @@ contract TokenVesting is Ownable {
_duration = duration;
_cliff = start.add(cliffDuration);
_start = start;
}
/**
* @return the beneficiary of the tokens.
*/
......@@ -171,4 +183,6 @@ contract TokenVesting is Ownable {
return totalBalance.mul(block.timestamp.sub(_start)).div(_duration);
}
}
uint256[44] private __gap;
}
pragma solidity ^0.6.0;
import "./IERC165.sol";
import "../Initializable.sol";
/**
* @dev Implementation of the {IERC165} interface.
......@@ -8,7 +9,7 @@ import "./IERC165.sol";
* Contracts may inherit from this and call {_registerInterface} to declare
* their support of an interface.
*/
contract ERC165 is IERC165 {
contract ERC165Upgradeable is Initializable, IERC165 {
/*
* bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
*/
......@@ -19,12 +20,21 @@ contract ERC165 is IERC165 {
*/
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,
// we register support for ERC165 itself here
_registerInterface(_INTERFACE_ID_ERC165);
}
/**
* @dev See {IERC165-supportsInterface}.
*
......@@ -49,4 +59,6 @@ contract ERC165 is IERC165 {
require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
_supportedInterfaces[interfaceId] = true;
}
uint256[49] private __gap;
}
pragma solidity ^0.6.0;
import "./IERC1820Implementer.sol";
import "../Initializable.sol";
/**
* @dev Implementation of the {IERC1820Implementer} interface.
......@@ -10,7 +11,16 @@ import "./IERC1820Implementer.sol";
* {IERC1820Registry-setInterfaceImplementer} should then be called for the
* 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"));
mapping(bytes32 => mapping(address => bool)) private _supportedInterfaces;
......@@ -32,4 +42,6 @@ contract ERC1820Implementer is IERC1820Implementer {
function _registerInterfaceForAddress(bytes32 interfaceHash, address account) internal virtual {
_supportedInterfaces[interfaceHash][account] = true;
}
uint256[49] private __gap;
}
pragma solidity ^0.6.0;
import "../access/AccessControl.sol";
import "../Initializable.sol";
contract AccessControlMockUpgradeable is Initializable, AccessControlUpgradeable {
constructor() public {
__AccessControlMock_init();
}
function __AccessControlMock_init() internal initializer {
__Context_init_unchained();
__AccessControl_init_unchained();
__AccessControlMock_init_unchained();
}
function __AccessControlMock_init_unchained() internal initializer {
contract AccessControlMock is AccessControl {
constructor() public {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
function setRoleAdmin(bytes32 roleId, bytes32 adminRoleId) public {
_setRoleAdmin(roleId, adminRoleId);
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
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) {
return Address.isContract(account);
}
......@@ -13,4 +27,6 @@ contract AddressMock {
// sendValue's tests require the contract to hold Ether
receive () external payable { }
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
import "../utils/Arrays.sol";
import "../Initializable.sol";
contract ArraysMock {
contract ArraysMockUpgradeable is Initializable {
using Arrays for uint256[];
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;
}
function findUpperBound(uint256 element) external view returns (uint256) {
return _array.findUpperBound(element);
}
uint256[49] private __gap;
}
pragma solidity ^0.6.0;
import "../payment/escrow/ConditionalEscrow.sol";
import "../Initializable.sol";
// 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;
function setAllowed(address payee, bool allowed) public {
......@@ -13,4 +31,6 @@ contract ConditionalEscrowMock is ConditionalEscrow {
function withdrawalAllowed(address payee) public view override returns (bool) {
return _allowed[payee];
}
uint256[49] private __gap;
}
pragma solidity ^0.6.0;
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);
function msgSender() public {
......@@ -14,14 +29,31 @@ contract ContextMock is Context {
function msgData(uint256 integerValue, string memory stringValue) public {
emit Data(_msgData(), integerValue, stringValue);
}
uint256[50] private __gap;
}
contract ContextMockCaller {
function callSender(ContextMock context) public {
contract ContextMockCallerUpgradeable is Initializable {
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();
}
function callData(ContextMock context, uint256 integerValue, string memory stringValue) public {
function callData(ContextMockUpgradeable context, uint256 integerValue, string memory stringValue) public {
context.msgData(integerValue, stringValue);
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
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;
Counters.Counter private _counter;
......@@ -18,4 +32,6 @@ contract CountersMock {
function decrement() public {
_counter.decrement();
}
uint256[49] private __gap;
}
......@@ -2,15 +2,29 @@ pragma solidity ^0.6.0;
import "../utils/Create2.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 {
Create2.deploy(value, salt, code);
}
function deployERC1820Implementer(uint256 value, bytes32 salt) public {
// solhint-disable-next-line indent
Create2.deploy(value, salt, type(ERC1820Implementer).creationCode);
Create2.deploy(value, salt, type(ERC1820ImplementerUpgradeable).creationCode);
}
function computeAddress(bytes32 salt, bytes32 codeHash) public view returns (address) {
......@@ -22,4 +36,6 @@ contract Create2Mock {
}
receive() payable external {}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
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;
function recover(bytes32 hash, bytes memory signature) public pure returns (address) {
......@@ -12,4 +26,6 @@ contract ECDSAMock {
function toEthSignedMessageHash(bytes32 hash) public pure returns (bytes32) {
return hash.toEthSignedMessageHash();
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
import "../../introspection/IERC165.sol";
import "../../Initializable.sol";
/**
* https://eips.ethereum.org/EIPS/eip-214#specification
......@@ -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)
* solidity-coverage ignores the /mocks folder, so we duplicate its implementation here to avoid instrumenting it
*/
contract SupportsInterfaceWithLookupMock is IERC165 {
contract SupportsInterfaceWithLookupMockUpgradeable is Initializable, IERC165 {
/*
* bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
*/
......@@ -27,10 +28,23 @@ contract SupportsInterfaceWithLookupMock is IERC165 {
* @dev A contract implementing SupportsInterfaceWithLookup
* 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);
}
/**
* @dev Implement supportsInterface(bytes4) using a lookup table.
*/
......@@ -45,12 +59,30 @@ contract SupportsInterfaceWithLookupMock is IERC165 {
require(interfaceId != 0xffffffff, "ERC165InterfacesSupported: invalid interface id");
_supportedInterfaces[interfaceId] = true;
}
uint256[49] private __gap;
}
contract ERC165InterfacesSupported is SupportsInterfaceWithLookupMock {
constructor (bytes4[] memory interfaceIds) public {
contract ERC165InterfacesSupportedUpgradeable is Initializable, SupportsInterfaceWithLookupMockUpgradeable {
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++) {
_registerInterface(interfaceIds[i]);
}
}
uint256[50] private __gap;
}
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;
}
pragma solidity ^0.6.0;
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;
function supportsERC165(address account) public view returns (bool) {
......@@ -16,4 +30,6 @@ contract ERC165CheckerMock {
function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) public view returns (bool) {
return account.supportsAllInterfaces(interfaceIds);
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
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 {
_registerInterface(interfaceId);
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
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 {
_registerInterfaceForAddress(interfaceHash, account);
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
import "../token/ERC20/ERC20Burnable.sol";
import "../Initializable.sol";
contract ERC20BurnableMock is ERC20Burnable {
constructor (
contract ERC20BurnableMockUpgradeable is Initializable, ERC20BurnableUpgradeable {
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 symbol,
address initialAccount,
uint256 initialBalance
) public ERC20(name, symbol) {
) internal initializer {
_mint(initialAccount, initialBalance);
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
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 {
_mint(to, tokenId);
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
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);
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
import "../token/ERC20/ERC20.sol";
import "../Initializable.sol";
// mock class using ERC20
contract ERC20Mock is ERC20 {
constructor (
contract ERC20MockUpgradeable is Initializable, ERC20Upgradeable {
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 symbol,
address initialAccount,
uint256 initialBalance
) public payable ERC20(name, symbol) {
) internal initializer {
_mint(initialAccount, initialBalance);
}
function mint(address account, uint256 amount) public {
_mint(account, amount);
}
......@@ -28,4 +54,6 @@ contract ERC20Mock is ERC20 {
function approveInternal(address owner, address spender, uint256 value) public {
_approve(owner, spender, value);
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
import "../token/ERC20/ERC20Pausable.sol";
import "../Initializable.sol";
// mock class using ERC20Pausable
contract ERC20PausableMock is ERC20Pausable {
constructor (
contract ERC20PausableMockUpgradeable is Initializable, ERC20PausableUpgradeable {
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 symbol,
address initialAccount,
uint256 initialBalance
) public ERC20(name, symbol) {
) internal initializer {
_mint(initialAccount, initialBalance);
}
function pause() external {
_pause();
}
......@@ -28,4 +56,6 @@ contract ERC20PausableMock is ERC20Pausable {
function burn(address from, uint256 amount) public {
_burn(from, amount);
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
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;
}
pragma solidity ^0.6.0;
import "../token/ERC20/ERC20Snapshot.sol";
import "../Initializable.sol";
contract ERC20SnapshotMock is ERC20Snapshot {
contract ERC20SnapshotMockUpgradeable is Initializable, ERC20SnapshotUpgradeable {
constructor(
string memory name,
string memory symbol,
address initialAccount,
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);
}
function snapshot() public {
_snapshot();
}
......@@ -24,4 +51,6 @@ contract ERC20SnapshotMock is ERC20Snapshot {
function burn(address account, uint256 amount) public {
_burn(account, amount);
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
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 {
_mint(to, tokenId);
}
uint256[50] private __gap;
}
......@@ -3,27 +3,44 @@ pragma solidity ^0.6.0;
import "../token/ERC721/ERC721.sol";
import "../GSN/GSNRecipient.sol";
import "../GSN/GSNRecipientSignature.sol";
import "../Initializable.sol";
/**
* @title ERC721GSNRecipientMock
* A simple ERC721 mock that has GSN support enabled
*/
contract ERC721GSNRecipientMock is ERC721, GSNRecipient, GSNRecipientSignature {
constructor(string memory name, string memory symbol, address trustedSigner)
public
ERC721(name, symbol)
GSNRecipientSignature(trustedSigner)
{ }
contract ERC721GSNRecipientMockUpgradeable is Initializable, ERC721Upgradeable, GSNRecipientUpgradeable, GSNRecipientSignatureUpgradeable {
constructor(string memory name, string memory symbol, address trustedSigner) public {
__ERC721GSNRecipientMock_init(name, symbol, 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 {
_mint(_msgSender(), tokenId);
}
function _msgSender() internal view override(Context, GSNRecipient) returns (address payable) {
return GSNRecipient._msgSender();
function _msgSender() internal view override(ContextUpgradeable, GSNRecipientUpgradeable) returns (address payable) {
return GSNRecipientUpgradeable._msgSender();
}
function _msgData() internal view override(Context, GSNRecipient) returns (bytes memory) {
return GSNRecipient._msgData();
function _msgData() internal view override(ContextUpgradeable, GSNRecipientUpgradeable) returns (bytes memory) {
return GSNRecipientUpgradeable._msgData();
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
import "../token/ERC721/ERC721.sol";
import "../Initializable.sol";
/**
* @title ERC721Mock
* This mock just provides a public safeMint, mint, and burn functions for testing purposes
*/
contract ERC721Mock is ERC721 {
constructor (string memory name, string memory symbol) public ERC721(name, symbol) { }
contract ERC721MockUpgradeable is Initializable, ERC721Upgradeable {
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) {
return _exists(tokenId);
......@@ -36,4 +53,6 @@ contract ERC721Mock is ERC721 {
function burn(uint256 tokenId) public {
_burn(tokenId);
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
import "../token/ERC721/ERC721Pausable.sol";
import "../Initializable.sol";
/**
* @title ERC721PausableMock
* This mock just provides a public mint, burn and exists functions for testing purposes
*/
contract ERC721PausableMock is ERC721Pausable {
constructor (string memory name, string memory symbol) public ERC721(name, symbol) { }
contract ERC721PausableMockUpgradeable is Initializable, ERC721PausableUpgradeable {
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 {
super._mint(to, tokenId);
......@@ -28,4 +47,6 @@ contract ERC721PausableMock is ERC721Pausable {
function unpause() external {
_unpause();
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
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;
}
pragma solidity ^0.6.0;
import "../token/ERC721/IERC721Receiver.sol";
import "../Initializable.sol";
contract ERC721ReceiverMock is IERC721Receiver {
contract ERC721ReceiverMockUpgradeable is Initializable, IERC721Receiver {
bytes4 private _retval;
bool private _reverts;
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;
_reverts = reverts;
}
function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data)
public override returns (bytes4)
{
......@@ -20,4 +34,6 @@ contract ERC721ReceiverMock is IERC721Receiver {
emit Received(operator, from, tokenId, data, gasleft());
return _retval;
}
uint256[49] private __gap;
}
......@@ -2,18 +2,46 @@ pragma solidity ^0.6.0;
import "../GSN/Context.sol";
import "../token/ERC777/ERC777.sol";
import "../Initializable.sol";
contract ERC777MockUpgradeable is Initializable, ContextUpgradeable, ERC777Upgradeable {
contract ERC777Mock is Context, ERC777 {
constructor(
address initialHolder,
uint256 initialBalance,
string memory name,
string memory symbol,
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, "", "");
}
function mintInternal (
address to,
uint256 amount,
......@@ -22,4 +50,6 @@ contract ERC777Mock is Context, ERC777 {
) public {
_mint(to, amount, userData, operatorData);
}
uint256[50] private __gap;
}
......@@ -6,8 +6,25 @@ import "../token/ERC777/IERC777Sender.sol";
import "../token/ERC777/IERC777Recipient.sol";
import "../introspection/IERC1820Registry.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(
address operator,
address from,
......@@ -35,7 +52,7 @@ contract ERC777SenderRecipientMock is Context, IERC777Sender, IERC777Recipient,
bool private _shouldRevertSend;
bool private _shouldRevertReceive;
IERC1820Registry private _erc1820 = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);
IERC1820Registry private _erc1820 ;
bytes32 constant private _TOKENS_SENDER_INTERFACE_HASH = keccak256("ERC777TokensSender");
bytes32 constant private _TOKENS_RECIPIENT_INTERFACE_HASH = keccak256("ERC777TokensRecipient");
......@@ -144,5 +161,7 @@ contract ERC777SenderRecipientMock is Context, IERC777Sender, IERC777Recipient,
function burn(IERC777 token, uint256 amount, bytes memory data) public {
token.burn(amount, data);
}
uint256[49] private __gap;
}
pragma solidity ^0.6.0;
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;
event OperationResult(bool result);
......@@ -35,4 +49,6 @@ contract EnumerableMapMock {
function get(uint256 key) public view returns (address) {
return _map.get(key);
}
uint256[48] private __gap;
}
pragma solidity ^0.6.0;
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;
event OperationResult(bool result);
......@@ -30,4 +44,6 @@ contract EnumerableSetMock {
function at(uint256 index) public view returns (address) {
return _set.at(index);
}
uint256[48] private __gap;
}
pragma solidity ^0.6.0;
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;
}
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;
function setAcceptEther(bool acceptEther) public {
......@@ -12,4 +26,6 @@ contract EtherReceiverMock {
revert();
}
}
uint256[49] private __gap;
}
......@@ -2,9 +2,26 @@ pragma solidity ^0.6.0;
import "../GSN/GSNRecipient.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 {
_mint(account, amount);
......@@ -15,4 +32,6 @@ contract GSNRecipientERC20FeeMock is GSNRecipient, GSNRecipientERC20Fee {
function mockFunction() public {
emit MockFunctionCalled(token().balanceOf(_msgSender()));
}
uint256[50] private __gap;
}
......@@ -2,9 +2,26 @@ pragma solidity ^0.6.0;
import "./ContextMock.sol";
import "../GSN/GSNRecipient.sol";
import "../Initializable.sol";
// 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 {
_withdrawDeposits(amount, payee);
}
......@@ -26,11 +43,13 @@ contract GSNRecipientMock is ContextMock, GSNRecipient {
return _upgradeRelayHub(newRelayHub);
}
function _msgSender() internal override(Context, GSNRecipient) view virtual returns (address payable) {
return GSNRecipient._msgSender();
function _msgSender() internal override(ContextUpgradeable, GSNRecipientUpgradeable) view virtual returns (address payable) {
return GSNRecipientUpgradeable._msgSender();
}
function _msgData() internal override(Context, GSNRecipient) view virtual returns (bytes memory) {
return GSNRecipient._msgData();
function _msgData() internal override(ContextUpgradeable, GSNRecipientUpgradeable) view virtual returns (bytes memory) {
return GSNRecipientUpgradeable._msgData();
}
uint256[50] private __gap;
}
......@@ -2,13 +2,32 @@ pragma solidity ^0.6.0;
import "../GSN/GSNRecipient.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();
function mockFunction() public {
emit MockFunctionCalled();
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
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) {
return Math.max(a, b);
}
......@@ -14,4 +28,6 @@ contract MathMock {
function average(uint256 a, uint256 b) public pure returns (uint256) {
return Math.average(a, b);
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
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) {
return MerkleProof.verify(proof, root, leaf);
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
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;
}
pragma solidity ^0.6.0;
import "../utils/Pausable.sol";
import "../Initializable.sol";
contract PausableMock is Pausable {
contract PausableMockUpgradeable is Initializable, PausableUpgradeable {
bool public drasticMeasureTaken;
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;
count = 0;
}
function normalProcess() external whenNotPaused {
count++;
}
......@@ -26,4 +42,6 @@ contract PausableMock is Pausable {
function unpause() external {
_unpause();
}
uint256[48] private __gap;
}
pragma solidity ^0.6.0;
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;
}
pragma solidity ^0.6.0;
import "../payment/PullPayment.sol";
import "../Initializable.sol";
// mock class using PullPayment
contract PullPaymentMock is PullPayment {
constructor () public payable { }
contract PullPaymentMockUpgradeable is Initializable, PullPaymentUpgradeable {
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
function callTransfer(address dest, uint256 amount) public {
_asyncTransfer(dest, amount);
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
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 {
// solhint-disable-next-line avoid-low-level-calls
(bool success,) = _msgSender().call(abi.encodeWithSelector(data));
require(success, "ReentrancyAttack: failed call");
}
uint256[50] private __gap;
}
......@@ -2,14 +2,29 @@ pragma solidity ^0.6.0;
import "../utils/ReentrancyGuard.sol";
import "./ReentrancyAttack.sol";
import "../Initializable.sol";
contract ReentrancyMock is ReentrancyGuard {
contract ReentrancyMockUpgradeable is Initializable, ReentrancyGuardUpgradeable {
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;
}
function callback() external nonReentrant {
_count();
}
......@@ -30,7 +45,7 @@ contract ReentrancyMock is ReentrancyGuard {
}
}
function countAndCall(ReentrancyAttack attacker) public nonReentrant {
function countAndCall(ReentrancyAttackUpgradeable attacker) public nonReentrant {
_count();
bytes4 func = bytes4(keccak256("callback()"));
attacker.callSender(func);
......@@ -39,4 +54,6 @@ contract ReentrancyMock is ReentrancyGuard {
function _count() private {
counter += 1;
}
uint256[49] private __gap;
}
pragma solidity ^0.6.0;
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;
}
pragma solidity ^0.6.0;
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 int;
......@@ -33,4 +47,6 @@ contract SafeCastMock {
function toUint8(uint a) public pure returns (uint8) {
return a.toUint8();
}
uint256[50] private __gap;
}
......@@ -3,8 +3,23 @@ pragma solidity ^0.6.0;
import "../GSN/Context.sol";
import "../token/ERC20/IERC20.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;
// 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 {
require(_dummy == 0); // Duummy read from a state variable so that the function is view
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;
// 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 {
function allowance(address owner, address) public view returns (uint256) {
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;
// 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 {
function allowance(address owner, address) public view returns (uint256) {
return _allowances[owner];
}
uint256[48] private __gap;
}
contract SafeERC20Mock is Context {
contract SafeERC20MockUpgradeable is Initializable, ContextUpgradeable {
using SafeERC20 for IERC20;
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;
}
function transfer() public {
_token.safeTransfer(address(0), 0);
}
......@@ -121,10 +184,12 @@ contract SafeERC20Mock is Context {
}
function setAllowance(uint256 allowance_) public {
ERC20ReturnTrueMock(address(_token)).setAllowance(allowance_);
ERC20ReturnTrueMockUpgradeable(address(_token)).setAllowance(allowance_);
}
function allowance() public view returns (uint256) {
return _token.allowance(address(0), address(0));
}
uint256[49] private __gap;
}
pragma solidity ^0.6.0;
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) {
return SafeMath.mul(a, b);
}
......@@ -22,4 +36,6 @@ contract SafeMathMock {
function mod(uint256 a, uint256 b) public pure returns (uint256) {
return SafeMath.mod(a, b);
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
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) {
return SignedSafeMath.mul(a, b);
}
......@@ -18,4 +32,6 @@ contract SignedSafeMathMock {
function add(int256 a, int256 b) public pure returns (int256) {
return SignedSafeMath.add(a, b);
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
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) {
return Strings.toString(value);
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
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;
}
......@@ -2,6 +2,7 @@ pragma solidity ^0.6.0;
import "../GSN/Context.sol";
import "../math/SafeMath.sol";
import "../Initializable.sol";
/**
* @title PaymentSplitter
......@@ -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}
* function.
*/
contract PaymentSplitter is Context {
contract PaymentSplitterUpgradeable is Initializable, ContextUpgradeable {
using SafeMath for uint256;
event PayeeAdded(address account, uint256 shares);
......@@ -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
* 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
require(payees.length == shares.length, "PaymentSplitter: payees and shares length mismatch");
require(payees.length > 0, "PaymentSplitter: no payees");
......@@ -45,8 +54,10 @@ contract PaymentSplitter is Context {
for (uint256 i = 0; i < payees.length; i++) {
_addPayee(payees[i], shares[i]);
}
}
/**
* @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
......@@ -129,4 +140,6 @@ contract PaymentSplitter is Context {
_totalShares = _totalShares.add(shares_);
emit PayeeAdded(account, shares_);
}
uint256[45] private __gap;
}
pragma solidity ^0.6.2;
import "./escrow/Escrow.sol";
import "../Initializable.sol";
/**
* @dev Simple implementation of a
......@@ -20,13 +21,22 @@ import "./escrow/Escrow.sol";
* instead of Solidity's `transfer` function. Payees can query their due
* payments with {payments}, and retrieve them with {withdrawPayments}.
*/
contract PullPayment {
Escrow private _escrow;
contract PullPaymentUpgradeable is Initializable {
EscrowUpgradeable 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.
*
......@@ -68,4 +78,6 @@ contract PullPayment {
// https://github.com/protofire/solhint/issues/170 is fixed
_escrow.deposit{ value: amount }(dest);
}
uint256[49] private __gap;
}
pragma solidity ^0.6.0;
import "./Escrow.sol";
import "../../Initializable.sol";
/**
* @title ConditionalEscrow
* @dev Base abstract escrow to only allow withdrawal if a condition is met.
* @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
* implemented by derived contracts.
......@@ -19,4 +32,6 @@ abstract contract ConditionalEscrow is Escrow {
require(withdrawalAllowed(payee), "ConditionalEscrow: payee is not allowed to withdraw");
super.withdraw(payee);
}
uint256[50] private __gap;
}
......@@ -3,6 +3,7 @@ pragma solidity ^0.6.0;
import "../../math/SafeMath.sol";
import "../../access/Ownable.sol";
import "../../utils/Address.sol";
import "../../Initializable.sol";
/**
* @title Escrow
......@@ -17,7 +18,22 @@ import "../../utils/Address.sol";
* payment method should be its owner, and provide public methods redirecting
* 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 Address for address payable;
......@@ -60,4 +76,6 @@ contract Escrow is Ownable {
emit Withdrawn(payee, payment);
}
uint256[49] private __gap;
}
pragma solidity ^0.6.0;
import "./ConditionalEscrow.sol";
import "../../Initializable.sol";
/**
* @title RefundEscrow
......@@ -12,7 +13,7 @@ import "./ConditionalEscrow.sol";
* withdrawal by the beneficiary, or refunds to the depositors. All interactions
* with `RefundEscrow` will be made through the owner contract.
*/
contract RefundEscrow is ConditionalEscrow {
contract RefundEscrowUpgradeable is Initializable, ConditionalEscrowUpgradeable {
enum State { Active, Refunding, Closed }
event RefundsClosed();
......@@ -25,12 +26,25 @@ contract RefundEscrow is ConditionalEscrow {
* @dev Constructor.
* @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");
_beneficiary = beneficiary;
_state = State.Active;
}
/**
* @return The current state of the escrow.
*/
......@@ -88,4 +102,6 @@ contract RefundEscrow is ConditionalEscrow {
function withdrawalAllowed(address) public view override returns (bool) {
return _state == State.Refunding;
}
uint256[49] private __gap;
}
......@@ -5,6 +5,7 @@ import "../GSN/Context.sol";
import "../token/ERC20/ERC20.sol";
import "../token/ERC20/ERC20Burnable.sol";
import "../token/ERC20/ERC20Pausable.sol";
import "../Initializable.sol";
/**
* @dev {ERC20} token, including:
......@@ -20,7 +21,7 @@ import "../token/ERC20/ERC20Pausable.sol";
* roles, as well as the default admin role, which will let it grant both minter
* and pauser roles to aother accounts
*/
contract ERC20PresetMinterPauser is Context, AccessControl, ERC20Burnable, ERC20Pausable {
contract ERC20PresetMinterPauserUpgradeable is Initializable, ContextUpgradeable, AccessControlUpgradeable, ERC20BurnableUpgradeable, ERC20PausableUpgradeable {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
......@@ -30,13 +31,32 @@ contract ERC20PresetMinterPauser is Context, AccessControl, ERC20Burnable, ERC20
*
* 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(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
}
/**
* @dev Creates `amount` new tokens for `to`.
*
......@@ -79,7 +99,9 @@ contract ERC20PresetMinterPauser is Context, AccessControl, ERC20Burnable, ERC20
_unpause();
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal override(ERC20, ERC20Pausable) {
function _beforeTokenTransfer(address from, address to, uint256 amount) internal override(ERC20Upgradeable, ERC20PausableUpgradeable) {
super._beforeTokenTransfer(from, to, amount);
}
uint256[50] private __gap;
}
......@@ -6,6 +6,7 @@ import "../utils/Counters.sol";
import "../token/ERC721/ERC721.sol";
import "../token/ERC721/ERC721Burnable.sol";
import "../token/ERC721/ERC721Pausable.sol";
import "../Initializable.sol";
/**
* @dev {ERC721} token, including:
......@@ -22,7 +23,7 @@ import "../token/ERC721/ERC721Pausable.sol";
* roles, as well as the default admin role, which will let it grant both minter
* and pauser roles to aother accounts
*/
contract ERC721PresetMinterPauserAutoId is Context, AccessControl, ERC721Burnable, ERC721Pausable {
contract ERC721PresetMinterPauserAutoIdUpgradeable is Initializable, ContextUpgradeable, AccessControlUpgradeable, ERC721BurnableUpgradeable, ERC721PausableUpgradeable {
using Counters for Counters.Counter;
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
......@@ -37,15 +38,35 @@ contract ERC721PresetMinterPauserAutoId is Context, AccessControl, ERC721Burnabl
* Token URIs will be autogenerated based on `baseURI` and their token IDs.
* 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(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
_setBaseURI(baseURI);
}
/**
* @dev Creates a new token for `to`. Its token ID will be automatically
* assigned (and available on the emitted {Transfer} event), and the token
......@@ -94,7 +115,9 @@ contract ERC721PresetMinterPauserAutoId is Context, AccessControl, ERC721Burnabl
_unpause();
}
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override(ERC721, ERC721Pausable) {
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override(ERC721Upgradeable, ERC721PausableUpgradeable) {
super._beforeTokenTransfer(from, to, tokenId);
}
uint256[49] private __gap;
}
......@@ -4,6 +4,7 @@ import "../../GSN/Context.sol";
import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";
import "../../Initializable.sol";
/**
* @dev Implementation of the {IERC20} interface.
......@@ -29,7 +30,7 @@ import "../../utils/Address.sol";
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20 {
contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20 {
using SafeMath for uint256;
using Address for address;
......@@ -52,12 +53,22 @@ contract ERC20 is Context, IERC20 {
* All three of these values are immutable: they can only be set once during
* 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;
_symbol = symbol;
_decimals = 18;
}
/**
* @dev Returns the name of the token.
*/
......@@ -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].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
uint256[44] private __gap;
}
......@@ -2,13 +2,24 @@ pragma solidity ^0.6.0;
import "../../GSN/Context.sol";
import "./ERC20.sol";
import "../../Initializable.sol";
/**
* @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
* 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.
*
......@@ -35,4 +46,6 @@ abstract contract ERC20Burnable is Context, ERC20 {
_approve(account, _msgSender(), decreasedAllowance);
_burn(account, amount);
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
import "./ERC20.sol";
import "../../Initializable.sol";
/**
* @dev Extension of {ERC20} that adds a cap to the supply of tokens.
*/
abstract contract ERC20Capped is ERC20 {
abstract contract ERC20CappedUpgradeable is Initializable, ERC20Upgradeable {
uint256 private _cap;
/**
* @dev Sets the value of the `cap`. This value is immutable, it can only be
* 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");
_cap = cap;
}
/**
* @dev Returns the cap on the token's total supply.
*/
......@@ -38,4 +49,6 @@ abstract contract ERC20Capped is ERC20 {
require(totalSupply().add(amount) <= _cap, "ERC20Capped: cap exceeded");
}
}
uint256[49] private __gap;
}
......@@ -2,6 +2,7 @@ pragma solidity ^0.6.0;
import "./ERC20.sol";
import "../../utils/Pausable.sol";
import "../../Initializable.sol";
/**
* @dev ERC20 token with pausable token transfers, minting and burning.
......@@ -10,7 +11,18 @@ import "../../utils/Pausable.sol";
* period, or having an emergency switch for freezing all token transfers in the
* 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}.
*
......@@ -23,4 +35,6 @@ abstract contract ERC20Pausable is ERC20, Pausable {
require(!paused(), "ERC20Pausable: token transfer while paused");
}
uint256[50] private __gap;
}
......@@ -4,6 +4,7 @@ import "../../math/SafeMath.sol";
import "../../utils/Arrays.sol";
import "../../utils/Counters.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
......@@ -29,7 +30,17 @@ import "./ERC20.sol";
* 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.
*/
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:
// https://github.com/Giveth/minimd/blob/ea04d950eea153a04c51fa510b068b9dded390cb/contracts/MiniMeToken.sol
......@@ -179,4 +190,6 @@ abstract contract ERC20Snapshot is ERC20 {
return ids[ids.length - 1];
}
}
uint256[46] private __gap;
}
pragma solidity ^0.6.0;
import "./SafeERC20.sol";
import "../../Initializable.sol";
/**
* @dev A token holder contract that will allow a beneficiary to extract the
......@@ -11,7 +12,7 @@ import "./SafeERC20.sol";
*
* For a more complete vesting schedule, see {TokenVesting}.
*/
contract TokenTimelock {
contract TokenTimelockUpgradeable is Initializable {
using SafeERC20 for IERC20;
// ERC20 basic token contract being held
......@@ -23,14 +24,23 @@ contract TokenTimelock {
// timestamp when token release is enabled
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
require(releaseTime > block.timestamp, "TokenTimelock: release time is before current time");
_token = token;
_beneficiary = beneficiary;
_releaseTime = releaseTime;
}
/**
* @return the token being held.
*/
......@@ -64,4 +74,6 @@ contract TokenTimelock {
_token.safeTransfer(_beneficiary, amount);
}
uint256[47] private __gap;
}
......@@ -11,12 +11,13 @@ import "../../utils/Address.sol";
import "../../utils/EnumerableSet.sol";
import "../../utils/EnumerableMap.sol";
import "../../utils/Strings.sol";
import "../../Initializable.sol";
/**
* @title ERC721 Non-Fungible Token Standard basic implementation
* @dev see https://eips.ethereum.org/EIPS/eip-721
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721, IERC721Metadata, IERC721Enumerable {
using SafeMath for uint256;
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
......@@ -85,7 +86,16 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
*/
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;
_symbol = symbol;
......@@ -93,8 +103,10 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
_registerInterface(_INTERFACE_ID_ERC721);
_registerInterface(_INTERFACE_ID_ERC721_METADATA);
_registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
}
/**
* @dev Gets the balance of the specified address.
* @param owner address to query the balance of
......@@ -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].
*/
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }
uint256[41] private __gap;
}
......@@ -2,12 +2,24 @@ pragma solidity ^0.6.0;
import "../../GSN/Context.sol";
import "./ERC721.sol";
import "../../Initializable.sol";
/**
* @title ERC721 Burnable Token
* @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.
* @param tokenId uint256 id of the ERC721 token to be burned.
......@@ -17,4 +29,6 @@ abstract contract ERC721Burnable is Context, ERC721 {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
_burn(tokenId);
}
uint256[50] private __gap;
}
pragma solidity ^0.6.0;
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) {
return this.onERC721Received.selector;
}
uint256[50] private __gap;
}
......@@ -2,6 +2,7 @@ pragma solidity ^0.6.0;
import "./ERC721.sol";
import "../../utils/Pausable.sol";
import "../../Initializable.sol";
/**
* @dev ERC721 token with pausable token transfers, minting and burning.
......@@ -10,7 +11,19 @@ import "../../utils/Pausable.sol";
* period, or having an emergency switch for freezing all token transfers in the
* 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}.
*
......@@ -23,4 +36,6 @@ abstract contract ERC721Pausable is ERC721, Pausable {
require(!paused(), "ERC721Pausable: token transfer while paused");
}
uint256[50] private __gap;
}
......@@ -8,6 +8,7 @@ import "../../token/ERC20/IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";
import "../../introspection/IERC1820Registry.sol";
import "../../Initializable.sol";
/**
* @dev Implementation of the {IERC777} interface.
......@@ -24,7 +25,7 @@ import "../../introspection/IERC1820Registry.sol";
* are no special restrictions in the amount of tokens that created, moved, or
* destroyed. This makes integration with ERC20 applications seamless.
*/
contract ERC777 is Context, IERC777, IERC20 {
contract ERC777Upgradeable is Initializable, ContextUpgradeable, IERC777, IERC20 {
using SafeMath for uint256;
using Address for address;
......@@ -64,11 +65,23 @@ contract ERC777 is Context, IERC777, IERC20 {
/**
* @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 symbol,
address[] memory defaultOperators
) public {
) internal initializer {
_name = name;
_symbol = symbol;
......@@ -80,8 +93,10 @@ contract ERC777 is Context, IERC777, IERC20 {
// register interfaces
_ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256("ERC777Token"), address(this));
_ERC1820_REGISTRY.setInterfaceImplementer(address(this), keccak256("ERC20Token"), address(this));
}
/**
* @dev See {IERC777-name}.
*/
......@@ -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].
*/
function _beforeTokenTransfer(address operator, address from, address to, uint256 tokenId) internal virtual { }
uint256[41] private __gap;
}
pragma solidity ^0.6.0;
import "../GSN/Context.sol";
import "../Initializable.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
......@@ -11,7 +12,7 @@ import "../GSN/Context.sol";
* 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.
*/
contract Pausable is Context {
contract PausableUpgradeable is Initializable, ContextUpgradeable {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
......@@ -27,10 +28,20 @@ contract Pausable is Context {
/**
* @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;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
......@@ -69,4 +80,6 @@ contract Pausable is Context {
_paused = false;
emit Unpaused(_msgSender());
}
uint256[49] private __gap;
}
pragma solidity ^0.6.0;
import "../Initializable.sol";
/**
* @dev Contract module that helps prevent reentrant calls to a function.
......@@ -16,10 +17,17 @@ pragma solidity ^0.6.0;
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
contract ReentrancyGuard {
contract ReentrancyGuardUpgradeable is Initializable {
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
// expensive, but in exchange the refund on every call to nonReentrant
// will be lower in amount. Since refunds are capped to a percetange of
......@@ -27,8 +35,10 @@ contract ReentrancyGuard {
// like this one, to increase the likelihood of the full refund coming
// into effect.
_notEntered = true;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
......@@ -49,4 +59,6 @@ contract ReentrancyGuard {
// https://eips.ethereum.org/EIPS/eip-2200)
_notEntered = true;
}
uint256[49] private __gap;
}
......@@ -2,7 +2,7 @@ const { contract } = require('@openzeppelin/test-environment');
const { BN, expectEvent } = require('@openzeppelin/test-helpers');
const ContextMock = contract.fromArtifact('ContextMock');
const ContextMock = contract.fromArtifact('ContextMockUpgradeable');
function shouldBehaveLikeRegularContext (sender) {
describe('msgSender', function () {
......
......@@ -2,8 +2,8 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
require('@openzeppelin/test-helpers');
const ContextMock = contract.fromArtifact('ContextMock');
const ContextMockCaller = contract.fromArtifact('ContextMockCaller');
const ContextMock = contract.fromArtifact('ContextMockUpgradeable');
const ContextMockCaller = contract.fromArtifact('ContextMockCallerUpgradeable');
const { shouldBehaveLikeRegularContext } = require('./Context.behavior');
......
......@@ -6,7 +6,7 @@ const gsn = require('@openzeppelin/gsn-helpers');
const { fixSignature } = require('../helpers/sign');
const { utils: { toBN } } = require('web3');
const ERC721GSNRecipientMock = contract.fromArtifact('ERC721GSNRecipientMock');
const ERC721GSNRecipientMock = contract.fromArtifact('ERC721GSNRecipientMockUpgradeable');
describe('ERC721GSNRecipient (integration)', function () {
const [ signer, sender ] = accounts;
......
......@@ -7,8 +7,8 @@ const gsn = require('@openzeppelin/gsn-helpers');
const { expect } = require('chai');
const GSNRecipientMock = contract.fromArtifact('GSNRecipientMock');
const ContextMockCaller = contract.fromArtifact('ContextMockCaller');
const GSNRecipientMock = contract.fromArtifact('GSNRecipientMockUpgradeable');
const ContextMockCaller = contract.fromArtifact('ContextMockCallerUpgradeable');
const { shouldBehaveLikeRegularContext } = require('./Context.behavior');
......
......@@ -5,8 +5,8 @@ const gsn = require('@openzeppelin/gsn-helpers');
const { expect } = require('chai');
const GSNRecipientERC20FeeMock = contract.fromArtifact('GSNRecipientERC20FeeMock');
const ERC20 = contract.fromArtifact('ERC20');
const GSNRecipientERC20FeeMock = contract.fromArtifact('GSNRecipientERC20FeeMockUpgradeable');
const ERC20 = contract.fromArtifact('ERC20Upgradeable');
const IRelayHub = contract.fromArtifact('IRelayHub');
describe('GSNRecipientERC20Fee', function () {
......
......@@ -6,7 +6,7 @@ const { fixSignature } = require('../helpers/sign');
const { utils: { toBN } } = require('web3');
const { ZERO_ADDRESS } = constants;
const GSNRecipientSignatureMock = contract.fromArtifact('GSNRecipientSignatureMock');
const GSNRecipientSignatureMock = contract.fromArtifact('GSNRecipientSignatureMockUpgradeable');
describe('GSNRecipientSignature', function () {
const [ signer, other ] = accounts;
......
......@@ -4,7 +4,7 @@ const { expectEvent, expectRevert } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');
const AccessControlMock = contract.fromArtifact('AccessControlMock');
const AccessControlMock = contract.fromArtifact('AccessControlMockUpgradeable');
describe('AccessControl', function () {
const [ admin, authorized, otherAuthorized, other, otherAdmin ] = accounts;
......
......@@ -4,7 +4,7 @@ const { ZERO_ADDRESS } = constants;
const { expect } = require('chai');
const Ownable = contract.fromArtifact('OwnableMock');
const Ownable = contract.fromArtifact('OwnableMockUpgradeable');
describe('Ownable', function () {
const [ owner, other ] = accounts;
......
......@@ -5,7 +5,7 @@ const { toEthSignedMessageHash, fixSignature } = require('../helpers/sign');
const { expect } = require('chai');
const ECDSAMock = contract.fromArtifact('ECDSAMock');
const ECDSAMock = contract.fromArtifact('ECDSAMockUpgradeable');
const TEST_MESSAGE = web3.utils.sha3('OpenZeppelin');
const WRONG_MESSAGE = web3.utils.sha3('Nope');
......
......@@ -7,7 +7,7 @@ const { keccak256, bufferToHex } = require('ethereumjs-util');
const { expect } = require('chai');
const MerkleProofWrapper = contract.fromArtifact('MerkleProofWrapper');
const MerkleProofWrapper = contract.fromArtifact('MerkleProofWrapperUpgradeable');
describe('MerkleProof', function () {
beforeEach(async function () {
......
......@@ -3,7 +3,7 @@ const { expectRevert } = require('@openzeppelin/test-helpers');
const { shouldSupportInterfaces } = require('./SupportsInterface.behavior');
const ERC165Mock = contract.fromArtifact('ERC165Mock');
const ERC165Mock = contract.fromArtifact('ERC165MockUpgradeable');
describe('ERC165', function () {
beforeEach(async function () {
......
......@@ -3,9 +3,9 @@ require('@openzeppelin/test-helpers');
const { expect } = require('chai');
const ERC165CheckerMock = contract.fromArtifact('ERC165CheckerMock');
const ERC165NotSupported = contract.fromArtifact('ERC165NotSupported');
const ERC165InterfacesSupported = contract.fromArtifact('ERC165InterfacesSupported');
const ERC165CheckerMock = contract.fromArtifact('ERC165CheckerMockUpgradeable');
const ERC165NotSupported = contract.fromArtifact('ERC165NotSupportedUpgradeable');
const ERC165InterfacesSupported = contract.fromArtifact('ERC165InterfacesSupportedUpgradeable');
const DUMMY_ID = '0xdeadbeef';
const DUMMY_ID_2 = '0xcafebabe';
......
......@@ -5,7 +5,7 @@ const { bufferToHex, keccak256 } = require('ethereumjs-util');
const { expect } = require('chai');
const ERC1820ImplementerMock = contract.fromArtifact('ERC1820ImplementerMock');
const ERC1820ImplementerMock = contract.fromArtifact('ERC1820ImplementerMockUpgradeable');
describe('ERC1820Implementer', function () {
const [ registryFunder, implementee, other ] = accounts;
......
......@@ -3,7 +3,7 @@ const { BN } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');
const MathMock = contract.fromArtifact('MathMock');
const MathMock = contract.fromArtifact('MathMockUpgradeable');
describe('Math', function () {
const min = new BN('1234');
......
......@@ -4,7 +4,7 @@ const { MAX_UINT256 } = constants;
const { expect } = require('chai');
const SafeMathMock = contract.fromArtifact('SafeMathMock');
const SafeMathMock = contract.fromArtifact('SafeMathMockUpgradeable');
describe('SafeMath', function () {
beforeEach(async function () {
......
......@@ -5,7 +5,7 @@ const { MAX_INT256, MIN_INT256 } = constants;
const { expect } = require('chai');
const SignedSafeMathMock = contract.fromArtifact('SignedSafeMathMock');
const SignedSafeMathMock = contract.fromArtifact('SignedSafeMathMockUpgradeable');
describe('SignedSafeMath', function () {
beforeEach(async function () {
......
......@@ -5,7 +5,7 @@ const { ZERO_ADDRESS } = constants;
const { expect } = require('chai');
const PaymentSplitter = contract.fromArtifact('PaymentSplitterMock');
const PaymentSplitter = contract.fromArtifact('PaymentSplitterMockUpgradeable');
describe('PaymentSplitter', function () {
const [ owner, payee1, payee2, payee3, nonpayee1, payer1 ] = accounts;
......
......@@ -4,7 +4,7 @@ const { balance, ether } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');
const PullPaymentMock = contract.fromArtifact('PullPaymentMock');
const PullPaymentMock = contract.fromArtifact('PullPaymentMockUpgradeable');
describe('PullPayment', function () {
const [ payer, payee1, payee2 ] = accounts;
......
......@@ -3,7 +3,7 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
const { ether, expectRevert } = require('@openzeppelin/test-helpers');
const { shouldBehaveLikeEscrow } = require('./Escrow.behavior');
const ConditionalEscrowMock = contract.fromArtifact('ConditionalEscrowMock');
const ConditionalEscrowMock = contract.fromArtifact('ConditionalEscrowMockUpgradeable');
describe('ConditionalEscrow', function () {
const [ owner, payee, ...otherAccounts ] = accounts;
......
......@@ -3,7 +3,7 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
require('@openzeppelin/test-helpers');
const { shouldBehaveLikeEscrow } = require('./Escrow.behavior');
const Escrow = contract.fromArtifact('EscrowMock');
const Escrow = contract.fromArtifact('EscrowMockUpgradeable');
describe('Escrow', function () {
const [ owner, ...otherAccounts ] = accounts;
......
......@@ -5,7 +5,7 @@ const { ZERO_ADDRESS } = constants;
const { expect } = require('chai');
const RefundEscrow = contract.fromArtifact('RefundEscrowMock');
const RefundEscrow = contract.fromArtifact('RefundEscrowMockUpgradeable');
describe('RefundEscrow', function () {
const [ owner, beneficiary, refundee1, refundee2 ] = accounts;
......
......@@ -5,7 +5,7 @@ const { ZERO_ADDRESS } = constants;
const { expect } = require('chai');
const ERC20PresetMinterPauser = contract.fromArtifact('ERC20PresetMinterPauserMock');
const ERC20PresetMinterPauser = contract.fromArtifact('ERC20PresetMinterPauserMockUpgradeable');
describe('ERC20PresetMinterPauser', function () {
const [ deployer, other ] = accounts;
......
......@@ -5,7 +5,7 @@ const { ZERO_ADDRESS } = constants;
const { expect } = require('chai');
const ERC721PresetMinterPauserAutoId = contract.fromArtifact('ERC721PresetMinterPauserAutoIdMock');
const ERC721PresetMinterPauserAutoId = contract.fromArtifact('ERC721PresetMinterPauserAutoIdMockUpgradeable');
describe('ERC721PresetMinterPauserAutoId', function () {
const [ deployer, other ] = accounts;
......
......@@ -10,8 +10,8 @@ const {
shouldBehaveLikeERC20Approve,
} = require('./ERC20.behavior');
const ERC20Mock = contract.fromArtifact('ERC20Mock');
const ERC20DecimalsMock = contract.fromArtifact('ERC20DecimalsMock');
const ERC20Mock = contract.fromArtifact('ERC20MockUpgradeable');
const ERC20DecimalsMock = contract.fromArtifact('ERC20DecimalsMockUpgradeable');
describe('ERC20', function () {
const [ initialHolder, recipient, anotherAccount ] = accounts;
......
......@@ -3,7 +3,7 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
const { BN } = require('@openzeppelin/test-helpers');
const { shouldBehaveLikeERC20Burnable } = require('./behaviors/ERC20Burnable.behavior');
const ERC20BurnableMock = contract.fromArtifact('ERC20BurnableMock');
const ERC20BurnableMock = contract.fromArtifact('ERC20BurnableMockUpgradeable');
describe('ERC20Burnable', function () {
const [ owner, ...otherAccounts ] = accounts;
......
......@@ -3,7 +3,7 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
const { BN, ether, expectRevert } = require('@openzeppelin/test-helpers');
const { shouldBehaveLikeERC20Capped } = require('./behaviors/ERC20Capped.behavior');
const ERC20Capped = contract.fromArtifact('ERC20CappedMock');
const ERC20Capped = contract.fromArtifact('ERC20CappedMockUpgradeable');
describe('ERC20Capped', function () {
const [ minter, ...otherAccounts ] = accounts;
......
......@@ -4,7 +4,7 @@ const { BN, expectRevert } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');
const ERC20PausableMock = contract.fromArtifact('ERC20PausableMock');
const ERC20PausableMock = contract.fromArtifact('ERC20PausableMockUpgradeable');
describe('ERC20Pausable', function () {
const [ holder, recipient, anotherAccount ] = accounts;
......
const { accounts, contract } = require('@openzeppelin/test-environment');
const { BN, expectEvent, expectRevert } = require('@openzeppelin/test-helpers');
const ERC20SnapshotMock = contract.fromArtifact('ERC20SnapshotMock');
const ERC20SnapshotMock = contract.fromArtifact('ERC20SnapshotMockUpgradeable');
const { expect } = require('chai');
......
......@@ -2,10 +2,10 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
const { expectRevert } = require('@openzeppelin/test-helpers');
const ERC20ReturnFalseMock = contract.fromArtifact('ERC20ReturnFalseMock');
const ERC20ReturnTrueMock = contract.fromArtifact('ERC20ReturnTrueMock');
const ERC20NoReturnMock = contract.fromArtifact('ERC20NoReturnMock');
const SafeERC20Mock = contract.fromArtifact('SafeERC20Mock');
const ERC20ReturnFalseMock = contract.fromArtifact('ERC20ReturnFalseMockUpgradeable');
const ERC20ReturnTrueMock = contract.fromArtifact('ERC20ReturnTrueMockUpgradeable');
const ERC20NoReturnMock = contract.fromArtifact('ERC20NoReturnMockUpgradeable');
const SafeERC20Mock = contract.fromArtifact('SafeERC20MockUpgradeable');
describe('SafeERC20', function () {
const [ hasNoCode ] = accounts;
......
......@@ -4,8 +4,8 @@ const { BN, expectRevert, time } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');
const ERC20Mock = contract.fromArtifact('ERC20Mock');
const TokenTimelock = contract.fromArtifact('TokenTimelockMock');
const ERC20Mock = contract.fromArtifact('ERC20MockUpgradeable');
const TokenTimelock = contract.fromArtifact('TokenTimelockMockUpgradeable');
describe('TokenTimelock', function () {
const [ beneficiary ] = accounts;
......
......@@ -7,8 +7,8 @@ const { expect } = require('chai');
const { shouldSupportInterfaces } = require('../../introspection/SupportsInterface.behavior');
const ERC721Mock = contract.fromArtifact('ERC721Mock');
const ERC721ReceiverMock = contract.fromArtifact('ERC721ReceiverMock');
const ERC721Mock = contract.fromArtifact('ERC721MockUpgradeable');
const ERC721ReceiverMock = contract.fromArtifact('ERC721ReceiverMockUpgradeable');
describe('ERC721', function () {
const [owner, newOwner, approved, anotherApproved, operator, other] = accounts;
......
......@@ -5,7 +5,7 @@ const { ZERO_ADDRESS } = constants;
const { expect } = require('chai');
const ERC721BurnableMock = contract.fromArtifact('ERC721BurnableMock');
const ERC721BurnableMock = contract.fromArtifact('ERC721BurnableMockUpgradeable');
describe('ERC721Burnable', function () {
const [owner, approved] = accounts;
......
......@@ -4,8 +4,8 @@ const { BN } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');
const ERC721Holder = contract.fromArtifact('ERC721Holder');
const ERC721Mock = contract.fromArtifact('ERC721Mock');
const ERC721Holder = contract.fromArtifact('ERC721HolderUpgradeable');
const ERC721Mock = contract.fromArtifact('ERC721MockUpgradeable');
describe('ERC721Holder', function () {
const [ owner ] = accounts;
......
......@@ -5,7 +5,7 @@ const { ZERO_ADDRESS } = constants;
const { expect } = require('chai');
const ERC721PausableMock = contract.fromArtifact('ERC721PausableMock');
const ERC721PausableMock = contract.fromArtifact('ERC721PausableMockUpgradeable');
describe('ERC721Pausable', function () {
const [ owner, receiver, operator ] = accounts;
......
......@@ -4,7 +4,7 @@ const { ZERO_ADDRESS } = constants;
const { expect } = require('chai');
const ERC777SenderRecipientMock = contract.fromArtifact('ERC777SenderRecipientMock');
const ERC777SenderRecipientMock = contract.fromArtifact('ERC777SenderRecipientMockUpgradeable');
function shouldBehaveLikeERC777DirectSendBurn (holder, recipient, data) {
shouldBehaveLikeERC777DirectSend(holder, recipient, data);
......
......@@ -17,8 +17,8 @@ const {
shouldBehaveLikeERC20,
} = require('../ERC20/ERC20.behavior');
const ERC777 = contract.fromArtifact('ERC777Mock');
const ERC777SenderRecipientMock = contract.fromArtifact('ERC777SenderRecipientMock');
const ERC777 = contract.fromArtifact('ERC777MockUpgradeable');
const ERC777SenderRecipientMock = contract.fromArtifact('ERC777SenderRecipientMockUpgradeable');
describe('ERC777', function () {
const [ registryFunder, holder, defaultOperatorA, defaultOperatorB, newOperator, anyone ] = accounts;
......
......@@ -3,8 +3,8 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
const { balance, ether, expectRevert, send } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');
const AddressMock = contract.fromArtifact('AddressMock');
const EtherReceiver = contract.fromArtifact('EtherReceiverMock');
const AddressMock = contract.fromArtifact('AddressMockUpgradeable');
const EtherReceiver = contract.fromArtifact('EtherReceiverMockUpgradeable');
describe('Address', function () {
const [ recipient, other ] = accounts;
......
......@@ -3,7 +3,7 @@ require('@openzeppelin/test-helpers');
const { expect } = require('chai');
const ArraysMock = contract.fromArtifact('ArraysMock');
const ArraysMock = contract.fromArtifact('ArraysMockUpgradeable');
describe('Arrays', function () {
context('Even number of elements', function () {
......
......@@ -3,7 +3,7 @@ const { expectRevert } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');
const CountersMock = contract.fromArtifact('CountersMock');
const CountersMock = contract.fromArtifact('CountersMockUpgradeable');
describe('Counters', function () {
beforeEach(async function () {
......
......@@ -3,9 +3,9 @@ const { balance, BN, ether, expectRevert, send } = require('@openzeppelin/test-h
const { expect } = require('chai');
const Create2Mock = contract.fromArtifact('Create2Mock');
const ERC20Mock = contract.fromArtifact('ERC20Mock');
const ERC1820Implementer = contract.fromArtifact('ERC1820Implementer');
const Create2Mock = contract.fromArtifact('Create2MockUpgradeable');
const ERC20Mock = contract.fromArtifact('ERC20MockUpgradeable');
const ERC1820Implementer = contract.fromArtifact('ERC1820ImplementerUpgradeable');
describe('Create2', function () {
const [deployerAccount] = accounts;
......
......@@ -4,7 +4,7 @@ const { expect } = require('chai');
const zip = require('lodash.zip');
const EnumerableMapMock = contract.fromArtifact('EnumerableMapMock');
const EnumerableMapMock = contract.fromArtifact('EnumerableMapMockUpgradeable');
describe('EnumerableMap', function () {
const [ accountA, accountB, accountC ] = accounts;
......
......@@ -2,7 +2,7 @@ const { accounts, contract } = require('@openzeppelin/test-environment');
const { expectEvent, expectRevert } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');
const EnumerableSetMock = contract.fromArtifact('EnumerableSetMock');
const EnumerableSetMock = contract.fromArtifact('EnumerableSetMockUpgradeable');
describe('EnumerableSet', function () {
const [ accountA, accountB, accountC ] = accounts;
......
......@@ -4,7 +4,7 @@ const { expectEvent, expectRevert } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');
const PausableMock = contract.fromArtifact('PausableMock');
const PausableMock = contract.fromArtifact('PausableMockUpgradeable');
describe('Pausable', function () {
const [ pauser ] = accounts;
......
......@@ -3,8 +3,8 @@ const { expectRevert } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');
const ReentrancyMock = contract.fromArtifact('ReentrancyMock');
const ReentrancyAttack = contract.fromArtifact('ReentrancyAttack');
const ReentrancyMock = contract.fromArtifact('ReentrancyMockUpgradeable');
const ReentrancyAttack = contract.fromArtifact('ReentrancyAttackUpgradeable');
describe('ReentrancyGuard', function () {
beforeEach(async function () {
......
......@@ -3,7 +3,7 @@ const { BN, expectRevert } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');
const SafeCastMock = contract.fromArtifact('SafeCastMock');
const SafeCastMock = contract.fromArtifact('SafeCastMockUpgradeable');
describe('SafeCast', async () => {
beforeEach(async function () {
......
......@@ -3,7 +3,7 @@ const { constants } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');
const StringsMock = contract.fromArtifact('StringsMock');
const StringsMock = contract.fromArtifact('StringsMockUpgradeable');
describe('Strings', function () {
beforeEach(async function () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment