-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'svm-dev' into chrismaree/c-01-fix-non-claim-relaier-ref…
…und-address
- Loading branch information
Showing
81 changed files
with
8,108 additions
and
1,299 deletions.
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
Validating CODEOWNERS rules …
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,17 @@ | ||
|
||
# This is a comment. | ||
# Each line is a file pattern followed by one or more owners. | ||
# Note: CODEOWNERS are automatically requested for review on relevant PRs. | ||
# Order is important; the last matching pattern takes the most | ||
# precedence. | ||
|
||
# These owners will be the default owners for everything in | ||
# the repo unless a later match takes precedence. | ||
* @mrice32 @nicholaspai @pxrl @bmzig | ||
|
||
# Solana | ||
/programs/ @mrice32 @nicholaspai @chrismaree @Reinis-FRP @md0x | ||
/scripts/svm/ @mrice32 @nicholaspai @chrismaree @Reinis-FRP @md0x | ||
/src/svm/ @mrice32 @nicholaspai @chrismaree @Reinis-FRP @md0x | ||
/test/svm/ @mrice32 @nicholaspai @chrismaree @Reinis-FRP @md0x | ||
|
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,72 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.0; | ||
import "@eth-optimism/contracts/libraries/constants/Lib_PredeployAddresses.sol"; | ||
|
||
import "./Ovm_SpokePool.sol"; | ||
import "./external/interfaces/CCTPInterfaces.sol"; | ||
import { IOpUSDCBridgeAdapter } from "./external/interfaces/IOpUSDCBridgeAdapter.sol"; | ||
|
||
/** | ||
* @notice Ink Spoke pool. | ||
* @custom:security-contact [email protected] | ||
*/ | ||
contract Ink_SpokePool is Ovm_SpokePool { | ||
using SafeERC20 for IERC20; | ||
|
||
// Address of the custom L2 USDC bridge. | ||
address private constant USDC_BRIDGE = address(0); | ||
|
||
/// @custom:oz-upgrades-unsafe-allow constructor | ||
constructor( | ||
address _wrappedNativeTokenAddress, | ||
uint32 _depositQuoteTimeBuffer, | ||
uint32 _fillDeadlineBuffer, | ||
IERC20 _l2Usdc, | ||
ITokenMessenger _cctpTokenMessenger | ||
) | ||
Ovm_SpokePool( | ||
_wrappedNativeTokenAddress, | ||
_depositQuoteTimeBuffer, | ||
_fillDeadlineBuffer, | ||
_l2Usdc, | ||
_cctpTokenMessenger | ||
) | ||
{} // solhint-disable-line no-empty-blocks | ||
|
||
/** | ||
* @notice Construct the OVM World Chain SpokePool. | ||
* @param _initialDepositId Starting deposit ID. Set to 0 unless this is a re-deployment in order to mitigate | ||
* relay hash collisions. | ||
* @param _crossDomainAdmin Cross domain admin to set. Can be changed by admin. | ||
* @param _withdrawalRecipient Address which receives token withdrawals. Can be changed by admin. For Spoke Pools on L2, this will | ||
*/ | ||
function initialize( | ||
uint32 _initialDepositId, | ||
address _crossDomainAdmin, | ||
address _withdrawalRecipient | ||
) public initializer { | ||
__OvmSpokePool_init(_initialDepositId, _crossDomainAdmin, _withdrawalRecipient, Lib_PredeployAddresses.OVM_ETH); | ||
} | ||
|
||
/** | ||
* @notice Ink-specific logic to bridge tokens back to the hub pool contract on L1. | ||
* @param amountToReturn Amount of the token to bridge back. | ||
* @param l2TokenAddress Address of the l2 Token to bridge back. This token will either be bridged back to the token defined in the mapping `remoteL1Tokens`, | ||
* or via the canonical mapping defined in the bridge contract retrieved from `tokenBridges`. | ||
* @dev This implementation deviates slightly from `_bridgeTokensToHubPool` in the `Ovm_SpokePool` contract since World Chain has a USDC bridge which uses | ||
* a custom interface. This is because the USDC token on World Chain is meant to be upgraded to a native, CCTP supported version in the future. | ||
*/ | ||
function _bridgeTokensToHubPool(uint256 amountToReturn, address l2TokenAddress) internal virtual override { | ||
// Handle custom USDC bridge which doesn't conform to the standard bridge interface. In the future, CCTP may be used to bridge USDC to mainnet, in which | ||
// case bridging logic is handled by the Ovm_SpokePool code. In the meantime, if CCTP is not enabled, then use the USDC bridge. Once CCTP is activated on | ||
// WorldChain, this block of code will be unused. | ||
if (l2TokenAddress == address(usdcToken) && !_isCCTPEnabled()) { | ||
usdcToken.safeIncreaseAllowance(USDC_BRIDGE, amountToReturn); | ||
IOpUSDCBridgeAdapter(USDC_BRIDGE).sendMessage( | ||
withdrawalRecipient, // _to. Withdraw, over the bridge, to the l1 hub pool contract. | ||
amountToReturn, // _amount. | ||
l1Gas // _minGasLimit. Same value used in other OpStack bridges. | ||
); | ||
} else super._bridgeTokensToHubPool(amountToReturn, l2TokenAddress); | ||
} | ||
} |
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,28 @@ | ||
import { DeployFunction } from "hardhat-deploy/types"; | ||
import { HardhatRuntimeEnvironment } from "hardhat/types"; | ||
import { deployNewProxy, getSpokePoolDeploymentInfo } from "../utils/utils.hre"; | ||
import { FILL_DEADLINE_BUFFER, WETH, QUOTE_TIME_BUFFER, ZERO_ADDRESS } from "./consts"; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const { hubPool, spokeChainId } = await getSpokePoolDeploymentInfo(hre); | ||
|
||
const initArgs = [ | ||
1, | ||
// Set hub pool as cross domain admin since it delegatecalls the Adapter logic. | ||
hubPool.address, | ||
hubPool.address, | ||
]; | ||
const constructorArgs = [ | ||
WETH[spokeChainId], | ||
QUOTE_TIME_BUFFER, | ||
FILL_DEADLINE_BUFFER, | ||
ZERO_ADDRESS, | ||
// L2_ADDRESS_MAP[spokeChainId].cctpTokenMessenger, | ||
// For now, we are not using the CCTP bridge and can disable by setting | ||
// the cctpTokenMessenger to the zero address. | ||
ZERO_ADDRESS, | ||
]; | ||
await deployNewProxy("Ink_SpokePool", constructorArgs, initArgs); | ||
}; | ||
module.exports = func; | ||
func.tags = ["InkSpokePool", "ink"]; |
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
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 @@ | ||
57073 |
Oops, something went wrong.