Skip to content
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
637fb40
some scaffolding
sparrowDom Dec 5, 2025
7630f6d
add basic necessities for unit tests
sparrowDom Dec 5, 2025
6a97767
checkpoint
shahthepro Dec 11, 2025
9517fca
Fix compiling issues
shahthepro Dec 11, 2025
41f1fd9
Add fork test scaffolding
shahthepro Dec 12, 2025
7a109cc
Fix stuffs
shahthepro Dec 12, 2025
48d317e
Prettify and change salt
shahthepro Dec 13, 2025
c6a254a
Add auto-verification
shahthepro Dec 13, 2025
8f4e39e
Fix checkBalance
shahthepro Dec 13, 2025
f7a9b97
Make CCTPHookWrapper more resilient
shahthepro Dec 15, 2025
b3c1eb4
refactor message version and type checks
sparrowDom Dec 15, 2025
d3c4a39
add some comments
sparrowDom Dec 16, 2025
792c890
add comment
sparrowDom Dec 16, 2025
70166bc
fix compile errors
sparrowDom Dec 16, 2025
1e700b1
Change addresses
shahthepro Dec 17, 2025
7d60614
Cross chain changes (#2718)
sparrowDom Dec 18, 2025
ada1546
Merge branch 'master' into shah/cross-chain-strategy-cctpv2
shahthepro Dec 18, 2025
987dc0a
Fix compilation issues
shahthepro Dec 18, 2025
b63bd5f
Fix deployment files a bit
shahthepro Dec 18, 2025
bf1fbe2
Fix Message relayer
shahthepro Dec 18, 2025
a0dd07b
Clean up master strategy
shahthepro Dec 18, 2025
4071943
Fix deployment file name
shahthepro Dec 18, 2025
9e36485
move around stuff
shahthepro Dec 18, 2025
e401fa1
Fix CCTP Integrator
shahthepro Dec 18, 2025
73abf6c
clean up fork
shahthepro Dec 19, 2025
266ec01
Fix race condition (#2720)
shahthepro Dec 19, 2025
122fa32
Cleanup code
shahthepro Dec 19, 2025
7507994
decode payloads in fork tests
shahthepro Dec 19, 2025
7998ffa
Add library for message handling
shahthepro Dec 19, 2025
e34706a
More changes
shahthepro Dec 19, 2025
df59d53
Add comments and prettify
shahthepro Dec 20, 2025
29ee0e6
WIP Unit test setup (#2722)
sparrowDom Dec 22, 2025
a0d5379
Add more fork tests
shahthepro Dec 22, 2025
3585d9d
Add token transfer tests
shahthepro Dec 23, 2025
e694906
WIP Unit tests for OUSD Simplified strategy (#2724)
sparrowDom Dec 24, 2025
77bc730
Fix master fork tests
shahthepro Dec 24, 2025
6dca3cc
linter
shahthepro Dec 24, 2025
7de74b4
add direct withdrawal paths and additional checks
sparrowDom Dec 24, 2025
fb31b79
Fix Remote strategy tests
shahthepro Dec 25, 2025
54ca3c0
Update comments and clean up code
shahthepro Dec 26, 2025
5ac664c
Fix comment
shahthepro Dec 26, 2025
b16c7fd
Fix failing unit test
shahthepro Dec 26, 2025
a4c2968
fix: withdraw only if balance is lower than requested amount
shahthepro Dec 30, 2025
fca3df2
Document crosschain strategy
shahthepro Dec 30, 2025
e322fe3
Merge branch 'master' into shah/cross-chain-strategy-cctpv2
shahthepro Jan 2, 2026
b2feed1
Update deployment file numbers
shahthepro Jan 2, 2026
4150f9a
adjust the charts
sparrowDom Jan 5, 2026
7c32c01
change the function visibility to pure
sparrowDom Jan 5, 2026
cbc0745
fix: create2 proxy without using deployer address
shahthepro Jan 5, 2026
8bd5edc
fix: impersonate a single deployer on fork
shahthepro Jan 5, 2026
4557836
deploy script bug fix
shahthepro Jan 5, 2026
31b9f50
Store create2 proxy addresses
shahthepro Jan 5, 2026
057bd78
fix: await
shahthepro Jan 5, 2026
f4bff9e
more logging
shahthepro Jan 5, 2026
2948739
fix opts
shahthepro Jan 5, 2026
801eacf
Fix env for deploy action
shahthepro Jan 5, 2026
8d9ace2
Change writeFileSync to writeFile
shahthepro Jan 5, 2026
cb19da2
add log
shahthepro Jan 5, 2026
8dd21bd
Add more logs
shahthepro Jan 5, 2026
b54ef4b
fix callback
shahthepro Jan 5, 2026
c0a277e
Add empty file
shahthepro Jan 5, 2026
bfb411c
Cleanup logs
shahthepro Jan 5, 2026
2178676
withdraw funds according to the spec
sparrowDom Jan 5, 2026
812d78b
Address Code Review comments (#2732)
shahthepro Jan 6, 2026
bfa9b2c
Revert 999
shahthepro Jan 6, 2026
77cd4e5
Merge branch 'master' into shah/cross-chain-strategy-cctpv2
shahthepro Jan 6, 2026
72f0337
fix comments
shahthepro Jan 7, 2026
a17cd0a
add a test that uncovers a withdrawal error (#2733)
sparrowDom Jan 7, 2026
8cf968a
remove transferType
sparrowDom Jan 7, 2026
59fdeeb
correct spelling
sparrowDom Jan 7, 2026
8e06d55
rename baseToken to usdcToken
sparrowDom Jan 7, 2026
b9fee74
improve error message
sparrowDom Jan 7, 2026
5f290e8
simplify code
sparrowDom Jan 7, 2026
9117a18
fix: min withdraw amount is 1e6
shahthepro Jan 7, 2026
c7b2a92
add validations for config
shahthepro Jan 7, 2026
b0a3f6f
fix: require a min deposit amount of 1e6
shahthepro Jan 7, 2026
66015ac
fix: withdrawAll caps withdraw amount
shahthepro Jan 7, 2026
4cc4524
Move around constants
shahthepro Jan 7, 2026
a0d7bef
Move decode message header function
shahthepro Jan 7, 2026
85e91f4
fix fork tests
shahthepro Jan 7, 2026
4ebe400
prettify
shahthepro Jan 7, 2026
b9b0035
adjust some comments
sparrowDom Jan 7, 2026
c4bc36d
have consistent event names
sparrowDom Jan 7, 2026
9f7d423
fix: remove redundant check
shahthepro Jan 7, 2026
ad9dc47
simplify stuff
shahthepro Jan 7, 2026
bd51e56
adjust comment
sparrowDom Jan 7, 2026
3729fa8
fix: variable name
shahthepro Jan 8, 2026
800e21b
Add TokensBridged and MessageTransmitted events
shahthepro Jan 8, 2026
75e260f
Add finality threshold checks
shahthepro Jan 8, 2026
a1482a0
add comment regarding fast transfers
sparrowDom Jan 8, 2026
b674c75
Add analytics info
shahthepro Jan 9, 2026
d23548e
Change error message
shahthepro Jan 9, 2026
d9b2a49
Set 1 USDC as min allowed value for deposits
shahthepro Jan 9, 2026
eb66a55
Change comment
shahthepro Jan 9, 2026
a7e0ae9
Change comment
shahthepro Jan 9, 2026
6022c93
Update max transfer amount comment
shahthepro Jan 9, 2026
6a3846d
Set nonce(0) as processed during initialization
shahthepro Jan 9, 2026
fafe7d4
Use Strategizable for strategist functionality (#2740)
sparrowDom Jan 9, 2026
d80f754
set vault address to zero (#2742)
sparrowDom Jan 9, 2026
7bbafc3
remove unnecessary comments
shahthepro Jan 9, 2026
7d7d2f9
Add comment
shahthepro Jan 9, 2026
51d62c8
Add nonReentrant for deposit and withdraw methods
shahthepro Jan 9, 2026
8324c9c
Add more checks in constructor
shahthepro Jan 9, 2026
b731385
Fix withdrawAll
shahthepro Jan 9, 2026
e524a33
Update deploy numbers
naddison36 Jan 13, 2026
15d74af
simplify _withdraw (#2741)
sparrowDom Jan 13, 2026
b3fa453
address verification (#2749)
sparrowDom Jan 13, 2026
5d77684
Merge remote-tracking branch 'origin/master' into shah/cross-chain-st…
naddison36 Jan 13, 2026
81743e7
Fix merge issue
naddison36 Jan 13, 2026
9948853
small adjustement
sparrowDom Jan 13, 2026
e0cf9b9
fix unit test
sparrowDom Jan 13, 2026
e1cacc0
Merge remote-tracking branch 'origin/master' into shah/cross-chain-st…
naddison36 Jan 14, 2026
1e06afe
Bumped the deploy script numbers
naddison36 Jan 14, 2026
85531eb
remove unused parameter (#2754)
sparrowDom Jan 14, 2026
63ff128
Add unit tests (#2751)
sparrowDom Jan 14, 2026
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
9 changes: 9 additions & 0 deletions contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,15 @@ Validator public key: 90db8ae56a9e741775ca37dd960606541306974d4a998ef6a6227c85a9

The Hardhat plug-in [@nomiclabs/hardhat-verify](https://www.npmjs.com/package/@nomiclabs/hardhat-etherscan) is used to verify contracts on Etherscan. Etherscan has migrated to V2 api where all the chains use the same endpoint. Hardhat verify should be run with `--contract` parameter otherwise there is a significant slowdown while hardhat is gathering contract information.

### Auto-verification
When deploying contracts, set `VERIFY_CONTRACTS=true` environment variable to verify contract immediately after deployment with no manual action.
```
VERIFY_CONTRACTS=true npx hardhat deploy:mainnet
```
If it reverts for any reason, it'll print out the command that you can use to run manually or debug.

### Manual verification

**IMPORTANT:**

- Currently only yarn works. Do not use npx/pnpm
Expand Down
24 changes: 24 additions & 0 deletions contracts/abi/createx.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,30 @@
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "salt",
"type": "bytes32"
},
{
"internalType": "bytes",
"name": "initCode",
"type": "bytes"
}
],
"name": "deployCreate3",
"outputs": [
{
"internalType": "address",
"name": "newContract",
"type": "address"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
Expand Down
75 changes: 75 additions & 0 deletions contracts/contracts/interfaces/cctp/ICCTP.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

interface ICCTPTokenMessenger {
function depositForBurn(
uint256 amount,
uint32 destinationDomain,
bytes32 mintRecipient,
address burnToken,
bytes32 destinationCaller,
uint256 maxFee,
uint32 minFinalityThreshold
) external;

function depositForBurnWithHook(
uint256 amount,
uint32 destinationDomain,
bytes32 mintRecipient,
address burnToken,
bytes32 destinationCaller,
uint256 maxFee,
uint32 minFinalityThreshold,
bytes memory hookData
) external;

function getMinFeeAmount(uint256 amount) external view returns (uint256);
}

interface ICCTPMessageTransmitter {
function sendMessage(
uint32 destinationDomain,
bytes32 recipient,
bytes32 destinationCaller,
uint32 minFinalityThreshold,
bytes memory messageBody
) external;

function receiveMessage(bytes calldata message, bytes calldata attestation)
external
returns (bool);
}

interface IMessageHandlerV2 {
/**
* @notice Handles an incoming finalized message from an IReceiverV2
* @dev Finalized messages have finality threshold values greater than or equal to 2000
* @param sourceDomain The source domain of the message
* @param sender The sender of the message
* @param finalityThresholdExecuted the finality threshold at which the message was attested to
* @param messageBody The raw bytes of the message body
* @return success True, if successful; false, if not.
*/
function handleReceiveFinalizedMessage(
uint32 sourceDomain,
bytes32 sender,
uint32 finalityThresholdExecuted,
bytes calldata messageBody
) external returns (bool);

/**
* @notice Handles an incoming unfinalized message from an IReceiverV2
* @dev Unfinalized messages have finality threshold values less than 2000
* @param sourceDomain The source domain of the message
* @param sender The sender of the message
* @param finalityThresholdExecuted The finality threshold at which the message was attested to
* @param messageBody The raw bytes of the message body
* @return success True, if successful; false, if not.
*/
function handleReceiveUnfinalizedMessage(
uint32 sourceDomain,
bytes32 sender,
uint32 finalityThresholdExecuted,
bytes calldata messageBody
) external returns (bool);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

/**
* @title OUSD Yearn V3 Master Strategy Mock - the Mainnet part
* @author Origin Protocol Inc
*/

contract CrossChainMasterStrategyMock {
address public _remoteAddress;

constructor() {}

function remoteAddress() public view returns (address) {
return _remoteAddress;
}

function setRemoteAddress(address __remoteAddress) public {
_remoteAddress = __remoteAddress;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

/**
* @title OUSD Yearn V3 Remote Strategy Mock - the Mainnet part
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"- the Mainnet part" should probably be "- the L2 chain part"

* @author Origin Protocol Inc
*/

contract CrossChainRemoteStrategyMock {
address public _masterAddress;

constructor() {}

function masterAddress() public view returns (address) {
return _masterAddress;
}

function setMasterAddress(address __masterAddress) public {
_masterAddress = __masterAddress;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

import { InitializeGovernedUpgradeabilityProxy } from "./InitializeGovernedUpgradeabilityProxy.sol";

/**
* @title BaseGovernedUpgradeabilityProxy2
* @dev This is the same as InitializeGovernedUpgradeabilityProxy except that the
* governor is defined in the constructor.
* @author Origin Protocol Inc
*/
contract InitializeGovernedUpgradeabilityProxy2 is
InitializeGovernedUpgradeabilityProxy
{
/**
* This is used when the msg.sender can not be the governor. E.g. when the proxy is
* deployed via CreateX
*/
constructor(address governor) InitializeGovernedUpgradeabilityProxy() {
_setGovernor(governor);
}
}
1 change: 1 addition & 0 deletions contracts/contracts/proxies/Proxies.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pragma solidity ^0.8.0;

import { InitializeGovernedUpgradeabilityProxy } from "./InitializeGovernedUpgradeabilityProxy.sol";
import { InitializeGovernedUpgradeabilityProxy2 } from "./InitializeGovernedUpgradeabilityProxy2.sol";

/**
* @notice OUSDProxy delegates calls to an OUSD implementation
Expand Down
21 changes: 21 additions & 0 deletions contracts/contracts/proxies/create2/CCTPHookWrapperProxy.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

import { InitializeGovernedUpgradeabilityProxy2 } from "../InitializeGovernedUpgradeabilityProxy2.sol";

// ********************************************************
// ********************************************************
// IMPORTANT: DO NOT CHANGE ANYTHING IN THIS FILE.
// Any changes to this file (even whitespaces) will
// affect the create2 address of the proxy
// ********************************************************
// ********************************************************

/**
* @notice CCTPHookWrapperProxy delegates calls to a CCTPHookWrapper implementation
*/
contract CCTPHookWrapperProxy is InitializeGovernedUpgradeabilityProxy2 {
constructor(address governor)
InitializeGovernedUpgradeabilityProxy2(governor)
{}
}
23 changes: 23 additions & 0 deletions contracts/contracts/proxies/create2/CrossChainStrategyProxy.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

import { InitializeGovernedUpgradeabilityProxy2 } from "../InitializeGovernedUpgradeabilityProxy2.sol";

// ********************************************************
// ********************************************************
// IMPORTANT: DO NOT CHANGE ANYTHING IN THIS FILE.
// Any changes to this file (even whitespaces) will
// affect the create2 address of the proxy
// ********************************************************
// ********************************************************

/**
* @notice CrossChainStrategyProxy delegates calls to a
* CrossChainMasterStrategy or CrossChainRemoteStrategy
* implementation contract.
*/
contract CrossChainStrategyProxy is InitializeGovernedUpgradeabilityProxy2 {
constructor(address governor)
InitializeGovernedUpgradeabilityProxy2(governor)
{}
}
11 changes: 10 additions & 1 deletion contracts/contracts/strategies/Generalized4626Strategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ contract Generalized4626Strategy is InitializableAbstractStrategy {
*/
function deposit(address _asset, uint256 _amount)
external
virtual
override
onlyVault
nonReentrant
Expand Down Expand Up @@ -99,6 +100,14 @@ contract Generalized4626Strategy is InitializableAbstractStrategy {
address _asset,
uint256 _amount
) external virtual override onlyVault nonReentrant {
_withdraw(_recipient, _asset, _amount);
}

function _withdraw(
address _recipient,
address _asset,
uint256 _amount
) internal virtual {
require(_amount > 0, "Must withdraw something");
require(_recipient != address(0), "Must specify recipient");
require(_asset == address(assetToken), "Unexpected asset address");
Expand Down Expand Up @@ -147,7 +156,7 @@ contract Generalized4626Strategy is InitializableAbstractStrategy {
* @return balance Total value of the asset in the platform
*/
function checkBalance(address _asset)
external
public
view
virtual
override
Expand Down
Loading
Loading