-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Misc. Fixes to HybridUSDCTokenPool (#14922)
* copy files from PR on ccip repo and re-open * forgot to include changeset file * [Bot] Update changeset file with jira issues --------- Co-authored-by: app-token-issuer-infra-releng[bot] <120227048+app-token-issuer-infra-releng[bot]@users.noreply.github.com>
- Loading branch information
1 parent
af81323
commit 42db9fd
Showing
7 changed files
with
289 additions
and
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
'@chainlink/contracts': patch | ||
--- | ||
|
||
Minor fixes to formatting, pragma, imports, etc. for Hybrid USDC Token Pools #bugfix | ||
|
||
|
||
PR issue: CCIP-3014 | ||
|
||
Solidity Review issue: CCIP-3966 |
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
42 changes: 42 additions & 0 deletions
42
contracts/src/v0.8/ccip/pools/USDC/BurnMintWithLockReleaseFlagTokenPool.sol
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,42 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity 0.8.24; | ||
|
||
import {IBurnMintERC20} from "../../../shared/token/ERC20/IBurnMintERC20.sol"; | ||
|
||
import {Pool} from "../../libraries/Pool.sol"; | ||
import {BurnMintTokenPool} from "../BurnMintTokenPool.sol"; | ||
import {LOCK_RELEASE_FLAG} from "./HybridLockReleaseUSDCTokenPool.sol"; | ||
|
||
/// @notice A standard BurnMintTokenPool with modified destPoolData so that the remote pool knows to release tokens | ||
/// instead of minting. This enables interoperability with HybridLockReleaseUSDCTokenPool which uses | ||
// the destPoolData to determine whether to mint or release tokens. | ||
/// @dev The only difference between this contract and BurnMintTokenPool is the destPoolData returns the | ||
/// abi-encoded LOCK_RELEASE_FLAG instead of an empty string. | ||
contract BurnMintWithLockReleaseFlagTokenPool is BurnMintTokenPool { | ||
constructor( | ||
IBurnMintERC20 token, | ||
address[] memory allowlist, | ||
address rmnProxy, | ||
address router | ||
) BurnMintTokenPool(token, allowlist, rmnProxy, router) {} | ||
|
||
/// @notice Burn the token in the pool | ||
/// @dev The _validateLockOrBurn check is an essential security check | ||
/// @dev Performs the exact same functionality as BurnMintTokenPool, but returns the LOCK_RELEASE_FLAG | ||
/// as the destPoolData to signal to the remote pool to release tokens instead of minting them. | ||
function lockOrBurn( | ||
Pool.LockOrBurnInV1 calldata lockOrBurnIn | ||
) external override returns (Pool.LockOrBurnOutV1 memory) { | ||
_validateLockOrBurn(lockOrBurnIn); | ||
|
||
_burn(lockOrBurnIn.amount); | ||
|
||
emit Burned(msg.sender, lockOrBurnIn.amount); | ||
|
||
// LOCK_RELEASE_FLAG = bytes4(keccak256("NO_CCTP_USE_LOCK_RELEASE")) | ||
return Pool.LockOrBurnOutV1({ | ||
destTokenAddress: getRemoteToken(lockOrBurnIn.remoteChainSelector), | ||
destPoolData: abi.encode(LOCK_RELEASE_FLAG) | ||
}); | ||
} | ||
} |
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.