Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
fd74080
fix(issue 6): RewardHandler may revert due to receiving less than exp…
Feb 25, 2026
bc4574a
fix(issue 9): Missing validation allows userDeviation > burnRatioDevi…
Feb 26, 2026
7df01b8
fix (issue 18): collatInfo.stablecoinCap hardcap can be bypassed via …
Feb 26, 2026
3010a17
fix(issue 16): SettersGovernor::setWhitelistStatus allows values othe…
Feb 26, 2026
08bc292
fix(issue 19): Incorrect link to Angle contracts across protocol
Feb 26, 2026
c340795
fix(issue 20): Deploy script UpdateParallelizer.ts does not handle fa…
Feb 26, 2026
f60101a
fix(issue 11): LibHelpers.convertDecimalsTo favours the user on a exa…
Feb 27, 2026
7d9d712
fix(issue 26): Oracle Inconsistency between surplus computation and p…
Mar 1, 2026
84785b1
fix(test): update SafeCast error format in BurnGetCollateralRatio fuz…
Mar 1, 2026
3d5bb19
fix(issue 29): LibSurplus::_computeCollateralSurplus doesn't account …
Mar 1, 2026
7c9d01b
style: fix max-line-length lint errors in Swapper.sol and Redeem.t.sol
Mar 1, 2026
130d731
fix(ci): pin OpenZeppelin dependencies to 5.4.0
Mar 1, 2026
27e8857
fix: update surplus buffer ratio handling and introduce new error for…
Mar 3, 2026
f41738d
fix(LibSetters): adjust normalized stablecoin cap check to account fo…
Mar 4, 2026
60fec2c
fix(LibSurplus): cap per-collateral surplus by global surplus to ensu…
Mar 4, 2026
1fa2ace
refactor(RewardHandler, LibSetters, tests): remove unused variables a…
Mar 4, 2026
c832d82
test(Parallelizer): add surplus cap tests for global CR below buffer …
Mar 4, 2026
e70a4c2
feat(audits): add new audit document for Cyfrin Parallel Protocol dat…
Mar 5, 2026
2de78d6
feat(audits): add Cyfrin's formal verification of Parallel Protocol d…
Mar 8, 2026
0f92ecb
Merge pull request #18 from parallel-protocol/audit/cyfrin-february-2026
FabienCoutant Mar 9, 2026
c93b671
refacto(Surplus): update SurplusProcessed event to include collateral…
Mar 31, 2026
db154ca
feat(Parallelizer): add "Surplus" to facets list
Mar 31, 2026
3e40b10
fix(Swapper): revert when burning all stablecoin issued
Mar 31, 2026
19d160d
fix(Getters): use Floor rounding for stablecoinsIssued to prevent bur…
Apr 2, 2026
2d346ca
test(Burn,Redeem): add comprehensive fuzz tests for CannotBurnAllStab…
Apr 2, 2026
1f154fb
style(Swapper): fix trailing whitespace and formatting
Apr 2, 2026
acf8c1d
fix(tests): skip reentrancy tests when burning all stables and fix fo…
Apr 2, 2026
ca5b768
style: fix formatting in Swap tests and regenerate artifacts
Apr 2, 2026
1143ad3
fix(Redeemer): guard normalizedStables on redeem path per whitehat re…
Apr 3, 2026
a3269e8
style(Redeem): wrap long assertGt message to satisfy max-line-length
Apr 5, 2026
4c4f074
Revert "fix(Getters): use Floor rounding for stablecoinsIssued to pre…
Apr 6, 2026
cb9fe3f
Merge pull request #19 from parallel-protocol/hotfix/fees-bypass-enab…
FabienCoutant Apr 6, 2026
8d88dc0
feat(EIP3009): add interface, abstract implementation, and test infra…
Apr 4, 2026
2b57e90
feat(Swapper,Redeemer): add EIP-3009 swap and redeem with authorization
Apr 4, 2026
860803a
feat(Savings): integrate EIP-3009 for shares token and deposits
Apr 4, 2026
7ee983c
fix(EIP3009): fix lint line-length errors and stack-too-deep in Redeemer
Apr 6, 2026
5bac098
Merge branch 'hotfix/fees-bypass-enable-attackers-extract-high-qualit…
Apr 7, 2026
637138f
Merge branch 'feat/eip3009' into audit/eip3009-hotfix-fees
Apr 7, 2026
ff37fd5
refactor: clean EIP3009 and avoid front-run tx
Apr 10, 2026
d23f7d7
refactor(tests): implement try/catch for quoteRedemptionCurve in Burn…
Apr 10, 2026
c9e5321
fix(Parallelizer): bind swap/redeem intent to EIP-3009 nonce to preve…
Apr 10, 2026
1d0a466
fix(lint): wrap typehash strings to satisfy max-line-length
Apr 10, 2026
a9d7683
fix(tests): use methodIdentifiers JSON to derive selectors
Apr 10, 2026
28af0cf
add(audits): include first report for Bailsec - Parallel Protocol Upg…
Apr 27, 2026
d955bcc
fix(Swapper) [Issue_05]: assert balance delta on receiveWithAuthoriza…
Apr 27, 2026
4323528
fix(Parallelizer) [Issue_06]: accept arbitrary-length signatures in A…
Apr 27, 2026
cf63107
fix(Parallelizer) [Issue_07]: attribute Swap and Redeemed events to a…
Apr 27, 2026
97bede5
fix(Swapper) [Issue_08]: consume nonce on zero-amount authorized swap…
Apr 27, 2026
9d4072a
fix(Redeemer) [Issue_09]: expose forfeitTokens in redeemWithAuthoriza…
Apr 27, 2026
2955661
refactor(Authorization): replace keccak256 typehash strings with prec…
Apr 27, 2026
4bd346c
fix(EIP3009) [Issue_02]: align storage slot with EIP-7201 derivation …
Apr 27, 2026
55c5e09
docs(EIP3009) [Issue_01]: warn that transferWithAuthorization must no…
Apr 27, 2026
4b50eca
fix(facets): refactor Swapper and Redeemer to compile under CI profil…
Apr 27, 2026
6f7db3d
add(audits): include final report for Bailsec - Parallel Protocol Upg…
May 5, 2026
d8738ee
fix(invariants): switch BurnExactOutput cap branch to exact-input sem…
May 5, 2026
6f27971
fix(invariants): populate forfeitTokens in ArbitragerWithSplit.redeem
May 5, 2026
93f19ae
ci: pin Foundry to v1.5.1 across build and test jobs
May 5, 2026
a487047
Merge pull request #23 from parallel-protocol/audit/bailsec-april-202…
FabienCoutant May 5, 2026
3caaa8c
add(audits): include final report for Cyfrin - Parallel Protocol Upgr…
May 18, 2026
b4a854a
fix(Savings) [Cyfrin-L1]: validate divizer and name/symbol in initial…
May 18, 2026
d191c62
fix(Savings) [Cyfrin-I3]: override max* views to return 0 when paused…
May 18, 2026
a11c8bf
fix(ISavings) [Cyfrin-I4]: drop orphan initializeEIP3009 declaration
May 18, 2026
97680d2
docs(Redeemer) [Cyfrin-I6]: document entry-time penaltyFactor evaluat…
May 18, 2026
d3e4824
fix(Savings) [Cyfrin-I1]: accrue and clamp rate in setMaxRate to keep…
May 18, 2026
671e1e8
fix(Savings) [Cyfrin-I2]: accrue yield on togglePause transitions to …
May 18, 2026
9d04fd3
docs(audits): add Cyfrin v3.2 1st + final reports
May 27, 2026
a5cd5c0
Merge pull request #24 from parallel-protocol/audit/cyfrin-may-2026-e…
FabienCoutant May 27, 2026
14053df
Merge pull request #21 from parallel-protocol/audit/eip3009-hotfix-fees
FabienCoutant May 27, 2026
5b012cf
chore(foundry): default to via_ir = false
May 8, 2026
30f7d5c
refacto(utils): add SECONDS_PER_YEAR constant and Pause errors
May 8, 2026
f363ab2
refacto(parallelizer): split togglePause into pause and unpause
May 8, 2026
f437867
chore(foundry): default to via_ir = false
May 8, 2026
b3a581e
refacto(utils): add SECONDS_PER_YEAR constant and Pause errors
May 8, 2026
d85eb84
fix(savings): track storedAssets to prevent donation attacks
May 8, 2026
64923d1
test(savings): cover donation attacks, recoverSurplus and upgrade path
May 8, 2026
a1204e1
Merge pull request #25 from parallel-protocol/refactor/parallelizer-p…
FabienCoutant May 27, 2026
4baa958
Merge pull request #26 from parallel-protocol/fix/savings-donation-at…
FabienCoutant May 27, 2026
ad83408
style(savings): wrap long abi.encodeWithSelector line to satisfy solh…
May 27, 2026
6d5d279
Merge lint fix from fix/savings-donation-attack
May 27, 2026
1953ce3
test(invariants): stabilize path-independence vs intended I-6 path de…
May 27, 2026
8f47e85
Merge path-independence invariant stabilization from test/path-indepe…
May 27, 2026
b32a75c
test(invariants): widen path-independence tolerances for intended I-6…
May 27, 2026
2310b90
fix(invariants): drop redeem bound (stack), keep widened path-indepen…
May 27, 2026
8a9c2ac
chore: remove accidentally committed local script AddCollateralMUSDC
May 27, 2026
cc9adda
Merge pull request #28 from parallel-protocol/test/path-independence-…
FabienCoutant May 27, 2026
7c24bc4
Merge dev (path-independence tolerance fix #28) into integration branch
May 27, 2026
33b7a00
docs(audits): add Cyfrin Parallel Savings Fix 1st report
Jun 5, 2026
7468f4e
fix(Savings) [Cyfrin-I4]: set lastUpdate in initialize to bound first…
Jun 5, 2026
fcbc460
fix(Savings) [Cyfrin-I3]: restrict initializeStoredAssets to governance
Jun 5, 2026
ed6ae54
fix(Savings) [Cyfrin-L1]: bound storedAssets seeding to a lastUpdate …
Jun 5, 2026
0e81ba4
fix(Savings) [Cyfrin-L2]: drop paused interval on unpause so pausing …
Jun 5, 2026
ec66a0d
docs(audits): add Cyfrin Parallel Savings Fix final report
Jun 10, 2026
61942aa
Merge pull request #29 from parallel-protocol/audit/cyfrin-june-2026-…
FabienCoutant Jun 10, 2026
011211f
docs(audits): add Bailsec Parallel Savings Fix 1st report
Jun 26, 2026
c078aea
fix(Savings) [Bailsec-01]: grant initializeStoredAssets selector to g…
Jun 26, 2026
90428c0
fix(Savings) [Bailsec-02]: re-anchor lastUpdate in initializeStoredAs…
Jun 26, 2026
a3c5530
fix(Savings) [Bailsec-03]: return storedAssets from totalAssets while…
Jun 26, 2026
c4aebc2
fix(Savings) [Bailsec-04]: skip accrual while paused so rate setters …
Jun 26, 2026
d87db00
fix(Savings) [Bailsec-05]: enforce ERC4626 max checks in deposit/mint…
Jun 26, 2026
1276221
fix(Savings) [Bailsec-07]: guard entry points against uninitialized s…
Jun 26, 2026
f0dde86
fix(Savings) [Bailsec-05]: extend ERC4626 max checks to EIP-3009 auth…
Jul 6, 2026
21a1b7a
docs(audits): add Bailsec Parallel Savings Fix final report
Jul 6, 2026
aeb3262
Merge pull request #31 from parallel-protocol/audit/bailsec-june-2026…
FabienCoutant Jul 13, 2026
155e820
Merge pull request #27 from parallel-protocol/feat/savings-donation-a…
FabienCoutant Jul 13, 2026
cf4d314
chore(deps): migrate to rocketh 0.19 and hardhat-deploy 2
Jul 22, 2026
d554f28
fix(build): disable viaIR to keep facets under the EIP-170 limit
Jul 22, 2026
7072307
feat(roles): move surplus operations to a keeper role
Jul 22, 2026
e6f9b13
feat(getters): expose the surplus buffer ratio
Jul 22, 2026
ce69b96
feat(deploy): add upgrade scripts for the facets and the savings impl…
Jul 22, 2026
3d25236
chore(generated): drop the artifact outputs orphaned by hardhat-deploy 2
Jul 22, 2026
4326504
chore(deployments): record the sonic upgrade deployment
Jul 22, 2026
7ff8a57
chore(generated): track the compiled abis
Jul 22, 2026
8dda041
docs(audits): add the Cyfrin formal verification report for the savin…
Jul 24, 2026
351e721
chore(deployments): record the base upgrade deployment
Jul 24, 2026
111e2d5
chore(deployments): record the avalanche upgrade deployment
Jul 24, 2026
1d47b4a
chore(deployments): record the mainnet upgrade deployment
Jul 24, 2026
e04f1a4
chore(deployments): record the hyperevm upgrade deployment
Jul 24, 2026
0ce59af
chore(release): set version to 3.2.1
Jul 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: v1.5.1

- name: Compile foundry
run: forge build --sizes
Expand Down Expand Up @@ -70,6 +72,8 @@ jobs:

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: v1.5.1

- uses: actions/cache/restore@v4
with:
Expand All @@ -96,6 +100,8 @@ jobs:

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: v1.5.1

- uses: actions/cache/restore@v4
with:
Expand Down
353 changes: 283 additions & 70 deletions bun.lock

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions contracts/interfaces/IGetters.sol
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ interface IGetters {
/// @dev Maximum slippage tolerance is 1e9 (100%)
function getSlippageTolerance(address collateral) external view returns (uint256);

/// @notice Returns the minimum collateral ratio that must hold after surplus processing
/// @dev Expressed in base 1e9, and always >= 1e9
function getSurplusBufferRatio() external view returns (uint64);

/// @notice Computes the surplus of a collateral.
/// @param collateral The collateral address to compute the surplus of.
/// @return collateralSurplus The collateral surplus amount.
Expand Down
16 changes: 16 additions & 0 deletions contracts/interfaces/IRedeemer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ interface IRedeemer {
external
returns (address[] memory tokens, uint256[] memory amounts);

/// @notice Same as `redeemWithForfeit` but using a single EIP-3009 authorization for the tokenP
/// transfer.
/// @dev The signed EIP-3009 nonce MUST equal `LibAuthorization.computeRedeemNonce(...)` so that
/// mutating `receiver`, `amount`, `deadline`, `minAmountOuts` or `forfeitTokens` invalidates the
/// signature. `authData.nonce` carries the caller-chosen `userSalt`.
function redeemWithAuthorization(
uint256 amount,
address receiver,
uint256 deadline,
uint256[] memory minAmountOuts,
address[] memory forfeitTokens,
bytes memory authData
)
external
returns (address[] memory tokens, uint256[] memory amounts);

/// @notice Simulate the exact output that a redemption of `amount` of stablecoins would give at a given block
/// @return tokens List of tokens that would be given
/// @return amounts Amount that would be obtained for each token in the `tokens` array
Expand Down
80 changes: 80 additions & 0 deletions contracts/interfaces/ISavings.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.28;

import { IEIP3009 } from "./external/IEIP3009.sol";

/// @title ISavings
/// @author Cooper Labs
/// @custom:contact security@cooperlabs.xyz
interface ISavings is IEIP3009 {
/// @notice Deposit the underlying asset on behalf of `owner` and mint shares to `receiver`.
/// @param savingsSignature Signature over `DEPOSIT_WITH_AUTHORIZATION_TYPEHASH` against the
/// Savings contract's EIP-712 domain, binding `receiver` to prevent relayer front-running.
/// @param tokenSignature Standard EIP-3009 `ReceiveWithAuthorization` signature against the
/// underlying asset's EIP-712 domain, authorizing the transfer of `assets` into this contract.
function depositWithAuthorization(
uint256 assets,
address receiver,
address owner,
uint256 validAfter,
uint256 validBefore,
bytes32 nonce,
bytes calldata savingsSignature,
bytes calldata tokenSignature
)
external
returns (uint256 shares);

/// @notice Burn `shares` from `owner` and send the underlying asset to `receiver`.
/// @dev Signature is over `REDEEM_WITH_AUTHORIZATION_TYPEHASH` against the Savings contract's
/// EIP-712 domain and binds `receiver` to prevent relayer front-running.
function redeemWithAuthorization(
uint256 shares,
address receiver,
address owner,
uint256 validAfter,
uint256 validBefore,
bytes32 nonce,
uint8 v,
bytes32 r,
bytes32 s
)
external
returns (uint256 assets);

/// @notice EIP-1271 compatible variant of `redeemWithAuthorization`.
function redeemWithAuthorization(
uint256 shares,
address receiver,
address owner,
uint256 validAfter,
uint256 validBefore,
bytes32 nonce,
bytes calldata signature
)
external
returns (uint256 assets);

function cancelAuthorization(address authorizer, bytes32 nonce, uint8 v, bytes32 r, bytes32 s) external;

function authorizationState(address authorizer, bytes32 nonce) external view returns (bool);

// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);

function estimatedAPY() external view returns (uint256 apy);

function computeUpdatedAssets(uint256 totalAssets, uint256 exp) external view returns (uint256);

function pause() external;

function unpause() external;

function toggleTrusted(address trustedAddress) external;

function setRate(uint208 newRate) external;

function setMaxRate(uint256 newMaxRate) external;

function recoverSurplus(address to) external returns (uint256 surplus);
}
9 changes: 7 additions & 2 deletions contracts/interfaces/ISetters.sol
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,13 @@ interface ISettersGovernor {
/// @author Cooper Labs
/// @custom:contact security@cooperlabs.xyz
interface ISettersGuardian {
/// @notice Changes the pause status for mint or burn transactions for `collateral`
function togglePause(address collateral, ActionType action) external;
/// @notice Pauses `action` for `collateral` (or pauses redemption protocol-wide when
/// `action == Redeem`). Reverts if the action is already paused.
function pause(address collateral, ActionType action) external;

/// @notice Unpauses `action` for `collateral` (or unpauses redemption protocol-wide when
/// `action == Redeem`). Reverts if the action is not paused.
function unpause(address collateral, ActionType action) external;

/// @notice Sets the mint or burn fees for `collateral`
function setFees(address collateral, uint64[] memory xFee, int64[] memory yFee, bool mint) external;
Expand Down
35 changes: 35 additions & 0 deletions contracts/interfaces/ISwapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,41 @@ interface ISwapper {
external
returns (uint256 amountIn);

/// @notice Same as `swapExactInput`, but using a single EIP-3009 authorization for `tokenIn`.
/// @dev The signed EIP-3009 nonce MUST equal `LibAuthorization.computeSwapExactInputNonce(...)`,
/// which binds the full swap intent. `authData.nonce` carries the caller-chosen `userSalt`; the
/// facet recomputes the derived nonce from the call arguments before forwarding it to the
/// token, so any tampering with `to`/slippage/deadline invalidates the signature.
/// @param authData ABI-encoded `AuthorizationParams` with `nonce = userSalt`
function swapExactInputWithAuthorization(
uint256 amountIn,
uint256 amountOutMin,
address tokenIn,
address tokenOut,
address to,
uint256 deadline,
bytes calldata authData
)
external
returns (uint256 amountOut);

/// @notice Same as `swapExactOutput`, but using a single EIP-3009 authorization for `tokenIn`.
/// @dev The authorization must be signed for `amountInMax`; the excess is refunded to the
/// authorizer. Derived-nonce scheme as in `swapExactInputWithAuthorization`, using
/// `LibAuthorization.computeSwapExactOutputNonce(...)`.
/// @param authData ABI-encoded `AuthorizationParams` with `nonce = userSalt`
function swapExactOutputWithAuthorization(
uint256 amountOut,
uint256 amountInMax,
address tokenIn,
address tokenOut,
address to,
uint256 deadline,
bytes calldata authData
)
external
returns (uint256 amountIn);

/// @notice Simulates what a call to `swapExactInput` with `amountIn` of `tokenIn` for `tokenOut` would give.
/// If called right before and at the same block, the `amountOut` outputted by this function is exactly the
/// amount that will be obtained with `swapExactInput`
Expand Down
123 changes: 123 additions & 0 deletions contracts/interfaces/external/IEIP3009.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

/// @title IEIP3009
/// @notice Interface for EIP-3009: Transfer With Authorization
interface IEIP3009 {
/// @notice Execute a transfer with a signed authorization (EOA signature)
/// @dev SECURITY: anyone may submit this call (no `msg.sender` restriction). Integrators that
/// pair the transfer with downstream logic (e.g. swap, deposit, redeem) MUST use
/// `receiveWithAuthorization` instead: a mempool watcher can otherwise frontrun the original
/// transaction with a raw `transferWithAuthorization`, burning the nonce so the original
/// reverts while the funds still move - causing the post-transfer logic to be skipped.
/// Use this primitive only for direct payouts to a passive recipient (`msg.sender != to`).
/// @param from The address of the sender
/// @param to The address of the recipient
/// @param value The amount of tokens to transfer
/// @param validAfter The timestamp after which the authorization is valid
/// @param validBefore The timestamp before which the authorization is valid
/// @param nonce The nonce of the authorization
/// @param v The recovery id of the signature
/// @param r The r value of the signature
/// @param s The s value of the signature
function transferWithAuthorization(
address from,
address to,
uint256 value,
uint256 validAfter,
uint256 validBefore,
bytes32 nonce,
uint8 v,
bytes32 r,
bytes32 s
)
external;

/// @notice Execute a transfer with a signed authorization (EIP-1271 compatible)
/// @dev SECURITY: see the EOA overload - this primitive is frontrun-prone and must not be used
/// when the transfer is bound to follow-on logic. Use `receiveWithAuthorization` in that case.
/// @param from The payer's address (Authorizer)
/// @param to The payee's address
/// @param value The amount to be transferred
/// @param validAfter The time after which this is valid (unix time)
/// @param validBefore The time before which this is valid (unix time)
/// @param nonce The nonce
/// @param signature The signature bytes signed by an EOA wallet or a contract wallet
function transferWithAuthorization(
address from,
address to,
uint256 value,
uint256 validAfter,
uint256 validBefore,
bytes32 nonce,
bytes calldata signature
)
external;

/// @notice Receive a transfer with a signed authorization (EOA signature)
/// @dev The caller must be the payee (`to` address). This has an additional check to ensure
/// that the payee's address matches the caller of this function to prevent front-running attacks.
/// @param from The payer's address (Authorizer)
/// @param to The payee's address
/// @param value The amount to be transferred
/// @param validAfter The time after which this is valid (unix time)
/// @param validBefore The time before which this is valid (unix time)
/// @param nonce The nonce
/// @param v The recovery id of the signature
/// @param r The r value of the signature
/// @param s The s value of the signature
function receiveWithAuthorization(
address from,
address to,
uint256 value,
uint256 validAfter,
uint256 validBefore,
bytes32 nonce,
uint8 v,
bytes32 r,
bytes32 s
)
external;

/// @notice Receive a transfer with a signed authorization (EIP-1271 compatible)
/// @dev The caller must be the payee (`to` address)
/// @param from The payer's address (Authorizer)
/// @param to The payee's address
/// @param value The amount to be transferred
/// @param validAfter The time after which this is valid (unix time)
/// @param validBefore The time before which this is valid (unix time)
/// @param nonce The nonce
/// @param signature The signature bytes signed by an EOA wallet or a contract wallet
function receiveWithAuthorization(
address from,
address to,
uint256 value,
uint256 validAfter,
uint256 validBefore,
bytes32 nonce,
bytes calldata signature
)
external;

/// @notice Attempt to cancel an authorization
/// @dev Works only if the authorization is not yet used.
/// EOA wallet signatures should be packed in the order of r, s, v.
/// @param authorizer Authorizer's address
/// @param nonce Nonce of the authorization
/// @param v The recovery id of the signature
/// @param r The r value of the signature
/// @param s The s value of the signature
function cancelAuthorization(address authorizer, bytes32 nonce, uint8 v, bytes32 r, bytes32 s) external;

/// @notice Cancel an authorization (EIP-1271 compatible)
/// @param authorizer Authorizer's address
/// @param nonce Nonce of the authorization
/// @param signature The signature bytes signed by an EOA wallet or a contract wallet
function cancelAuthorization(address authorizer, bytes32 nonce, bytes calldata signature) external;

/// @notice Returns the state of an authorization
/// @param authorizer Authorizer's address
/// @param nonce Nonce of the authorization
/// @return true if the nonce is used
function authorizationState(address authorizer, bytes32 nonce) external view returns (bool);
}
9 changes: 9 additions & 0 deletions contracts/parallelizer/Storage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ struct Permit2Details {
bytes signature; // Permit signature of the user
}

struct AuthorizationParams {
address from; // Payer's address (Authorizer)
uint256 value; // Amount authorized to be transferred
uint256 validAfter; // The time after which this is valid (unix time)
uint256 validBefore; // The time before which this is valid (unix time)
bytes32 nonce; // Unique nonce
bytes signature; // EOA (r,s,v packed) or arbitrary-length EIP-1271 contract signature
}

struct FacetCut {
address facetAddress; // Facet contract address
FacetCutAction action; // Can be add, remove or replace
Expand Down
6 changes: 3 additions & 3 deletions contracts/parallelizer/configs/DiamondInitializer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ contract DiamondInitializer {
LibSetters.setFees(collateral.token, collateral.xMintFee, collateral.yMintFee, true);
// Burn fees
LibSetters.setFees(collateral.token, collateral.xBurnFee, collateral.yBurnFee, false);
LibSetters.togglePause(collateral.token, ActionType.Mint);
LibSetters.togglePause(collateral.token, ActionType.Burn);
LibSetters.unpause(collateral.token, ActionType.Mint);
LibSetters.unpause(collateral.token, ActionType.Burn);
LibSetters.setStablecoinCap(collateral.token, 100_000_000 ether);
if (collateral.targetMax) LibOracle.updateOracle(collateral.token);
}

// setRedemptionCurveParams
if (_redemptionSetup.xRedeemFee.length > 0) {
LibSetters.togglePause(address(0), ActionType.Redeem);
LibSetters.unpause(address(0), ActionType.Redeem);
LibSetters.setRedemptionCurveParams(_redemptionSetup.xRedeemFee, _redemptionSetup.yRedeemFee);
}
}
Expand Down
Loading
Loading