Skip to content

Commit

Permalink
fix: process request args
Browse files Browse the repository at this point in the history
  • Loading branch information
--global committed Jun 21, 2024
1 parent 6687eed commit fbeb696
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/core/ClientGatewayLzReceiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ abstract contract ClientGatewayLzReceiver is PausableUpgradeable, OAppReceiverUp
abi.decode(requestPayload, (address, address, uint256));

bool success = (uint8(bytes1(responsePayload[0])) == 1);
uint256 lastlyUpdatedPrincipleBalance = uint256(bytes32(responsePayload[1:33]));
uint256 lastlyUpdatedPrincipalBalance = uint256(bytes32(responsePayload[1:33]));

if (!success) {
revert WithdrawShouldNotFailOnExocore(token, withdrawer);
Expand All @@ -124,8 +124,8 @@ abstract contract ClientGatewayLzReceiver is PausableUpgradeable, OAppReceiverUp
if (token == VIRTUAL_STAKED_ETH_ADDRESS) {
IExoCapsule capsule = _getCapsule(withdrawer);

capsule.updatePrincipleBalance(lastlyUpdatedPrincipleBalance);
capsule.updateWithdrawableBalance(unlockPrincipleAmount);
capsule.updatePrincipalBalance(lastlyUpdatedPrincipalBalance);
capsule.updateWithdrawableBalance(unlockPrincipalAmount);
} else {
IVault vault = _getVault(token);

Expand Down
4 changes: 2 additions & 2 deletions src/core/ExoCapsule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ contract ExoCapsule is Initializable, ExoCapsuleStorage, IExoCapsule {
emit NonBeaconChainETHWithdrawn(recipient, amountToWithdraw);
}

function updatePrincipleBalance(uint256 lastlyUpdatedPrincipleBalance) external onlyGateway {
principleBalance = lastlyUpdatedPrincipleBalance;
function updatePrincipalBalance(uint256 lastlyUpdatedPrincipalBalance) external onlyGateway {
principleBalance = lastlyUpdatedPrincipalBalance;

emit PrincipalBalanceUpdated(capsuleOwner, lastlyUpdatedPrincipalBalance);
}
Expand Down
11 changes: 5 additions & 6 deletions src/core/NativeRestakingController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,12 @@ abstract contract NativeRestakingController is
capsule.verifyWithdrawalProof(validatorContainer, validatorProof, withdrawalContainer, withdrawalProof);
if (!partialWithdrawal) {
// request full withdraw
_processRequest(
VIRTUAL_STAKED_ETH_ADDRESS,
msg.sender,
withdrawalAmount,
Action.REQUEST_WITHDRAW_PRINCIPLE_FROM_EXOCORE,
""
bytes memory actionArgs = abi.encodePacked(
bytes32(bytes20(VIRTUAL_STAKED_ETH_ADDRESS)), bytes32(bytes20(msg.sender)), withdrawalAmount
);
bytes memory encodedRequest = abi.encode(VIRTUAL_STAKED_ETH_ADDRESS, msg.sender, withdrawalAmount);

_processRequest(Action.REQUEST_WITHDRAW_PRINCIPAL_FROM_EXOCORE, actionArgs, encodedRequest);
}
}

Expand Down

0 comments on commit fbeb696

Please sign in to comment.