From 0ac92325ec48a4e300a2e846b721ba5cb6ddf00a Mon Sep 17 00:00:00 2001 From: Peter Emil Jensen Date: Tue, 15 Jan 2019 15:56:43 +0100 Subject: [PATCH] Renamed TokenX -> EToken (#67) * Renamed TokenX to EToken * a -> an before EToken * Renamed README.md to match branch --- README.md | 14 ++--- contracts/TokenManager.sol | 48 ++++++++--------- contracts/mocks/TokenXExplicitSenderMock.sol | 12 ++--- contracts/mocks/TokenXMock.sol | 14 ++--- contracts/token/{TokenX.sol => EToken.sol} | 22 ++++---- ...citSender.sol => ETokenExplicitSender.sol} | 54 +++++++++---------- contracts/token/{ITokenX.sol => IEToken.sol} | 10 ++-- ...adableTokenX.sol => IUpgradableEToken.sol} | 2 +- docs/images/class_diagram.svg | 2 +- docs/images/contracts_overview.svg | 2 +- migrations/4_setup_accounts.js | 4 +- package.json | 4 +- scripts/upgradeToken/upgradeTokenWrapper.js | 6 +-- test/UpgradeToken.test.js | 6 +-- .../{TokenX.events.js => EToken.events.js} | 0 test/token/{TokenX.test.js => EToken.test.js} | 16 +++--- ...ents.js => ETokenExplicitSender.events.js} | 0 ...r.test.js => ETokenExplicitSender.test.js} | 16 +++--- 18 files changed, 116 insertions(+), 116 deletions(-) rename contracts/token/{TokenX.sol => EToken.sol} (95%) rename contracts/token/{TokenXExplicitSender.sol => ETokenExplicitSender.sol} (89%) rename contracts/token/{ITokenX.sol => IEToken.sol} (89%) rename contracts/token/{IUpgradableTokenX.sol => IUpgradableEToken.sol} (98%) rename test/token/{TokenX.events.js => EToken.events.js} (100%) rename test/token/{TokenX.test.js => EToken.test.js} (97%) rename test/token/{TokenXExplicitSender.events.js => ETokenExplicitSender.events.js} (100%) rename test/token/{TokenXExplicitSender.test.js => ETokenExplicitSender.test.js} (78%) diff --git a/README.md b/README.md index 7a6ab8e..9c9de45 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# TokenX - an [eToro](https://www.etoro.com/) stablecoin -[![Build Status](https://circleci.com/gh/eTokenize/TokenX.svg?style=shield&circle-token=797dc9ae3f839ac4fc5d5edad6c993ae9faa3943&maxAge=0)](https://circleci.com/gh/eTokenize/TokenX) [![Coverage Status](https://coveralls.io/repos/github/eTokenize/TokenX/badge.svg?t=un8yQ7&maxAge=0)](https://coveralls.io/github/eTokenize/TokenX) +# eToken - an [eToro](https://www.etoro.com/) stablecoin +[![Build Status](https://circleci.com/gh/eTokenize/eToken.svg?style=shield&circle-token=797dc9ae3f839ac4fc5d5edad6c993ae9faa3943&maxAge=0)](https://circleci.com/gh/eTokenize/eToken) [![Coverage Status](https://coveralls.io/repos/github/eTokenize/eToken/badge.svg?t=un8yQ7&maxAge=0)](https://coveralls.io/github/eTokenize/eToken) -TokenX is stablecoin implementation by [eToro](https://www.etoro.com/) targeting the [Ethereum](https://www.ethereum.org/) platform. +eToken is stablecoin implementation by [eToro](https://www.etoro.com/) targeting the [Ethereum](https://www.ethereum.org/) platform. ## USAGE To test the library and setup the development environment, issue the following commands in a shell: @@ -20,8 +20,8 @@ This repository has only been tested on UNIX-derived systems. *__Figure 1:__ Design overview. To simplify the overview, aspects related to the token upgrading functionality are not shown here but are described separately in Figure 2.* -### TokenX - ERC20 -This document describes the design and implementation of the smart contracts comprising TokenX which is intended to be used for powering several different stablecoins representing various assets. At its core, TokenX is an ERC20 token with additional supporting infrastructure relating to token management, permission management and token upgradability. The remainder of this document gives a high-level overview of the design and implementation of the token itself and its supporting infrastructure. +### eToken - ERC20 +This document describes the design and implementation of the smart contracts comprising eToken which is intended to be used for powering several different stablecoins representing various assets. At its core, eToken is an ERC20 token with additional supporting infrastructure relating to token management, permission management and token upgradability. The remainder of this document gives a high-level overview of the design and implementation of the token itself and its supporting infrastructure. Initially, we intended to base our implementation entirely on the OpenZeppelin (OZ) solidity library and extend from its unmodified ERC20 implementation. However, we found that implementing a number of our desired features was impossible without modifying the underlying OZ code. Therefore, our current implementation contains several modified and extended OZ components.When modifying OZ components, we have attempted to retain major design decisions and making non-intrusive and predictable code alteration. @@ -33,7 +33,7 @@ An overview of the design is shown in Figure 1 and a detailed diagram of the int * The Ethereum Name System (ENS) is used to allow frontends to identify (possibly changing) contract addresses through a constant name. - * TokenX(n) are ERC20 tokens which uses an ERC20 implementation extended from the OpenZeppelin library to enable the use of an separate contract for storing balances and allowances. The need for this separation was driven by our requirement of being able to upgrade the tokens. We discuss the token implementation itself in the following section. + * eToken(n) are ERC20 tokens which uses an ERC20 implementation extended from the OpenZeppelin library to enable the use of an separate contract for storing balances and allowances. The need for this separation was driven by our requirement of being able to upgrade the tokens. We discuss the token implementation itself in the following section. #### Upgradability and external storage ERC20 implementation Due to the immutability of Ethereum smart contracts, upgrading the functionality of a previously deployed contract is a well known challenge. The strategy we use for upgrading previously deployed tokens are similar to, eg., TrueUSD and Tether USD and works by allowing the functions comprising the external interface of a token to which modes such that they proxy all calls to a new contract. In particular, the following is achieved. @@ -99,7 +99,7 @@ In order to limit the damage which can be caused by a compromised minter account Path | Description ------------- | ------------- `contracts/` | All the solidity files making up the implementation -`contracts/token` | Contains the TokenX implementation +`contracts/token` | Contains the eToken implementation `contracts/token/ERC20` | ERC20 implementation using an external storage `contracts/roles` | Defines the roles implementation, i.e. whitelisting, blacklisting, miners etc. `contracts/lifecycle` | Implements lifecycle behaviors. Taken from OpenZeppelin diff --git a/contracts/TokenManager.sol b/contracts/TokenManager.sol index b9ae993..8abc159 100644 --- a/contracts/TokenManager.sol +++ b/contracts/TokenManager.sol @@ -1,7 +1,7 @@ pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; -import "./token/ITokenX.sol"; +import "./token/IEToken.sol"; /** * @title The Token Manager contract @@ -10,23 +10,23 @@ import "./token/ITokenX.sol"; contract TokenManager is Ownable { /** - * @dev A TokenEntry defines a relation between a TokenX instance and the + * @dev A TokenEntry defines a relation between an EToken instance and the * index of the names list containing the name of the token. */ struct TokenEntry { bool exists; uint index; - ITokenX token; + IEToken token; } mapping (bytes32 => TokenEntry) private tokens; bytes32[] private names; - event TokenAdded(bytes32 indexed name, ITokenX indexed addr); - event TokenDeleted(bytes32 indexed name, ITokenX indexed addr); + event TokenAdded(bytes32 indexed name, IEToken indexed addr); + event TokenDeleted(bytes32 indexed name, IEToken indexed addr); event TokenUpgraded(bytes32 indexed name, - ITokenX indexed from, - ITokenX indexed to); + IEToken indexed from, + IEToken indexed to); /** * @dev Require that the token _name exists @@ -47,32 +47,32 @@ contract TokenManager is Ownable { } /** - * @dev Require that the token _iTokenX is not null - * @param _iTokenX Token that is checked for + * @dev Require that the token _iEToken is not null + * @param _iEToken Token that is checked for */ - modifier notNullToken(ITokenX _iTokenX) { - require(_iTokenX != ITokenX(0), "Supplied token is null"); + modifier notNullToken(IEToken _iEToken) { + require(_iEToken != IEToken(0), "Supplied token is null"); _; } /** * @dev Adds a token to the tokenmanager * @param _name Name of the token to be added - * @param _iTokenX Token to be added + * @param _iEToken Token to be added */ - function addToken(bytes32 _name, ITokenX _iTokenX) + function addToken(bytes32 _name, IEToken _iEToken) public onlyOwner tokenNotExists(_name) - notNullToken(_iTokenX) + notNullToken(_iEToken) { tokens[_name] = TokenEntry({ index: names.length, - token: _iTokenX, + token: _iEToken, exists: true }); names.push(_name); - emit TokenAdded(_name, _iTokenX); + emit TokenAdded(_name, _iEToken); } /** @@ -84,7 +84,7 @@ contract TokenManager is Ownable { onlyOwner tokenExists(_name) { - ITokenX prev = tokens[_name].token; + IEToken prev = tokens[_name].token; delete names[tokens[_name].index]; delete tokens[_name].token; delete tokens[_name]; @@ -94,17 +94,17 @@ contract TokenManager is Ownable { /** * @dev Upgrades a token * @param _name Name of token to be upgraded - * @param _iTokenX Upgraded version of token + * @param _iEToken Upgraded version of token */ - function upgradeToken(bytes32 _name, ITokenX _iTokenX) + function upgradeToken(bytes32 _name, IEToken _iEToken) public onlyOwner tokenExists(_name) - notNullToken(_iTokenX) + notNullToken(_iEToken) { - ITokenX prev = tokens[_name].token; - tokens[_name].token = _iTokenX; - emit TokenUpgraded(_name, prev, _iTokenX); + IEToken prev = tokens[_name].token; + tokens[_name].token = _iEToken; + emit TokenUpgraded(_name, prev, _iEToken); } /** @@ -116,7 +116,7 @@ contract TokenManager is Ownable { public tokenExists(_name) view - returns (ITokenX) + returns (IEToken) { return tokens[_name].token; } diff --git a/contracts/mocks/TokenXExplicitSenderMock.sol b/contracts/mocks/TokenXExplicitSenderMock.sol index 2eb8c83..44da85d 100644 --- a/contracts/mocks/TokenXExplicitSenderMock.sol +++ b/contracts/mocks/TokenXExplicitSenderMock.sol @@ -1,14 +1,14 @@ pragma solidity ^0.4.24; -import "../token/TokenXExplicitSender.sol"; +import "../token/ETokenExplicitSender.sol"; /** - * @title Mock contract for testing TokenXExplicitSender + * @title Mock contract for testing ETokenExplicitSender */ -contract TokenXExplicitSenderMock is TokenXExplicitSender { +contract ETokenExplicitSenderMock is ETokenExplicitSender { /** - * Initializes an TokenXExplicitSender. Forwards parameters + * Initializes an ETokenExplicitSender. Forwards parameters * as is except that the initial minting recipient (see * tokens/ERC20/ExternalERC20Mintable) is set to a static value. */ @@ -19,11 +19,11 @@ contract TokenXExplicitSenderMock is TokenXExplicitSender { Accesslist accesslist, bool whitelistEnabled, ExternalERC20Storage stor, - IUpgradableTokenX upgradedFrom, + IUpgradableEToken upgradedFrom, bool initialDeployment ) public - TokenXExplicitSender( + ETokenExplicitSender( name, symbol, decimals, accesslist, whitelistEnabled, stor, address(0xf00f), upgradedFrom, initialDeployment) {} diff --git a/contracts/mocks/TokenXMock.sol b/contracts/mocks/TokenXMock.sol index eb1a130..88b5db6 100644 --- a/contracts/mocks/TokenXMock.sol +++ b/contracts/mocks/TokenXMock.sol @@ -2,15 +2,15 @@ pragma solidity ^0.4.24; /* solium-disable max-len */ import "../token/ERC20/ExternalERC20Storage.sol"; -import "../token/TokenX.sol"; -import "../token/IUpgradableTokenX.sol"; +import "../token/EToken.sol"; +import "../token/IUpgradableEToken.sol"; import "./PauserRoleMock.sol"; -/** @title Mock contract for testing TokenX */ -contract TokenXMock is TokenX, PauserRoleMock { +/** @title Mock contract for testing EToken */ +contract ETokenMock is EToken, PauserRoleMock { /** - * Initializes a TokenX contract and optionally mint some amount to a + * Initializes an EToken contract and optionally mint some amount to a * given account * @param name The name of the token * @param symbol The symbol of the token @@ -38,12 +38,12 @@ contract TokenXMock is TokenX, PauserRoleMock { bool whitelistEnabled, ExternalERC20Storage stor, address mintingRecip, - IUpgradableTokenX upgradedFrom, + IUpgradableEToken upgradedFrom, bool initialDeployment, address initialAccount, uint256 initialBalance ) - TokenX( + EToken( name, symbol, decimals, accesslist, whitelistEnabled, stor, mintingRecip, upgradedFrom, initialDeployment diff --git a/contracts/token/TokenX.sol b/contracts/token/EToken.sol similarity index 95% rename from contracts/token/TokenX.sol rename to contracts/token/EToken.sol index 4b7f52c..3230106 100644 --- a/contracts/token/TokenX.sol +++ b/contracts/token/EToken.sol @@ -2,15 +2,15 @@ pragma solidity ^0.4.24; import "./ERC20/ExternalERC20Storage.sol"; -import "./TokenXExplicitSender.sol"; -import "./ITokenX.sol"; -import "./IUpgradableTokenX.sol"; +import "./ETokenExplicitSender.sol"; +import "./IEToken.sol"; +import "./IUpgradableEToken.sol"; -/** @title Main TokenX contract */ -contract TokenX is ITokenX, TokenXExplicitSender { +/** @title Main EToken contract */ +contract EToken is IEToken, ETokenExplicitSender { ExternalERC20Storage private externalStorage; - IUpgradableTokenX public upgradedToken; + IUpgradableEToken public upgradedToken; /** * @param name The name of the token @@ -40,7 +40,7 @@ contract TokenX is ITokenX, TokenXExplicitSender { bool initialDeployment ) public - TokenXExplicitSender( + ETokenExplicitSender( name, symbol, decimals, @@ -64,18 +64,18 @@ contract TokenX is ITokenX, TokenXExplicitSender { * @return Is this token upgraded */ function isUpgraded() public view returns (bool) { - return upgradedToken != IUpgradableTokenX(0); + return upgradedToken != IUpgradableEToken(0); } /** * Upgrades the current token * @param _upgradedToken The address of the token that this token should be upgraded to */ - function upgrade(IUpgradableTokenX _upgradedToken) public onlyOwner { + function upgrade(IUpgradableEToken _upgradedToken) public onlyOwner { require(!isUpgraded(), "Token is already upgraded"); - require(_upgradedToken != IUpgradableTokenX(0), + require(_upgradedToken != IUpgradableEToken(0), "Cannot upgrade to null address"); - require(_upgradedToken != IUpgradableTokenX(this), + require(_upgradedToken != IUpgradableEToken(this), "Cannot upgrade to myself"); require(externalStorage.isImplementor(), "I don't own my storage. This will end badly."); diff --git a/contracts/token/TokenXExplicitSender.sol b/contracts/token/ETokenExplicitSender.sol similarity index 89% rename from contracts/token/TokenXExplicitSender.sol rename to contracts/token/ETokenExplicitSender.sol index 049fd7a..2962cea 100644 --- a/contracts/token/TokenXExplicitSender.sol +++ b/contracts/token/ETokenExplicitSender.sol @@ -11,11 +11,11 @@ import "../access/roles/BurnerRole.sol"; import "../access/roles/MinterRole.sol"; import "../access/Accesslist.sol"; import "../access/AccesslistGuarded.sol"; -import "./IUpgradableTokenX.sol"; +import "./IUpgradableEToken.sol"; /* solium-enable max-len */ -/** @title TokenX functions accepting explicit sender params */ -contract TokenXExplicitSender is IUpgradableTokenX, +/** @title EToken functions accepting explicit sender params */ +contract ETokenExplicitSender is IUpgradableEToken, ExternalERC20, ExternalERC20Burnable, ExternalERC20Mintable, @@ -112,7 +112,7 @@ contract TokenXExplicitSender is IUpgradableTokenX, } /** - * @dev Like TokenX.name, but gets sender from explicit sender + * @dev Like EToken.name, but gets sender from explicit sender * parameter rather than msg.sender. This function can only be * called from the proxy contract (the contract that this contract * upgraded). @@ -130,7 +130,7 @@ contract TokenXExplicitSender is IUpgradableTokenX, } /** - * @dev Like TokenX.symbol, but gets sender from explicit sender + * @dev Like EToken.symbol, but gets sender from explicit sender * parameter rather than msg.sender. This function can only be * called from the proxy contract (the contract that this contract * upgraded). @@ -148,7 +148,7 @@ contract TokenXExplicitSender is IUpgradableTokenX, } /** - * @dev Like TokenX.decimal, but gets sender from explicit sender + * @dev Like EToken.decimal, but gets sender from explicit sender * parameter rather than msg.sender. This function can only be * called from the proxy contract (the contract that this contract * upgraded). @@ -166,7 +166,7 @@ contract TokenXExplicitSender is IUpgradableTokenX, } /** - * @dev Like TokenX.totalSupply, but gets sender from explicit sender + * @dev Like EToken.totalSupply, but gets sender from explicit sender * parameter rather than msg.sender. This function can only be * called from the proxy contract (the contract that this contract * upgraded). @@ -184,7 +184,7 @@ contract TokenXExplicitSender is IUpgradableTokenX, } /** - * @dev Like TokenX.balanceOf, but gets sender from explicit sender + * @dev Like EToken.balanceOf, but gets sender from explicit sender * parameter rather than msg.sender. This function can only be * called from the proxy contract (the contract that this contract * upgraded). @@ -202,7 +202,7 @@ contract TokenXExplicitSender is IUpgradableTokenX, } /** - * @dev Like TokenX.allowance, but gets sender from explicit sender + * @dev Like EToken.allowance, but gets sender from explicit sender * parameter rather than msg.sender. This function can only be * called from the proxy contract (the contract that this contract * upgraded). @@ -220,7 +220,7 @@ contract TokenXExplicitSender is IUpgradableTokenX, } /** - * @dev Like TokenX.transfer, but gets sender from explicit sender + * @dev Like EToken.transfer, but gets sender from explicit sender * parameter rather than msg.sender. This function can only be * called from the proxy contract (the contract that this contract * upgraded). @@ -239,7 +239,7 @@ contract TokenXExplicitSender is IUpgradableTokenX, } /** - * @dev Like TokenX.approve, but gets sender from explicit sender + * @dev Like EToken.approve, but gets sender from explicit sender * parameter rather than msg.sender. This function can only be * called from the proxy contract (the contract that this contract * upgraded). @@ -260,7 +260,7 @@ contract TokenXExplicitSender is IUpgradableTokenX, /** - * @dev Like TokenX.transferFrom, but gets sender from explicit sender + * @dev Like EToken.transferFrom, but gets sender from explicit sender * parameter rather than msg.sender. This function can only be * called from the proxy contract (the contract that this contract * upgraded). @@ -289,7 +289,7 @@ contract TokenXExplicitSender is IUpgradableTokenX, /** - * @dev Like TokenX.increaseAllowance, but gets sender from explicit sender + * @dev Like EToken.increaseAllowance, but gets sender from explicit sender * parameter rather than msg.sender. This function can only be * called from the proxy contract (the contract that this contract * upgraded). @@ -312,7 +312,7 @@ contract TokenXExplicitSender is IUpgradableTokenX, } /** - * @dev Like TokenX.decreaseAllowance, but gets sender from explicit sender + * @dev Like EToken.decreaseAllowance, but gets sender from explicit sender * parameter rather than msg.sender. This function can only be * called from the proxy contract (the contract that this contract * upgraded). @@ -332,7 +332,7 @@ contract TokenXExplicitSender is IUpgradableTokenX, } /** - * @dev Like TokenX.burn, but gets sender from explicit sender + * @dev Like EToken.burn, but gets sender from explicit sender * parameter rather than msg.sender. This function can only be * called from the proxy contract (the contract that this contract * upgraded). @@ -347,7 +347,7 @@ contract TokenXExplicitSender is IUpgradableTokenX, } /** - * @dev Like TokenX.burnFrom, but gets sender from explicit sender + * @dev Like EToken.burnFrom, but gets sender from explicit sender * parameter rather than msg.sender. This function can only be * called from the proxy contract (the contract that this contract * upgraded). @@ -364,7 +364,7 @@ contract TokenXExplicitSender is IUpgradableTokenX, } /** - * @dev Like TokenX.mint, but gets sender from explicit sender + * @dev Like EToken.mint, but gets sender from explicit sender * parameter rather than msg.sender. This function can only be * called from the proxy contract (the contract that this contract * upgraded). @@ -380,7 +380,7 @@ contract TokenXExplicitSender is IUpgradableTokenX, } /** - * @dev Like TokenX.changeMintingRecipient, but gets sender from + * @dev Like EToken.changeMintingRecipient, but gets sender from * explicit sender parameter rather than msg.sender. This function * can only be called from the proxy contract (the contract that * this contract upgraded). @@ -394,7 +394,7 @@ contract TokenXExplicitSender is IUpgradableTokenX, } /** - * @dev Like TokenX.transfer, but gets sender from + * @dev Like EToken.transfer, but gets sender from * explicit sender parameter rather than msg.sender. This function * can only be called from the proxy contract (the contract that * this contract upgraded). @@ -411,7 +411,7 @@ contract TokenXExplicitSender is IUpgradableTokenX, } /** - * @dev Like TokenX.approve, but gets sender from + * @dev Like EToken.approve, but gets sender from * explicit sender parameter rather than msg.sender. This function * can only be called from the proxy contract (the contract that * this contract upgraded). @@ -428,7 +428,7 @@ contract TokenXExplicitSender is IUpgradableTokenX, } /** - * @dev Like TokenX.transferFrom, but gets sender from + * @dev Like EToken.transferFrom, but gets sender from * explicit sender parameter rather than msg.sender. This function * can only be called from the proxy contract (the contract that * this contract upgraded). @@ -446,7 +446,7 @@ contract TokenXExplicitSender is IUpgradableTokenX, } /** - * @dev Like TokenX.increaseAllowance, but gets sender from + * @dev Like EToken.increaseAllowance, but gets sender from * explicit sender parameter rather than msg.sender. This function * can only be called from the proxy contract (the contract that * this contract upgraded). @@ -463,7 +463,7 @@ contract TokenXExplicitSender is IUpgradableTokenX, } /** - * @dev Like TokenX.decreaseAllowance, but gets sender from + * @dev Like EToken.decreaseAllowance, but gets sender from * explicit sender parameter rather than msg.sender. This function * can only be called from the proxy contract (the contract that * this contract upgraded). @@ -479,17 +479,17 @@ contract TokenXExplicitSender is IUpgradableTokenX, return super.decreaseAllowance(spender, subtractedValue); } - /** @dev Burning function called by TokenX.burn */ + /** @dev Burning function called by EToken.burn */ function burn(uint256 value) public isEnabled onlyBurner { super.burn(value); } - /** @dev Burning function called by TokenX.burnFrom */ + /** @dev Burning function called by EToken.burnFrom */ function burnFrom(address from, uint256 value) public isEnabled onlyBurner { super.burnFrom(from, value); } - /** @dev Minting function called by TokenX.mint */ + /** @dev Minting function called by EToken.mint */ function mint(address to, uint256 value) public isEnabled @@ -499,7 +499,7 @@ contract TokenXExplicitSender is IUpgradableTokenX, return true; } - /** @dev changeMintingRecipient function called by TokenX.changeMintingRecipient */ + /** @dev changeMintingRecipient function called by EToken.changeMintingRecipient */ function changeMintingRecipient(address _mintingRecipientAddress) public isEnabled diff --git a/contracts/token/ITokenX.sol b/contracts/token/IEToken.sol similarity index 89% rename from contracts/token/ITokenX.sol rename to contracts/token/IEToken.sol index 5207519..803d008 100644 --- a/contracts/token/ITokenX.sol +++ b/contracts/token/IEToken.sol @@ -1,16 +1,16 @@ pragma solidity ^0.4.24; -import "./IUpgradableTokenX.sol"; +import "./IUpgradableEToken.sol"; /** - * @title TokenX interface - * @dev The interface comprising a TokenX contract + * @title EToken interface + * @dev The interface comprising an EToken contract */ -interface ITokenX { +interface IEToken { /* solium-disable zeppelin/missing-natspec-comments */ - function upgrade(IUpgradableTokenX upgradedToken) external; + function upgrade(IUpgradableEToken upgradedToken) external; /* Taken from ERC20Detailed in openzeppelin-solidity */ function name() external view returns(string); diff --git a/contracts/token/IUpgradableTokenX.sol b/contracts/token/IUpgradableEToken.sol similarity index 98% rename from contracts/token/IUpgradableTokenX.sol rename to contracts/token/IUpgradableEToken.sol index ef0c75c..961fded 100644 --- a/contracts/token/IUpgradableTokenX.sol +++ b/contracts/token/IUpgradableEToken.sol @@ -4,7 +4,7 @@ pragma solidity ^0.4.24; * @title Interface of an upgradable token * @dev See implementation for */ -interface IUpgradableTokenX { +interface IUpgradableEToken { event Transfer(address indexed from, address indexed to, diff --git a/docs/images/class_diagram.svg b/docs/images/class_diagram.svg index 373d3c1..e0cf0c3 100644 --- a/docs/images/class_diagram.svg +++ b/docs/images/class_diagram.svg @@ -1,2 +1,2 @@ -
TokenManager
TokenManager
+ tokens: bytes32 -> TokenEntry
+ tokens: bytes32 -> TokenEntry
+ names[]: bytes32
+ names[]: bytes32
+ tokenExists(bytes32)
+ tokenExists(bytes32)
+ tokenNotExists(bytes32)
+ tokenNotExists(bytes32)
+ notNullToken(ITokenX)
+ notNullToken(ITokenX)
+ addToken(bytes32, ITokenX)
+ addToken(bytes32, ITokenX)
+ deleteToken(bytes32)
+ deleteToken(bytes32)
+ upgradeToken(bytes32, ITokenX)
+ upgradeToken(bytes32, ITokenX)
+ getToken(bytes32): ITokenX
+ getToken(bytes32):<b> ITokenX<br></b>
+ getTokens(): bytes32[]
+ getTokens(): <b>bytes32[]</b>
+ _tokenExists(bytes32): bool
[Not supported by viewer]
TokenX
TokenX
+ externalstorage: ExternalERC20Storage
+ externalstorage: ExternalERC20Storage
+ upgradedToken: IUpgradableTokenX
+ upgradedToken: IUpgradableTokenX
+ name: string
+ name: string
+ symbol: string
+ symbol: string
+ decimals: uint8
+ decimals: uint8
+ accesslist: Accesslist
+ accesslist: Accesslist
+ upgradedFrom: address
+ upgradedFrom: address
+ initialDeployment: bool
+ initialDeployment: bool
+ isUpgraded(): bool
+ isUpgraded(): <b>bool</b>
+ upgrade(IUpgradableTokenX)
+ upgrade(IUpgradableTokenX)
+ name(): string
+ name(): <b>string</b>
+ symbol(): string
+ symbol(): <b>string</b>
+ decimals(): uint8
+ decimals(): <b>uint8</b>
+ totalSupply(): uint256
+ totalSupply(): <b>uint256</b>
+ balanceOf(address): uint256
+ balanceOf(address): <b>uint256</b>
+ allowance(address, address): uint256
+ allowance(address, address): <b>uint256</b>
+ transfer(address, uint256): bool
+ transfer(address, uint256): <b>bool</b>
+ approve(address, uint256): bool
+ approve(address, uint256): <b>bool</b>
+ transferFrom(address, address, uint256): bool
+ transferFrom(address, address, uint256): <b>bool</b>
+ mint(address, uint256): bool
+ mint(address, uint256): <b>bool</b>
+ burn(uint256)
+ burn(uint256)
+ burnFrom(address, uint256)
+ burnFrom(address, uint256)
+ increaseAllowance(address, uint): bool
+ increaseAllowance(address, uint): <b>bool</b>
+ decreaseAllowance(address, uint): bool
+ decreaseAllowance(address, uint): <b>bool</b>
Struct
<<TokenEntry>>
Struct<br><<TokenEntry>>
+ exists: bool
+ exists: bool
+ index: uint
+ index: uint
+ token: ITokenX
+ token: ITokenX
Interface
<<ITokenX>>
Interface<br><<ITokenX>>
+ upgrade(IUpgradableTokenX)
+ upgrade(IUpgradableTokenX)
+ name(): string
+ name(): <b>string</b>
+ symbol(): string
+ symbol(): <b>string</b>
+ decimals(): uint8
+ decimals(): <b>uint8</b>
+ totalSupply(): uint256
+ totalSupply(): <b>uint256</b>
+ balanceOf(address): uint256
+ balanceOf(address): <b>uint256</b>
+ allowance(address, address): uint256
+ allowance(address, address): <b>uint256</b>
+ transfer(address, uint256): bool
+ transfer(address, uint256): <b>bool</b>
+ approve(address, uint256): bool
+ approve(address, uint256): <b>bool</b>
+ transferFrom(address, address, uint256): bool
+ transferFrom(address, address, uint256): <b>bool</b>
+ mint(address, uint256): bool
+ mint(address, uint256): <b>bool</b>
+ burn(uint256)
+ burn(uint256)
+ burnFrom(address, uint256)
+ burnFrom(address, uint256)
+ increaseAllowance(address, uint): bool
+ increaseAllowance(address, uint): <b>bool</b>
+ decreaseAllowance(address, uint): bool
+ decreaseAllowance(address, uint): <b>bool</b>
AccesslistGuarded
AccesslistGuarded
+ accesslist: Accesslist
+ accesslist: Accesslist
+ requireHasAccess(address)
+ requireHasAccess(address)
+ onlyHasAccess()
+ onlyHasAccess()
+ requireWhitelisted(address)
+ requireWhitelisted(address)
+ onlyWhitelisted()
+ onlyWhitelisted()
+ requireNotBlacklisted(address)
+ requireNotBlacklisted(address)
+ onlyNotBlacklisted()
+ onlyNotBlacklisted()
IUpgradableTokenX
IUpgradableTokenX
+ finalizeUpgrade()
+ finalizeUpgrade()
+ nameExplicitSender(address): string
+ nameExplicitSender(address): <b>string</b>
+ symbolExplicitSender(address): string
+ symbolExplicitSender(address): <b>string</b>
+ decimalsExplicitSender(address): uint8
+ decimalsExplicitSender(address): <b>uint8</b>
+ totalSupplyExplicitSender(address): uint256
+ totalSupplyExplicitSender(address): <b>uint256</b>
+ balanceOfExplicitSender(address): uint256
+ balanceOfExplicitSender(address): <b>uint256</b>
+ allowanceExplicitSender(address, address): uint256
+ allowanceExplicitSender(address, address): <b>uint256</b>
+ transferExplicitSender(address, address, uint256): bool
+ transferExplicitSender(address, address, uint256): <b>bool</b>
+ approveExplicitSender(address, address, uint256): bool
+ approveExplicitSender(address, address, uint256): <b>bool</b>
+ transferFromExplicitSender(address, address, address, uint256): bool
+ transferFromExplicitSender(address, address, address, uint256): <b>bool</b>
+ mintExplicitSender(address, address, uint256): bool
+ mintExplicitSender(address, address, uint256): <b>bool</b>
+ burnExplicitSender(address, uint256)
+ burnExplicitSender(address, uint256)
+ burnFromExplicitSender(address, address, uint256)
+ burnFromExplicitSender(address, address, uint256)
+ increaseAllowanceExplicitSender(address, address, uint): bool
+ increaseAllowanceExplicitSender(address, address, uint): <b>bool</b>
+ decreaseAllowanceExplicitSender(address, address, uint): bool
+ decreaseAllowanceExplicitSender(address, address, uint): <b>bool</b>
Accesslist
Accesslist
+ addWhitelisted(address)
+ addWhitelisted(address)
+ removeWhitelisted(address)
+ removeWhitelisted(address)
+ addBlacklisted(address)
+ addBlacklisted(address)
+ removeBlacklisted(address)
+ removeBlacklisted(address)
+ isWhitelisted(address): bool
+ isWhitelisted(address): <b>bool</b>
+ isBlacklisted(address): bool
+ isBlacklisted(address): <b>bool</b>
+ hasAccess(address): bool
+ hasAccess(address): <b>bool</b>
+ hasAccess(address): bool
+ hasAccess(address): <b>bool</b>
+ _addWhitelisted(address)
[Not supported by viewer]
+ _removeWhitelisted(address)
+ <font style="font-size: 14px">_</font>removeWhitelisted(address)
+ _addBlacklisted(address)
[Not supported by viewer]
+ _removeBlacklisted(address)
+ <font style="font-size: 14px">_</font>removeBlacklisted(address)
TokenXExplicitSender
TokenXExplicitSender
+ Whitelist: whitelist
+ Whitelist: whitelist
+ name: string
+ name: string
+ symbol: string
+ symbol: string
+ decimals: uint8
+ decimals: uint8
+ owner: address
+ owner: address
+ whitelistAddress: address
+ whitelistAddress: address
+ transfer(address, uint256): bool
+ transfer(address, uint256): <b>bool</b>
+ approve(address, uint256): bool
+ approve(address, uint256): <b>bool</b>
+ transferFrom(address, address, uint256): bool
+ transferFrom(address, address, uint256): <b>bool</b>
+ increaseAllowance(address, uint256): bool
+ increaseAllowance(address, uint256): <b>bool</b>
+ decreaseAllowance(address, uint256): bool
+ decreaseAllowance(address, uint256): <b>bool</b>
+ burn(uint256)
+ burn(uint256)
\ No newline at end of file +
TokenManager
TokenManager
+ tokens: bytes32 -> TokenEntry
+ tokens: bytes32 -> TokenEntry
+ names[]: bytes32
+ names[]: bytes32
+ tokenExists(bytes32)
+ tokenExists(bytes32)
+ tokenNotExists(bytes32)
+ tokenNotExists(bytes32)
+ notNullToken(IEToken)
+ notNullToken(IEToken)
+ addToken(bytes32, IEToken)
+ addToken(bytes32, IEToken)
+ deleteToken(bytes32)
+ deleteToken(bytes32)
+ upgradeToken(bytes32, IEToken)
+ upgradeToken(bytes32, IEToken)
+ getToken(bytes32): IEToken
+ getToken(bytes32):<b> IEToken<br></b>
+ getTokens(): bytes32[]
+ getTokens(): <b>bytes32[]</b>
+ _tokenExists(bytes32): bool
[Not supported by viewer]
EToken
EToken
+ externalstorage: ExternalERC20Storage
+ externalstorage: ExternalERC20Storage
+ upgradedToken: IUpgradableEToken
+ upgradedToken: IUpgradableEToken
+ name: string
+ name: string
+ symbol: string
+ symbol: string
+ decimals: uint8
+ decimals: uint8
+ accesslist: Accesslist
+ accesslist: Accesslist
+ upgradedFrom: address
+ upgradedFrom: address
+ initialDeployment: bool
+ initialDeployment: bool
+ isUpgraded(): bool
+ isUpgraded(): <b>bool</b>
+ upgrade(IUpgradableEToken)
+ upgrade(IUpgradableEToken)
+ name(): string
+ name(): <b>string</b>
+ symbol(): string
+ symbol(): <b>string</b>
+ decimals(): uint8
+ decimals(): <b>uint8</b>
+ totalSupply(): uint256
+ totalSupply(): <b>uint256</b>
+ balanceOf(address): uint256
+ balanceOf(address): <b>uint256</b>
+ allowance(address, address): uint256
+ allowance(address, address): <b>uint256</b>
+ transfer(address, uint256): bool
+ transfer(address, uint256): <b>bool</b>
+ approve(address, uint256): bool
+ approve(address, uint256): <b>bool</b>
+ transferFrom(address, address, uint256): bool
+ transferFrom(address, address, uint256): <b>bool</b>
+ mint(address, uint256): bool
+ mint(address, uint256): <b>bool</b>
+ burn(uint256)
+ burn(uint256)
+ burnFrom(address, uint256)
+ burnFrom(address, uint256)
+ increaseAllowance(address, uint): bool
+ increaseAllowance(address, uint): <b>bool</b>
+ decreaseAllowance(address, uint): bool
+ decreaseAllowance(address, uint): <b>bool</b>
Struct
<<TokenEntry>>
Struct<br><<TokenEntry>>
+ exists: bool
+ exists: bool
+ index: uint
+ index: uint
+ token: IEToken
+ token: IEToken
Interface
<<IEToken>>
Interface<br><<IEToken>>
+ upgrade(IUpgradableEToken)
+ upgrade(IUpgradableEToken)
+ name(): string
+ name(): <b>string</b>
+ symbol(): string
+ symbol(): <b>string</b>
+ decimals(): uint8
+ decimals(): <b>uint8</b>
+ totalSupply(): uint256
+ totalSupply(): <b>uint256</b>
+ balanceOf(address): uint256
+ balanceOf(address): <b>uint256</b>
+ allowance(address, address): uint256
+ allowance(address, address): <b>uint256</b>
+ transfer(address, uint256): bool
+ transfer(address, uint256): <b>bool</b>
+ approve(address, uint256): bool
+ approve(address, uint256): <b>bool</b>
+ transferFrom(address, address, uint256): bool
+ transferFrom(address, address, uint256): <b>bool</b>
+ mint(address, uint256): bool
+ mint(address, uint256): <b>bool</b>
+ burn(uint256)
+ burn(uint256)
+ burnFrom(address, uint256)
+ burnFrom(address, uint256)
+ increaseAllowance(address, uint): bool
+ increaseAllowance(address, uint): <b>bool</b>
+ decreaseAllowance(address, uint): bool
+ decreaseAllowance(address, uint): <b>bool</b>
AccesslistGuarded
AccesslistGuarded
+ accesslist: Accesslist
+ accesslist: Accesslist
+ requireHasAccess(address)
+ requireHasAccess(address)
+ onlyHasAccess()
+ onlyHasAccess()
+ requireWhitelisted(address)
+ requireWhitelisted(address)
+ onlyWhitelisted()
+ onlyWhitelisted()
+ requireNotBlacklisted(address)
+ requireNotBlacklisted(address)
+ onlyNotBlacklisted()
+ onlyNotBlacklisted()
IUpgradableEToken
IUpgradableEToken
+ finalizeUpgrade()
+ finalizeUpgrade()
+ nameExplicitSender(address): string
+ nameExplicitSender(address): <b>string</b>
+ symbolExplicitSender(address): string
+ symbolExplicitSender(address): <b>string</b>
+ decimalsExplicitSender(address): uint8
+ decimalsExplicitSender(address): <b>uint8</b>
+ totalSupplyExplicitSender(address): uint256
+ totalSupplyExplicitSender(address): <b>uint256</b>
+ balanceOfExplicitSender(address): uint256
+ balanceOfExplicitSender(address): <b>uint256</b>
+ allowanceExplicitSender(address, address): uint256
+ allowanceExplicitSender(address, address): <b>uint256</b>
+ transferExplicitSender(address, address, uint256): bool
+ transferExplicitSender(address, address, uint256): <b>bool</b>
+ approveExplicitSender(address, address, uint256): bool
+ approveExplicitSender(address, address, uint256): <b>bool</b>
+ transferFromExplicitSender(address, address, address, uint256): bool
+ transferFromExplicitSender(address, address, address, uint256): <b>bool</b>
+ mintExplicitSender(address, address, uint256): bool
+ mintExplicitSender(address, address, uint256): <b>bool</b>
+ burnExplicitSender(address, uint256)
+ burnExplicitSender(address, uint256)
+ burnFromExplicitSender(address, address, uint256)
+ burnFromExplicitSender(address, address, uint256)
+ increaseAllowanceExplicitSender(address, address, uint): bool
+ increaseAllowanceExplicitSender(address, address, uint): <b>bool</b>
+ decreaseAllowanceExplicitSender(address, address, uint): bool
+ decreaseAllowanceExplicitSender(address, address, uint): <b>bool</b>
Accesslist
Accesslist
+ addWhitelisted(address)
+ addWhitelisted(address)
+ removeWhitelisted(address)
+ removeWhitelisted(address)
+ addBlacklisted(address)
+ addBlacklisted(address)
+ removeBlacklisted(address)
+ removeBlacklisted(address)
+ isWhitelisted(address): bool
+ isWhitelisted(address): <b>bool</b>
+ isBlacklisted(address): bool
+ isBlacklisted(address): <b>bool</b>
+ hasAccess(address): bool
+ hasAccess(address): <b>bool</b>
+ hasAccess(address): bool
+ hasAccess(address): <b>bool</b>
+ _addWhitelisted(address)
[Not supported by viewer]
+ _removeWhitelisted(address)
+ <font style="font-size: 14px">_</font>removeWhitelisted(address)
+ _addBlacklisted(address)
[Not supported by viewer]
+ _removeBlacklisted(address)
+ <font style="font-size: 14px">_</font>removeBlacklisted(address)
ETokenExplicitSender
ETokenExplicitSender
+ Whitelist: whitelist
+ Whitelist: whitelist
+ name: string
+ name: string
+ symbol: string
+ symbol: string
+ decimals: uint8
+ decimals: uint8
+ owner: address
+ owner: address
+ whitelistAddress: address
+ whitelistAddress: address
+ transfer(address, uint256): bool
+ transfer(address, uint256): <b>bool</b>
+ approve(address, uint256): bool
+ approve(address, uint256): <b>bool</b>
+ transferFrom(address, address, uint256): bool
+ transferFrom(address, address, uint256): <b>bool</b>
+ increaseAllowance(address, uint256): bool
+ increaseAllowance(address, uint256): <b>bool</b>
+ decreaseAllowance(address, uint256): bool
+ decreaseAllowance(address, uint256): <b>bool</b>
+ burn(uint256)
+ burn(uint256)
\ No newline at end of file diff --git a/docs/images/contracts_overview.svg b/docs/images/contracts_overview.svg index 1fdcc4d..8cfedb0 100644 --- a/docs/images/contracts_overview.svg +++ b/docs/images/contracts_overview.svg @@ -1,3 +1,3 @@ -
manager.etokenize.eth
manager.etokenize.eth<br>
Token Manager
Token Manager<br>
TokenX (1)
TokenX (1)
TokenX (n)
TokenX (n)
...
[Not supported by viewer]
Tokens
Tokens
MinterRole
MinterRole
PauserRole
PauserRole
BurnerRole
BurnerRole
Roles
Roles
AccessList
AccessList
accesslist.etokenize.eth
accesslist.etokenize.eth
WhitelistManagerRole
WhitelistManagerRole
ENS
ENS<br>
Token storage(1)
Token storage(1)
Token storage (n)
Token storage (n)
...
[Not supported by viewer]
Token balance storage
Token balance storage
BlacklistManagerRole
<div>BlacklistManagerRole</div>
\ No newline at end of file +
manager.etokenize.eth
manager.etokenize.eth<br>
Token Manager
Token Manager<br>
EToken (1)
EToken (1)
EToken (n)
EToken (n)
...
[Not supported by viewer]
Tokens
Tokens
MinterRole
MinterRole
PauserRole
PauserRole
BurnerRole
BurnerRole
Roles
Roles
AccessList
AccessList
accesslist.etokenize.eth
accesslist.etokenize.eth
WhitelistManagerRole
WhitelistManagerRole
ENS
ENS<br>
Token storage(1)
Token storage(1)
Token storage (n)
Token storage (n)
...
[Not supported by viewer]
Token balance storage
Token balance storage
BlacklistManagerRole
<div>BlacklistManagerRole</div>
\ No newline at end of file diff --git a/migrations/4_setup_accounts.js b/migrations/4_setup_accounts.js index b85f9cf..9545510 100644 --- a/migrations/4_setup_accounts.js +++ b/migrations/4_setup_accounts.js @@ -2,7 +2,7 @@ const Accesslist = artifacts.require('Accesslist'); const TokenManager = artifacts.require('TokenManager'); -const TokenX = artifacts.require('TokenX'); +const EToken = artifacts.require('EToken'); const ExternalERC20Storage = artifacts.require('ExternalERC20Storage'); module.exports = function (deployer, _network, accounts) { @@ -50,7 +50,7 @@ async function setupAccounts ([owner, whitelistAdmin, whitelisted, minter, ...re const tokens = await Promise.all( tokenDetails.map(async (td) => { const externalERC20Storage = await ExternalERC20Storage.new(); - const token = await TokenX.new( + const token = await EToken.new( td.name, td.symbol, td.decimals, accesslistContract.address, td.whitelistEnabled, externalERC20Storage.address, mintTargetAccount, 0, true, diff --git a/package.json b/package.json index 5043103..2e18253 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { - "name": "TokenX", + "name": "EToken", "version": "0.0.1", "main": "index.js", - "repository": "git@github.com:eTokenize/TokenX.git", + "repository": "git@github.com:eTokenize/EToken.git", "author": "eTokenize", "license": "UNLICENSED", "private": true, diff --git a/scripts/upgradeToken/upgradeTokenWrapper.js b/scripts/upgradeToken/upgradeTokenWrapper.js index 4c5f69c..a92194c 100644 --- a/scripts/upgradeToken/upgradeTokenWrapper.js +++ b/scripts/upgradeToken/upgradeTokenWrapper.js @@ -3,7 +3,7 @@ 'use strict'; const TokenManager = artifacts.require('TokenManager.sol'); -const TokenX = artifacts.require('./TokenX.sol'); +const EToken = artifacts.require('./EToken.sol'); const argv = require('optimist') .usage('Usage: --network [name] --tokenManager [address] --oldToken [address] --newToken [address] --tokenManagerOwner [address] --oldTokenOwner [address]') @@ -15,8 +15,8 @@ const upgradeToken = require('./upgradeToken'); async function upgradeTokenWrapper () { const tokenManager = TokenManager.at(argv.tokenManager); - const oldToken = TokenX.at(argv.oldToken); - const newToken = TokenX.at(argv.newToken); + const oldToken = EToken.at(argv.oldToken); + const newToken = EToken.at(argv.newToken); const tokenManagerOwner = argv.tokenManagerOwner; const oldTokenOwner = argv.oldTokenOwner; diff --git a/test/UpgradeToken.test.js b/test/UpgradeToken.test.js index 621bed6..82d4b73 100644 --- a/test/UpgradeToken.test.js +++ b/test/UpgradeToken.test.js @@ -5,7 +5,7 @@ const TokenManager = artifacts.require('TokenManager'); const Accesslist = artifacts.require('Accesslist'); -const TokenX = artifacts.require('TokenX'); +const EToken = artifacts.require('EToken'); const ExternalERC20Storage = artifacts.require('ExternalERC20Storage'); const util = require('./utils.js'); @@ -30,13 +30,13 @@ contract('Upgrade Token', async function ([_, tokenManagerOwner, oldTokenOwner, const storage = await ExternalERC20Storage.new({ from: storageOwner }); - const oldToken = await TokenX.new( + const oldToken = await EToken.new( tokenName, 'e', oldTokenDecimals, accesslist.address, true, storage.address, 0xf00f, 0, true, { from: oldTokenOwner } ); - const newToken = await TokenX.new( + const newToken = await EToken.new( tokenName, 'e', newTokenDecimals, accesslist.address, true, storage.address, 0xf00f, oldToken.address, false, diff --git a/test/token/TokenX.events.js b/test/token/EToken.events.js similarity index 100% rename from test/token/TokenX.events.js rename to test/token/EToken.events.js diff --git a/test/token/TokenX.test.js b/test/token/EToken.test.js similarity index 97% rename from test/token/TokenX.test.js rename to test/token/EToken.test.js index 9f307c8..8667533 100644 --- a/test/token/TokenX.test.js +++ b/test/token/EToken.test.js @@ -15,8 +15,8 @@ const { shouldBehaveLikeERC20Pausable } = const util = require('./../utils.js'); const Accesslist = artifacts.require('Accesslist'); -const TokenXMock = artifacts.require('TokenXMock'); -const TokenXE = require('./TokenX.events.js'); +const ETokenMock = artifacts.require('ETokenMock'); +const ETokenE = require('./EToken.events.js'); const ExternalERC20Storage = artifacts.require('ExternalERC20Storage'); const BigNumber = web3.BigNumber; @@ -189,7 +189,7 @@ function ERC20Permissions (owner, whitelisted, other, other1, blacklisted, black }); } -contract('TokenX', async function ( +contract('EToken', async function ( [owner, minter, pauser, otherPauser, burner, whitelistAdmin, whitelisted, whitelisted1, blacklisted, blacklisted1, blackwhite, blackwhite1, user, user1, ...restAccounts]) { @@ -210,7 +210,7 @@ contract('TokenX', async function ( it('reverts when both upgradedFrom and initialDeployment are set', async function () { await util.assertRevertsReason( - TokenXMock.new(tokNameOrig, symbolOrig, 10, + ETokenMock.new(tokNameOrig, symbolOrig, 10, 0xf00f, true, storage.address, mintingRecipientAccount, 0xf00f, true, owner, 100, { from: owner }), 'Cannot both be upgraded and initial deployment.'); @@ -218,7 +218,7 @@ contract('TokenX', async function ( it('reverts when niether upgradedFrom or initialDeployment are set', async function () { await util.assertRevertsReason( - TokenXMock.new(tokNameOrig, symbolOrig, 10, + ETokenMock.new(tokNameOrig, symbolOrig, 10, 0xf00f, true, storage.address, mintingRecipientAccount, 0, false, owner, 100, { from: owner }), 'Cannot both be upgraded and initial deployment.'); @@ -237,11 +237,11 @@ contract('TokenX', async function ( accesslist = await Accesslist.new({ from: owner }); storage = await ExternalERC20Storage.new({ from: owner }); - token = await TokenXMock.new(tokNameOrig, symbolOrig, 10, + token = await ETokenMock.new(tokNameOrig, symbolOrig, 10, accesslist.address, true, storage.address, mintingRecipientAccount, 0, true, owner, 100, { from: owner }); - tokenE = TokenXE.wrap(token); - upgradeToken = await TokenXMock.new( + tokenE = ETokenE.wrap(token); + upgradeToken = await ETokenMock.new( tokNameUpgraded, symbolUpgraded, 20, accesslist.address, true, storage.address, mintingRecipientAccount, token.address, false, 0, 0, { from: owner }); diff --git a/test/token/TokenXExplicitSender.events.js b/test/token/ETokenExplicitSender.events.js similarity index 100% rename from test/token/TokenXExplicitSender.events.js rename to test/token/ETokenExplicitSender.events.js diff --git a/test/token/TokenXExplicitSender.test.js b/test/token/ETokenExplicitSender.test.js similarity index 78% rename from test/token/TokenXExplicitSender.test.js rename to test/token/ETokenExplicitSender.test.js index 8e34e8f..de44f23 100644 --- a/test/token/TokenXExplicitSender.test.js +++ b/test/token/ETokenExplicitSender.test.js @@ -7,8 +7,8 @@ const util = require('./../utils.js'); const Accesslist = artifacts.require('Accesslist'); const ExternalERC20Storage = artifacts.require('ExternalERC20Storage'); -const TokenXExplicitSender = artifacts.require('TokenXExplicitSenderMock'); -const TokenXExplicitSenderE = require('./TokenXExplicitSender.events.js'); +const ETokenExplicitSender = artifacts.require('ETokenExplicitSenderMock'); +const ETokenExplicitSenderE = require('./ETokenExplicitSender.events.js'); const BigNumber = web3.BigNumber; @@ -16,7 +16,7 @@ require('chai') .use(require('chai-bignumber')(BigNumber)) .should(); -contract('TokenXExplicitSender', function ([owner, someAddress, ...rest]) { +contract('ETokenExplicitSender', function ([owner, someAddress, ...rest]) { describe('finalizeUpgrade', function () { let accesslist; let storage; @@ -27,7 +27,7 @@ contract('TokenXExplicitSender', function ([owner, someAddress, ...rest]) { }); it('reverts when no upgradeFrom contract is set', async function () { - const token = await TokenXExplicitSender.new('tok', 't', 10, + const token = await ETokenExplicitSender.new('tok', 't', 10, accesslist.address, true, storage.address, 0, true, { from: owner }); await util.assertRevertsReason(token.finalizeUpgrade({ from: someAddress }), @@ -35,7 +35,7 @@ contract('TokenXExplicitSender', function ([owner, someAddress, ...rest]) { }); it('reverts when wrong contract finalizes upgrade', async function () { - const token = await TokenXExplicitSender.new('tok', 't', 10, + const token = await ETokenExplicitSender.new('tok', 't', 10, accesslist.address, true, storage.address, 0xf00f, false, { from: owner }); await util.assertRevertsReason(token.finalizeUpgrade({ from: someAddress }), @@ -43,14 +43,14 @@ contract('TokenXExplicitSender', function ([owner, someAddress, ...rest]) { }); it('emits UpgradeFinalized event', async function () { - const token = await TokenXExplicitSender.new( + const token = await ETokenExplicitSender.new( 'tok', 't', 10, accesslist.address, true, storage.address, owner, false, { from: owner }); - const tokenE = TokenXExplicitSenderE.wrap(token); + const tokenE = ETokenExplicitSenderE.wrap(token); await tokenE.finalizeUpgrade(owner, owner, { from: owner }); }); }); - // Remainder of contract tested through TokenX. + // Remainder of contract tested through EToken. });