forked from circlefin/stablecoin-evm
-
Notifications
You must be signed in to change notification settings - Fork 1
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
add OptimismMintableFiatTokenV2_2 #1
Open
alvrs
wants to merge
21
commits into
master
Choose a base branch
from
alvrs/optimism
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 14 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
89a7982
add OptimismFiatTokenV2_2
alvrs 9997137
add natspec
alvrs 9e471ed
use predeploy bridge
alvrs adcd09d
call parent constructor
alvrs 224bba5
add tests
alvrs 4e1a072
use kwargs style syntax
alvrs d2887f4
revert changes to package.json
alvrs 5144f94
remove unused variable
alvrs 312f27d
remove todo
alvrs 174f0e4
add script to set token's bridge address
alvrs a9e5131
update param names
alvrs 670f674
make l1 token optional
alvrs 2e295a2
move view function out of broadcast
alvrs 4466a7e
move view function out of broadcast
alvrs 4703175
fix: add burn function with _from param
alvrs fd2c580
add upgrade script
alvrs 2e6dd3f
remove unused variable
alvrs 9edbf79
emit msg.sender as minter
alvrs 67ed7e6
respect blacklist in burn
alvrs 891d66e
minor upgrade script polish
alvrs fb58394
ignore _from blacklist in burn
alvrs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.6.12; | ||
|
||
import { IERC165 } from "@openzeppelin/contracts/introspection/IERC165.sol"; | ||
|
||
/** | ||
* @title IOptimismMintableERC20 | ||
* @notice This interface is available on the OptimismMintableERC20 contract. | ||
* We declare it as a separate interface so that it can be used in | ||
* custom implementations of OptimismMintableERC20. | ||
* @notice From https://github.com/ethereum-optimism/optimism/blob/6b231760b3f352d5c4f6df8431b67d836f316f84/packages/contracts-bedrock/src/universal/IOptimismMintableERC20.sol#L10-L18 | ||
*/ | ||
interface IOptimismMintableERC20 is IERC165 { | ||
function remoteToken() external view returns (address); | ||
|
||
function bridge() external returns (address); | ||
|
||
function mint(address _to, uint256 _amount) external; | ||
|
||
function burn(address _from, uint256 _amount) external; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.6.12; | ||
|
||
import { FiatTokenV1 } from "../v1/FiatTokenV1.sol"; | ||
import { FiatTokenV2_2 } from "./FiatTokenV2_2.sol"; | ||
import { IOptimismMintableERC20 } from "./IOptimismMintableERC20.sol"; | ||
import { IERC165 } from "@openzeppelin/contracts/introspection/IERC165.sol"; | ||
|
||
/** | ||
* @title OptimismFiatTokenV2_2 | ||
* @author Lattice (https://lattice.xyz) | ||
* @notice Adds compatibility with IOptimismMintableERC20 to the Bridged USDC Standard, | ||
* so it can be used with Optimism's StandardBridge. | ||
* @dev This contract does not extend `IOptimismMintableERC20` to avoid the requirement to override `mint` and `burn` functions. | ||
*/ | ||
contract OptimismFiatTokenV2_2 is FiatTokenV2_2, IERC165 { | ||
address private immutable l1RemoteToken; | ||
|
||
constructor(address _l1RemoteToken) public FiatTokenV2_2() { | ||
l1RemoteToken = _l1RemoteToken; | ||
} | ||
|
||
function remoteToken() external view returns (address) { | ||
return l1RemoteToken; | ||
} | ||
|
||
function bridge() external pure returns (address) { | ||
// OP Stack L2StandardBridge predeploy | ||
// https://specs.optimism.io/protocol/predeploys.html | ||
return address(0x4200000000000000000000000000000000000010); | ||
} | ||
|
||
function supportsInterface(bytes4 interfaceId) | ||
external | ||
override | ||
view | ||
returns (bool) | ||
{ | ||
return | ||
interfaceId == type(IOptimismMintableERC20).interfaceId || | ||
interfaceId == type(IERC165).interfaceId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.6.12; | ||
|
||
import "forge-std/console.sol"; // solhint-disable no-global-import, no-console | ||
import { Script } from "forge-std/Script.sol"; | ||
import { | ||
OptimismFiatTokenV2_2 | ||
} from "../../contracts/v2/OptimismFiatTokenV2_2.sol"; | ||
import { MasterMinter } from "../../contracts/minting/MasterMinter.sol"; | ||
|
||
/** | ||
* A utility script to set the token's l2StandardBridge as the minter | ||
*/ | ||
contract SetL2StandardBridge is Script { | ||
/** | ||
* @notice main function that will be run by forge | ||
*/ | ||
function run( | ||
address masterMinterOwner, | ||
OptimismFiatTokenV2_2 optimismFiatTokenV2_2 | ||
) external { | ||
address l2StandardBridge = optimismFiatTokenV2_2.bridge(); | ||
if (l2StandardBridge == address(0)) { | ||
revert("Expected no-zero bridge address"); | ||
} | ||
MasterMinter masterMinter = MasterMinter( | ||
optimismFiatTokenV2_2.masterMinter() | ||
); | ||
|
||
vm.startBroadcast(masterMinterOwner); | ||
masterMinter.configureController(masterMinterOwner, l2StandardBridge); | ||
masterMinter.configureMinter(type(uint256).max); | ||
masterMinter.removeController(masterMinterOwner); | ||
vm.stopBroadcast(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused import, can remove