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

Fiat Token v2.2 #425

Merged
merged 25 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ed7b130
Setup repo and CI
circle-aloychan Jul 11, 2023
0c71a91
Cached chain ID and domain separator
yvonnezhangc Jul 19, 2023
99dcc17
Create V2_2Upgrader.sol
circle-aloychan Jul 13, 2023
41e65fb
Refactor upgraders
circle-aloychan Jul 21, 2023
5169071
Add EIP-1271 related utility contracts
yvonnezhangc Jul 27, 2023
8332ba5
Re-route EIP-2612 and EIP-3009 functions to use SignatureChecker
yvonnezhangc Aug 1, 2023
ad75174
Add unified interface for EOA and contract wallet signatures
yvonnezhangc Aug 8, 2023
1ed8f78
Blacklist updates (part 1)
circle-aloychan Jul 28, 2023
dd03da9
Blacklist updates (part 2)
circle-aloychan Aug 16, 2023
5119a85
Allow omission of deadline check in permit
yvonnezhangc Aug 10, 2023
0a041df
Remove unused imports and fix solhint warnings
yvonnezhangc Aug 17, 2023
e5e7a2a
Remove blacklist modifier
yvonnezhangc Aug 17, 2023
77e230b
Update / add NatSpec documentations
circle-aloychan Aug 18, 2023
2c67e26
Allow symbol renaming in FiatTokenV2_2.initializeV2_2
yvonnezhangc Aug 30, 2023
9f64031
Centralize ganache accounts initialization
yvonnezhangc Sep 6, 2023
70800ee
Add script to get blacklisted accounts
circle-aloychan Sep 18, 2023
684d187
Address TODOs
circle-aloychan Oct 13, 2023
e70c672
Add script to call read-only functions on a contract
circle-aloychan Oct 13, 2023
f2cdf23
Add deploy script for MockERC1271 wallet
yvonnezhangc Oct 13, 2023
661a79a
Remove custom-error rule from solhint
yvonnezhangc Oct 17, 2023
a1b5455
Update copyright licenses
yvonnezhangc Aug 17, 2023
08e3b16
Update documentations
circle-aloychan Oct 13, 2023
35d66ae
Add migration option to directly deploy v2.2 token
yvonnezhangc Oct 19, 2023
acdd059
Update validateAccountsToBlacklist
circle-aloychan Oct 24, 2023
dd6fb33
Add CHANGELOG.md
circle-aloychan Oct 24, 2023
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
18 changes: 18 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/**
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2023, Circle Internet Financial, LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

module.exports = {
root: true,
env: {
Expand Down
15 changes: 0 additions & 15 deletions .githooks/pre-commit

This file was deleted.

11 changes: 11 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Summary

## Detail

## Testing

## Documentation

---

**Requested Reviewers:** @mention
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Continuous Integration
on:
pull_request:

jobs:
run_ci_tests:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3

- name: Install Node
uses: actions/setup-node@v3
with:
node-version: "16.14.0"

- name: Install Yarn
run: npm install -g [email protected]

- name: Install packages
run: yarn install --frozen-lockfile

- name: Setup local environment
run: cp config.js.example config.js && ./start-ganache.sh

- name: Run static checks
run: yarn static-check

- name: Run size check
run: yarn contract-size

- name: Run tests
run: yarn test
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ validate/apikey.infura
ganache-blockchain-log.txt
.coverage_artifacts
.coverage_contracts
yarn-error.log
@types/generated/
config.js
blacklist.*.json
!blacklist.test.json
out/
cache/

# Yarn & Node Modules
yarn-error.log
node_modules/

logs/
pids/
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn precommit
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v16.14.0
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ coverage.json
build/
.coverage_contracts/
.coverage_artifacts/
LICENSE
18 changes: 18 additions & 0 deletions .solcover.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/**
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2023, Circle Internet Financial, LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

module.exports = {
providerOptions: {
port: 8555,
Expand Down
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"juanblanco.solidity"
"juanblanco.solidity",
"ymotongpoo.licenser"
]
}
14 changes: 8 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"files.exclude": {
"**/.DS_Store": true,
"**/node_modules/": true
},
"solidity.packageDefaultDependenciesContractsDirectory": "",
"solidity.packageDefaultDependenciesDirectory": "node_modules",
"solidity.formatter": "none",
Expand All @@ -21,9 +17,15 @@
},
"[solidity]": {
"editor.tabSize": 4,
"editor.formatOnSave": true
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.formatOnSave": true
}
},
"typescript.tsdk": "node_modules/typescript/lib",
"licenser.license": "Custom",
"licenser.customHeader": "SPDX-License-Identifier: Apache-2.0\n\nCopyright (c) @YEAR@, Circle Internet Financial, LLC.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.",
"licenser.useSingleLineStyle": false,
"files.autoSave": "onFocusChange"
}
35 changes: 35 additions & 0 deletions @types/AnyFiatTokenV2Instance.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2023, Circle Internet Financial, LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import {
FiatTokenV2Instance,
FiatTokenV21Instance,
FiatTokenV22Instance,
} from "./generated";

export interface FiatTokenV22InstanceExtended extends FiatTokenV22Instance {
permit?: typeof FiatTokenV2Instance.permit;
transferWithAuthorization?: typeof FiatTokenV2Instance.transferWithAuthorization;
receiveWithAuthorization?: typeof FiatTokenV2Instance.receiveWithAuthorization;
cancelAuthorization?: typeof FiatTokenV2Instance.cancelAuthorization;
}

export type AnyFiatTokenV2Instance =
| FiatTokenV2Instance
| FiatTokenV21Instance
| FiatTokenV22InstanceExtended;
18 changes: 18 additions & 0 deletions @types/TransactionRawLog.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/**
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2023, Circle Internet Financial, LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export interface TransactionRawLog {
logIndex: number;
transactionIndex: number;
Expand Down
47 changes: 47 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Changelog

## 2.2.0 (2023-11-09)

- Add ERC-1271 signature validation support to EIP-2612 and EIP-3009 functions
- Combine the balance state and the blacklist state for an address in a
`balanceAndBlacklistStates` map to reduce gas usage
- Update `DOMAIN_SEPARATOR` to be a dynamic value
- Remove `notBlacklisted` modifiers for `approve`, `increaseAllowance`,
`decreaseAllowance` and `permit`
- Enable bypassing `TIMESTAMP` opcode in `permit` by using `uint256.max`

## 2.1.1 (2021-06-03)

- Add the multi-issuer minter contracts from the `multi-issuer` branch

## 2.1.0 (2021-02-17)

- Move locked USDC to a "lost and found" address and blacklists itself so that
accidental sends will no longer be possible
- Conform to EIP-3009 in FiatToken
- Add `receiveWithAuthorization`
- Remove `approveWithAuthorization`, `increaseAllowanceWithAuthorization` and
`decreaseAllowanceWithAuthorization`

## 2.0.0 (2020-07-30)

- Add support for EIP-2612 in FiatToken
- Add `transferWithAuthorization`, `approveWithAuthorization`,
`increaseAllowanceWithAuthorization`, `decreaseAllowanceWithAuthorization` to
enable ETH-less transactions
- Add `increaseAllowance` and `decreaseAllowance` to mitigate the
multi-withdrawal attack vulnerability in ERC-20 `approve` function
- Update Solidity version to `0.6.12`

## 1.1.0 (2020-05-27)

- Add Rescuable functionalities to FiatToken
- Update Solidity version to `0.6.8`
- Remove `ifAdmin` modifier from admin() and implementation() in FiatTokenProxy

## 1.0.0 (2018-07-24)

- Create ERC-20 compliant FiatToken contract
- Add Ownable, Pausable and Blacklistable functionalities to FiatToken
- Create FiatTokenProxy contracts based on Zeppelinos's Unstructured-Storage
Proxy pattern
6 changes: 0 additions & 6 deletions Dockerfile.ganache

This file was deleted.

8 changes: 0 additions & 8 deletions Dockerfile.truffle

This file was deleted.

Loading