Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USDC v2.2 #357

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@
},
"[typescript]": {
"editor.formatOnSave": true
}
},
"solidity.compileUsingRemoteVersion": "v0.6.12+commit.27d51765"
}
74 changes: 74 additions & 0 deletions contracts/test/UpgradedFiatTokenNewFieldsV2_2Test.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/**
* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

pragma solidity 0.6.12;

import { FiatTokenV2_2 } from "../v2/FiatTokenV2_2.sol";

/**
* @title UpgradedFiatTokenNewFieldsTest
* @dev ERC20 Token backed by fiat reserves
*/
contract UpgradedFiatTokenNewFieldsV2_2Test is FiatTokenV2_2 {
bool public newBool;
address public newAddress;
uint256 public newUint;
bool internal initializedV2;

function initialize(
string calldata tokenName,
string calldata tokenSymbol,
string calldata tokenCurrency,
uint8 tokenDecimals,
address newMasterMinter,
address newPauser,
address newBlacklister,
address newOwner,
bool _newBool,
address _newAddress,
uint256 _newUint
) external {
super.initialize(
tokenName,
tokenSymbol,
tokenCurrency,
tokenDecimals,
newMasterMinter,
newPauser,
newBlacklister,
newOwner
);
initV2(_newBool, _newAddress, _newUint);
}

function initV2(
bool _newBool,
address _newAddress,
uint256 _newUint
) public {
require(!initializedV2, "contract is already initialized");
newBool = _newBool;
newAddress = _newAddress;
newUint = _newUint;
initializedV2 = true;
}
}
33 changes: 33 additions & 0 deletions contracts/test/UpgradedFiatTokenV2_2.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

pragma solidity 0.6.12;

import { FiatTokenV2_2 } from "../v2/FiatTokenV2_2.sol";

/**
* @title UpgradedFiatToken
* @dev ERC20 Token backed by fiat reserves
*/
contract UpgradedFiatTokenV2_2 is FiatTokenV2_2 {

}
8 changes: 4 additions & 4 deletions contracts/v1/Blacklistable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ contract Blacklistable is Ownable {
* @dev Throws if argument account is blacklisted
* @param _account The address to check
*/
modifier notBlacklisted(address _account) {
modifier notBlacklisted(address _account) virtual {
require(
!blacklisted[_account],
"Blacklistable: account is blacklisted"
Expand All @@ -65,15 +65,15 @@ contract Blacklistable is Ownable {
* @dev Checks if account is blacklisted
* @param _account The address to check
*/
function isBlacklisted(address _account) external view returns (bool) {
function isBlacklisted(address _account) virtual external view returns (bool) {
return blacklisted[_account];
}

/**
* @dev Adds account to blacklist
* @param _account The address to blacklist
*/
function blacklist(address _account) external onlyBlacklister {
function blacklist(address _account) virtual external onlyBlacklister {
blacklisted[_account] = true;
emit Blacklisted(_account);
}
Expand All @@ -82,7 +82,7 @@ contract Blacklistable is Ownable {
* @dev Removes account from blacklist
* @param _account The address to remove from the blacklist
*/
function unBlacklist(address _account) external onlyBlacklister {
function unBlacklist(address _account) virtual external onlyBlacklister {
blacklisted[_account] = false;
emit UnBlacklisted(_account);
}
Expand Down
6 changes: 5 additions & 1 deletion contracts/v1/FiatTokenV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ contract FiatTokenV1 is AbstractFiatTokenV1, Ownable, Pausable, Blacklistable {
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount)
virtual
external
whenNotPaused
onlyMinters
Expand Down Expand Up @@ -190,6 +191,7 @@ contract FiatTokenV1 is AbstractFiatTokenV1, Ownable, Pausable, Blacklistable {
* @param account address The account
*/
function balanceOf(address account)
virtual
external
override
view
Expand Down Expand Up @@ -246,6 +248,7 @@ contract FiatTokenV1 is AbstractFiatTokenV1, Ownable, Pausable, Blacklistable {
address to,
uint256 value
)
virtual
external
override
whenNotPaused
Expand All @@ -270,6 +273,7 @@ contract FiatTokenV1 is AbstractFiatTokenV1, Ownable, Pausable, Blacklistable {
* @return True if successful
*/
function transfer(address to, uint256 value)
virtual
external
override
whenNotPaused
Expand All @@ -291,7 +295,7 @@ contract FiatTokenV1 is AbstractFiatTokenV1, Ownable, Pausable, Blacklistable {
address from,
address to,
uint256 value
) internal override {
) virtual internal override {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(
Expand Down
4 changes: 2 additions & 2 deletions contracts/v2/FiatTokenV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ contract FiatTokenV2 is FiatTokenV1_1, EIP3009, EIP2612 {
uint8 v,
bytes32 r,
bytes32 s
) external whenNotPaused notBlacklisted(from) notBlacklisted(to) {
) virtual external whenNotPaused notBlacklisted(from) notBlacklisted(to) {
_transferWithAuthorization(
from,
to,
Expand Down Expand Up @@ -144,7 +144,7 @@ contract FiatTokenV2 is FiatTokenV1_1, EIP3009, EIP2612 {
uint8 v,
bytes32 r,
bytes32 s
) external whenNotPaused notBlacklisted(from) notBlacklisted(to) {
) virtual external whenNotPaused notBlacklisted(from) notBlacklisted(to) {
_receiveWithAuthorization(
from,
to,
Expand Down
2 changes: 1 addition & 1 deletion contracts/v2/FiatTokenV2_1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ contract FiatTokenV2_1 is FiatTokenV2 {
* @notice Version string for the EIP712 domain separator
* @return Version string
*/
function version() external view returns (string memory) {
function version() virtual external view returns (string memory) {
return "2";
}
}
Loading