Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
12 changes: 6 additions & 6 deletions snapshots/NativeTokenGateway.Operations.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"borrowNative": "229316",
"repayNative": "168024",
"supplyAsCollateralNative": "160373",
"supplyNative": "136476",
"withdrawNative: full": "125620",
"withdrawNative: partial": "136825"
"borrowNative": "229272",
"repayNative": "168023",
"supplyAsCollateralNative": "160307",
"supplyNative": "136441",
"withdrawNative: full": "125585",
"withdrawNative: partial": "136781"
}
16 changes: 8 additions & 8 deletions snapshots/SignatureGateway.Operations.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"borrowWithSig": "215605",
"repayWithSig": "188872",
"setSelfAsUserPositionManagerWithSig": "75402",
"setUsingAsCollateralWithSig": "85053",
"supplyWithSig": "153205",
"updateUserDynamicConfigWithSig": "62769",
"updateUserRiskPremiumWithSig": "61579",
"withdrawWithSig": "131696"
"borrowWithSig": "215571",
"repayWithSig": "188881",
"setSelfAsUserPositionManagerWithSig": "76464",
"setUsingAsCollateralWithSig": "85085",
"supplyWithSig": "153151",
"updateUserDynamicConfigWithSig": "62750",
"updateUserRiskPremiumWithSig": "61450",
"withdrawWithSig": "131668"
}
54 changes: 27 additions & 27 deletions snapshots/Spoke.Operations.ZeroRiskPremium.json
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": "300103",
"liquidationCall (receiveShares): partial": "299821",
"liquidationCall: full": "310468",
"liquidationCall: partial": "310186",
"permitReserve + repay (multicall)": "166029",
"permitReserve + supply (multicall)": "146862",
"permitReserve + supply + enable collateral (multicall)": "160573",
"repay: full": "126094",
"repay: partial": "130983",
"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)": "166006",
"permitReserve + supply (multicall)": "146774",
"permitReserve + supply + enable collateral (multicall)": "160463",
"repay: full": "126137",
"repay: partial": "131026",
"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"
}
54 changes: 27 additions & 27 deletions snapshots/Spoke.Operations.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
{
"borrow: first": "261721",
"borrow: second action, same reserve": "204693",
"borrow: first": "261699",
"borrow: second action, same reserve": "204671",
"liquidationCall (receiveShares): full": "333666",
"liquidationCall (receiveShares): partial": "333384",
"liquidationCall: full": "344031",
"liquidationCall: partial": "343749",
"permitReserve + repay (multicall)": "163273",
"permitReserve + supply (multicall)": "146862",
"permitReserve + supply + enable collateral (multicall)": "160573",
"repay: full": "120256",
"repay: partial": "139545",
"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": "151080",
"updateUserRiskPremium: 2 borrows": "204276",
"usingAsCollateral: 0 borrows, enable": "58915",
"usingAsCollateral: 1 borrow, disable": "161348",
"usingAsCollateral: 1 borrow, enable": "41803",
"usingAsCollateral: 2 borrows, disable": "233712",
"usingAsCollateral: 2 borrows, enable": "41815",
"withdraw: 0 borrows, full": "128910",
"withdraw: 0 borrows, partial": "133473",
"withdraw: 1 borrow, partial": "214810",
"withdraw: 2 borrows, partial": "259272",
"withdraw: non collateral": "106544"
"permitReserve + repay (multicall)": "163255",
"permitReserve + supply (multicall)": "146774",
"permitReserve + supply + enable collateral (multicall)": "160463",
"repay: full": "120299",
"repay: partial": "139588",
"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": "151058",
"updateUserRiskPremium: 2 borrows": "204254",
"usingAsCollateral: 0 borrows, enable": "58893",
"usingAsCollateral: 1 borrow, disable": "161326",
"usingAsCollateral: 1 borrow, enable": "41781",
"usingAsCollateral: 2 borrows, disable": "233690",
"usingAsCollateral: 2 borrows, enable": "41793",
"withdraw: 0 borrows, full": "128888",
"withdraw: 0 borrows, partial": "133451",
"withdraw: 1 borrow, partial": "214788",
"withdraw: 2 borrows, partial": "259250",
"withdraw: non collateral": "106522"
}
16 changes: 16 additions & 0 deletions src/interfaces/IIntentConsumer.sol
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);
}
34 changes: 34 additions & 0 deletions src/misc/IntentConsumer.sol
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();
}
}
Loading
Loading