-
Notifications
You must be signed in to change notification settings - Fork 35
feat: abstract intent consumption #1065
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
Open
DhairyaSethi
wants to merge
8
commits into
dev
Choose a base branch
from
feat/intent-consumer
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
faf6d27
feat: abstract intent consumption to be reused
DhairyaSethi 345d730
fix: migrate spoke
DhairyaSethi 7a56dae
chore: use named args
DhairyaSethi 6270124
chore: get code size under control
DhairyaSethi ba3bf55
feat: codesize
DhairyaSethi ee8544b
chore: snapshot
DhairyaSethi 7ecb2b9
chore: abstract common getter
DhairyaSethi 59cdd30
Merge remote-tracking branch 'origin/dev' into feat/intent-consumer
DhairyaSethi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| { | ||
| "borrowNative": "229604", | ||
| "repayNative": "168312", | ||
| "supplyAsCollateralNative": "160373", | ||
| "supplyNative": "136476", | ||
| "withdrawNative: full": "125620", | ||
| "withdrawNative: partial": "136825" | ||
| "borrowNative": "229560", | ||
| "repayNative": "168311", | ||
| "supplyAsCollateralNative": "160307", | ||
| "supplyNative": "136441", | ||
| "withdrawNative: full": "125585", | ||
| "withdrawNative: partial": "136781" | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| { | ||
| "borrowWithSig": "215893", | ||
| "repayWithSig": "189160", | ||
| "setSelfAsUserPositionManagerWithSig": "74858", | ||
| "setUsingAsCollateralWithSig": "85053", | ||
| "supplyWithSig": "153205", | ||
| "updateUserDynamicConfigWithSig": "62769", | ||
| "updateUserRiskPremiumWithSig": "61579", | ||
| "withdrawWithSig": "131713" | ||
| "borrowWithSig": "215937", | ||
| "repayWithSig": "189247", | ||
| "setSelfAsUserPositionManagerWithSig": "75975", | ||
| "setUsingAsCollateralWithSig": "85085", | ||
| "supplyWithSig": "153213", | ||
| "updateUserDynamicConfigWithSig": "62750", | ||
| "updateUserRiskPremiumWithSig": "61450", | ||
| "withdrawWithSig": "131748" | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,33 +1,33 @@ | ||
| { | ||
| "borrow: first": "191325", | ||
| "borrow: second action, same reserve": "171297", | ||
| "borrow: first": "191303", | ||
| "borrow: second action, same reserve": "171275", | ||
| "liquidationCall (receiveShares): full": "300391", | ||
| "liquidationCall (receiveShares): partial": "300109", | ||
| "liquidationCall: full": "310756", | ||
| "liquidationCall: partial": "310474", | ||
| "permitReserve + repay (multicall)": "166317", | ||
| "permitReserve + supply (multicall)": "146862", | ||
| "permitReserve + supply + enable collateral (multicall)": "160573", | ||
| "repay: full": "126382", | ||
| "repay: partial": "131271", | ||
| "setUserPositionManagerWithSig: disable": "44846", | ||
| "setUserPositionManagerWithSig: enable": "68875", | ||
| "supply + enable collateral (multicall)": "140624", | ||
| "supply: 0 borrows, collateral disabled": "123679", | ||
| "supply: 0 borrows, collateral enabled": "106601", | ||
| "supply: second action, same reserve": "106579", | ||
| "updateUserDynamicConfig: 1 collateral": "73694", | ||
| "updateUserDynamicConfig: 2 collaterals": "88551", | ||
| "updateUserRiskPremium: 1 borrow": "94804", | ||
| "updateUserRiskPremium: 2 borrows": "104619", | ||
| "usingAsCollateral: 0 borrows, enable": "58915", | ||
| "usingAsCollateral: 1 borrow, disable": "105072", | ||
| "usingAsCollateral: 1 borrow, enable": "41803", | ||
| "usingAsCollateral: 2 borrows, disable": "126055", | ||
| "usingAsCollateral: 2 borrows, enable": "41815", | ||
| "withdraw: 0 borrows, full": "128910", | ||
| "withdraw: 0 borrows, partial": "133473", | ||
| "withdraw: 1 borrow, partial": "161036", | ||
| "withdraw: 2 borrows, partial": "174214", | ||
| "withdraw: non collateral": "106544" | ||
| "permitReserve + repay (multicall)": "166294", | ||
| "permitReserve + supply (multicall)": "146774", | ||
| "permitReserve + supply + enable collateral (multicall)": "160463", | ||
| "repay: full": "126425", | ||
| "repay: partial": "131314", | ||
| "setUserPositionManagerWithSig: disable": "45813", | ||
| "setUserPositionManagerWithSig: enable": "69842", | ||
| "supply + enable collateral (multicall)": "140536", | ||
| "supply: 0 borrows, collateral disabled": "123657", | ||
| "supply: 0 borrows, collateral enabled": "106579", | ||
| "supply: second action, same reserve": "106557", | ||
| "updateUserDynamicConfig: 1 collateral": "73782", | ||
| "updateUserDynamicConfig: 2 collaterals": "88639", | ||
| "updateUserRiskPremium: 1 borrow": "94782", | ||
| "updateUserRiskPremium: 2 borrows": "104597", | ||
| "usingAsCollateral: 0 borrows, enable": "58893", | ||
| "usingAsCollateral: 1 borrow, disable": "105050", | ||
| "usingAsCollateral: 1 borrow, enable": "41781", | ||
| "usingAsCollateral: 2 borrows, disable": "126033", | ||
| "usingAsCollateral: 2 borrows, enable": "41793", | ||
| "withdraw: 0 borrows, full": "128888", | ||
| "withdraw: 0 borrows, partial": "133451", | ||
| "withdraw: 1 borrow, partial": "161014", | ||
| "withdraw: 2 borrows, partial": "174192", | ||
| "withdraw: non collateral": "106522" | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,33 +1,33 @@ | ||
| { | ||
| "borrow: first": "262009", | ||
| "borrow: second action, same reserve": "204981", | ||
| "borrow: first": "261987", | ||
| "borrow: second action, same reserve": "204959", | ||
| "liquidationCall (receiveShares): full": "334242", | ||
| "liquidationCall (receiveShares): partial": "333960", | ||
| "liquidationCall: full": "344607", | ||
| "liquidationCall: partial": "344325", | ||
| "permitReserve + repay (multicall)": "163504", | ||
| "permitReserve + supply (multicall)": "146862", | ||
| "permitReserve + supply + enable collateral (multicall)": "160573", | ||
| "repay: full": "120544", | ||
| "repay: partial": "139833", | ||
| "setUserPositionManagerWithSig: disable": "44846", | ||
| "setUserPositionManagerWithSig: enable": "68875", | ||
| "supply + enable collateral (multicall)": "140624", | ||
| "supply: 0 borrows, collateral disabled": "123679", | ||
| "supply: 0 borrows, collateral enabled": "106601", | ||
| "supply: second action, same reserve": "106579", | ||
| "updateUserDynamicConfig: 1 collateral": "73694", | ||
| "updateUserDynamicConfig: 2 collaterals": "88551", | ||
| "updateUserRiskPremium: 1 borrow": "151368", | ||
| "updateUserRiskPremium: 2 borrows": "204852", | ||
| "usingAsCollateral: 0 borrows, enable": "58915", | ||
| "usingAsCollateral: 1 borrow, disable": "161636", | ||
| "usingAsCollateral: 1 borrow, enable": "41803", | ||
| "usingAsCollateral: 2 borrows, disable": "234288", | ||
| "usingAsCollateral: 2 borrows, enable": "41815", | ||
| "withdraw: 0 borrows, full": "128910", | ||
| "withdraw: 0 borrows, partial": "133473", | ||
| "withdraw: 1 borrow, partial": "215098", | ||
| "withdraw: 2 borrows, partial": "259848", | ||
| "withdraw: non collateral": "106544" | ||
| "permitReserve + repay (multicall)": "163485", | ||
| "permitReserve + supply (multicall)": "146774", | ||
| "permitReserve + supply + enable collateral (multicall)": "160463", | ||
| "repay: full": "120587", | ||
| "repay: partial": "139876", | ||
| "setUserPositionManagerWithSig: disable": "45813", | ||
| "setUserPositionManagerWithSig: enable": "69842", | ||
| "supply + enable collateral (multicall)": "140536", | ||
| "supply: 0 borrows, collateral disabled": "123657", | ||
| "supply: 0 borrows, collateral enabled": "106579", | ||
| "supply: second action, same reserve": "106557", | ||
| "updateUserDynamicConfig: 1 collateral": "73782", | ||
| "updateUserDynamicConfig: 2 collaterals": "88639", | ||
| "updateUserRiskPremium: 1 borrow": "151346", | ||
| "updateUserRiskPremium: 2 borrows": "204830", | ||
| "usingAsCollateral: 0 borrows, enable": "58893", | ||
| "usingAsCollateral: 1 borrow, disable": "161614", | ||
| "usingAsCollateral: 1 borrow, enable": "41781", | ||
| "usingAsCollateral: 2 borrows, disable": "234266", | ||
| "usingAsCollateral: 2 borrows, enable": "41793", | ||
| "withdraw: 0 borrows, full": "128888", | ||
| "withdraw: 0 borrows, partial": "133451", | ||
| "withdraw: 1 borrow, partial": "215076", | ||
| "withdraw: 2 borrows, partial": "259826", | ||
| "withdraw: non collateral": "106522" | ||
| } |
This file contains hidden or 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,16 @@ | ||
| // SPDX-License-Identifier: UNLICENSED | ||
| // Copyright (c) 2025 Aave Labs | ||
| pragma solidity ^0.8.0; | ||
|
|
||
| import {INoncesKeyed} from 'src/interfaces/INoncesKeyed.sol'; | ||
|
|
||
| /// @title IIntentConsumer | ||
| /// @author Aave Labs | ||
| /// @notice Minimal interface for IntentConsumer. | ||
| interface IIntentConsumer is INoncesKeyed { | ||
| /// @notice Thrown when signature deadline has passed or signer is not the expected one. | ||
| error InvalidSignature(); | ||
|
|
||
| /// @notice Returns the EIP-712 domain separator. | ||
| function DOMAIN_SEPARATOR() external view returns (bytes32); | ||
| } |
This file contains hidden or 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,34 @@ | ||
| // SPDX-License-Identifier: UNLICENSED | ||
| // Copyright (c) 2025 Aave Labs | ||
| pragma solidity 0.8.28; | ||
|
|
||
| import {EIP712} from 'src/dependencies/solady/EIP712.sol'; | ||
| import {NoncesKeyed} from 'src/utils/NoncesKeyed.sol'; | ||
| import {SignatureChecker} from 'src/dependencies/openzeppelin/SignatureChecker.sol'; | ||
| import {IIntentConsumer} from 'src/interfaces/IIntentConsumer.sol'; | ||
|
|
||
| abstract contract IntentConsumer is IIntentConsumer, NoncesKeyed, EIP712 { | ||
| /// @dev Verifies the signature for given signer & intent hash, and consumes the keyed-nonce. | ||
| /// @param signer The address of the user. | ||
| /// @param intentHash The hash of the intent struct. | ||
| /// @param nonce The keyed-nonce for the intent. | ||
| /// @param deadline The deadline timestamp for the intent. | ||
| /// @param signature The signature bytes. | ||
| function _verifyAndConsumeIntent( | ||
| address signer, | ||
| bytes32 intentHash, | ||
| uint256 nonce, | ||
| uint256 deadline, | ||
| bytes calldata signature | ||
| ) internal { | ||
| require(block.timestamp <= deadline, InvalidSignature()); | ||
| bytes32 digest = _hashTypedData(intentHash); | ||
| require(SignatureChecker.isValidSignatureNow(signer, digest, signature), InvalidSignature()); | ||
| _useCheckedNonce(signer, nonce); | ||
| } | ||
|
|
||
| /// @inheritdoc IIntentConsumer | ||
| function DOMAIN_SEPARATOR() external view returns (bytes32) { | ||
| return _domainSeparator(); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.