Skip to content

Commit

Permalink
enable decodeDeposit from bytes directly
Browse files Browse the repository at this point in the history
  • Loading branch information
nonergodic committed Aug 28, 2024
1 parent ce7ad75 commit 9e3c186
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/libraries/WormholeCctpMessages.sol
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ library WormholeCctpMessages {
);
}

// left in for backwards compatibility
function decodeDeposit(IWormhole.VM memory vaa)
internal
pure
Expand All @@ -150,7 +151,23 @@ library WormholeCctpMessages {
bytes memory payload
)
{
bytes memory encoded = vaa.payload;
return decodeDeposit(vaa.payload);
}

function decodeDeposit(bytes memory encoded)
internal
pure
returns (
bytes32 token,
uint256 amount,
uint32 sourceCctpDomain,
uint32 targetCctpDomain,
uint64 cctpNonce,
bytes32 burnSource,
bytes32 mintRecipient,
bytes memory payload
)
{
uint256 offset = _checkPayloadId(encoded, 0, DEPOSIT);

(token, offset) = encoded.asBytes32Unchecked(offset);
Expand Down

0 comments on commit 9e3c186

Please sign in to comment.