-
Notifications
You must be signed in to change notification settings - Fork 9
review fixes #220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
review fixes #220
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,19 +41,6 @@ interface IGasAccountManager { | |
|
|
||
| // ============ GAS ACCOUNT OPERATIONS ============ | ||
|
|
||
| /// @notice Get available gas balance for an account | ||
| /// @dev Returns balance minus escrowed amount | ||
| function availableGas(address account) external view returns (uint256); | ||
|
|
||
| /// @notice Get total gas balance including escrowed | ||
| function totalGas(address account) external view returns (uint256); | ||
|
|
||
| /// @notice Get currently escrowed gas for an account | ||
| function escrowedGas(address account) external view returns (uint256); | ||
|
|
||
| /// @notice Approve an app to spend gas from your account | ||
| function approveGasSpending(address app, uint256 amount) external; | ||
|
|
||
| /// @notice Wrap native tokens into SGAS | ||
| function wrapToGas(address receiver) external payable; | ||
|
|
||
|
|
@@ -64,7 +51,12 @@ interface IGasAccountManager { | |
|
|
||
| /// @notice Deposit tokens from a chain into gas account | ||
| /// @dev Called by watcher after detecting GasStation deposit | ||
| function depositFromChain(bytes memory payload_) external; | ||
| function depositFromChain( | ||
| address token_, | ||
| address receiver_, | ||
| uint256 gasAmount_, | ||
| uint256 nativeAmount_ | ||
| ) external; | ||
|
|
||
|
Comment on lines
52
to
60
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chaindepositFromChain API is now explicit; ensure all implementors and callers are updated Changing 🏁 Script executed: #!/bin/bash
# Ensure all implementations and uses of depositFromChain match the new signature
rg -n "depositFromChain" -C3Length of output: 2676 Parameter name mismatch in GasAccountManager.depositFromChain The interface declares the second parameter as 🤖 Prompt for AI Agents |
||
| /// @notice Withdraw SGAS to tokens on another chain | ||
| function withdrawToChain( | ||
|
|
@@ -87,5 +79,10 @@ interface IGasAccountManager { | |
|
|
||
| /// @notice Settle escrowed gas to transmitter | ||
| /// @dev Called when payload completes successfully | ||
| function settleGasPayment(bytes32 payloadId, address consumeFrom, address transmitter, uint256 amount) external; | ||
| function settleGasPayment( | ||
| bytes32 payloadId, | ||
| address consumeFrom, | ||
| address transmitter, | ||
| uint256 amount | ||
| ) external; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,15 @@ import "../../utils/RescueFundsLib.sol"; | |
| import {InvalidTokenAddress} from "../../utils/common/Errors.sol"; | ||
| import "../interfaces/IGasAccountToken.sol"; | ||
|
|
||
| interface IGasAccountManager { | ||
| function depositFromChain( | ||
| address token_, | ||
| address receiver_, | ||
| uint256 gasAmount_, | ||
| uint256 nativeAmount_ | ||
| ) external returns (bytes memory payloadId); | ||
| } | ||
|
|
||
| /// @title GasStation | ||
| /// @notice Contract for managing fees on a network | ||
| /// @dev The amount deposited here is locked and updated in the EVMx for an app gateway | ||
|
|
@@ -68,19 +77,16 @@ contract GasStation is IGasStation, PlugBase, AccessControl { | |
| if (!whitelistedTokens[token_]) revert TokenNotWhitelisted(token_); | ||
|
|
||
| // Encode deposit parameters: (chainSlug, token, receiver, gasAmount, nativeAmount) | ||
| bytes memory payload = abi.encode( | ||
| socket__.chainSlug(), | ||
| bytes memory payloadId = IGasAccountManager(address(socket__)).depositFromChain( | ||
| token_, | ||
| receiver_, | ||
| gasAmount_, | ||
| nativeAmount_ | ||
| ); | ||
| // todo: IGasAccountManager(socket__).depositFromChain(token_, receiver_, gasAmount_, nativeAmount_); | ||
|
|
||
| // Create trigger via Socket to get unique payloadId | ||
| bytes32 payloadId = socket__.sendPayload(payload); | ||
| token_.safeTransferFrom(msg.sender, address(this), gasAmount_ + nativeAmount_); | ||
| emit GasDeposited(token_, receiver_, gasAmount_, nativeAmount_, payloadId); | ||
| emit GasDeposited(token_, receiver_, gasAmount_, nativeAmount_, bytes32(payloadId)); | ||
| } | ||
|
Comment on lines
+80
to
90
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix the deposit call target and return handling. Line 80: This should not cast 🤖 Prompt for AI Agents |
||
|
|
||
| /// @notice Withdraws tokens | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make
depositFromChainreturn the payload id (or stop exposing it).Line 107: GasStation now invokes this through an interface that returns
bytes memory, but this implementation returns nothing. The ABI decoder therefore reverts on every call because it expects dynamic return data. This should return the payload identifier you want to emit (and be markedoverrideaccordingly), or the caller must stop decoding a value. As written, any on-chain deposit flow breaks.🤖 Prompt for AI Agents