-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from etherspot/session-keys-module
`ERC20SessionKeyValidator` Module
- Loading branch information
Showing
365 changed files
with
86,940 additions
and
254 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -21,7 +21,6 @@ node_modules | |
|
||
# Hardhat | ||
.hardhat | ||
typings | ||
coverage.json | ||
|
||
# IDEs | ||
|
This file contains 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,19 @@ | ||
# Contract Deployments | ||
|
||
## Mainnets | ||
|
||
| Contract Name | Network | Contract Address | Transaction Hash | | ||
| --- | --- | --- | --- | | ||
| `ModularEtherspotWallet` | | []() | []() | | ||
| `ModularEtherspotWalletFactory` | | []() | []() | | ||
| `Bootstrap` | | []() | []() | | ||
| `MultipleOwnerECDSAValidator` | | []() | []() | | ||
|
||
## Testnets | ||
|
||
| Contract Name | Network | Contract Address | Transaction Hash | | ||
| --- | --- | --- | --- | | ||
| `ModularEtherspotWallet` | `sepolia` | [0x917398df969752a7d94725740918f38e4b8eecec](https://sepolia.etherscan.io/address/0x917398df969752a7d94725740918f38e4b8eecec) | [0x983a9141f38e7e1a1a70cfe9354eb5e6d61dd39e228990b80146c175a1928d6e](https://sepolia.etherscan.io/tx/0x983a9141f38e7e1a1a70cfe9354eb5e6d61dd39e228990b80146c175a1928d6e) | | ||
| `ModularEtherspotWalletFactory` | `sepolia` | [0x77e4288a4b15893f520f15c262a07df9866904e4](https://sepolia.etherscan.io/address/0x77e4288a4b15893f520f15c262a07df9866904e4) | [0x0f4b4f53a2654e34e7b0a3aad01f9a90d711df2af1d3d9d8a2e70a63c36bc254](https://sepolia.etherscan.io/tx/0x0f4b4f53a2654e34e7b0a3aad01f9a90d711df2af1d3d9d8a2e70a63c36bc254) | | ||
| `Bootstrap` | `sepolia` | [0x4f695ad7694863c8280fcebf2cb220e361ce4ea0](https://sepolia.etherscan.io/address/0x4f695ad7694863c8280fcebf2cb220e361ce4ea0) | [0xc69aed3fd25ef9bd66c42903dd855cd363d703f03049be9fb3a2fdf0c75ecfb1](https://sepolia.etherscan.io/tx/0xc69aed3fd25ef9bd66c42903dd855cd363d703f03049be9fb3a2fdf0c75ecfb1) | | ||
| `MultipleOwnerECDSAValidator` | `sepolia` | [0x1e714c551fe6234b6ee406899ec3be9234ad2124](https://sepolia.etherscan.io/address/0x1e714c551fe6234b6ee406899ec3be9234ad2124) | [0x1b56d1e32cb12d16b3878eed660ae23eb454cd3e84ae9e88d8ed40d0d0c5e6f8](https://sepolia.etherscan.io/tx/0x1b56d1e32cb12d16b3878eed660ae23eb454cd3e84ae9e88d8ed40d0d0c5e6f8) | |
File renamed without changes.
This file contains 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
2 changes: 1 addition & 1 deletion
2
artifacts/@openzeppelin/contracts/access/Ownable.sol/Ownable.dbg.json
This file contains 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,4 +1,4 @@ | ||
{ | ||
"_format": "hh-sol-dbg-1", | ||
"buildInfo": "../../../../build-info/5fd328716234c289581a8ec2c341af6c.json" | ||
"buildInfo": "../../../../build-info/11e946ee2480cfa4c23fb74059dc998f.json" | ||
} |
2 changes: 1 addition & 1 deletion
2
artifacts/@openzeppelin/contracts/interfaces/draft-IERC1822.sol/IERC1822Proxiable.dbg.json
This file contains 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,4 +1,4 @@ | ||
{ | ||
"_format": "hh-sol-dbg-1", | ||
"buildInfo": "../../../../build-info/5fd328716234c289581a8ec2c341af6c.json" | ||
"buildInfo": "../../../../build-info/11e946ee2480cfa4c23fb74059dc998f.json" | ||
} |
2 changes: 1 addition & 1 deletion
2
artifacts/@openzeppelin/contracts/proxy/beacon/IBeacon.sol/IBeacon.dbg.json
This file contains 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,4 +1,4 @@ | ||
{ | ||
"_format": "hh-sol-dbg-1", | ||
"buildInfo": "../../../../../build-info/5fd328716234c289581a8ec2c341af6c.json" | ||
"buildInfo": "../../../../../build-info/11e946ee2480cfa4c23fb74059dc998f.json" | ||
} |
2 changes: 1 addition & 1 deletion
2
artifacts/@openzeppelin/contracts/proxy/utils/Initializable.sol/Initializable.dbg.json
This file contains 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,4 +1,4 @@ | ||
{ | ||
"_format": "hh-sol-dbg-1", | ||
"buildInfo": "../../../../../build-info/5fd328716234c289581a8ec2c341af6c.json" | ||
"buildInfo": "../../../../../build-info/11e946ee2480cfa4c23fb74059dc998f.json" | ||
} |
2 changes: 1 addition & 1 deletion
2
artifacts/@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol/UUPSUpgradeable.dbg.json
This file contains 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,4 +1,4 @@ | ||
{ | ||
"_format": "hh-sol-dbg-1", | ||
"buildInfo": "../../../../../build-info/5fd328716234c289581a8ec2c341af6c.json" | ||
"buildInfo": "../../../../../build-info/11e946ee2480cfa4c23fb74059dc998f.json" | ||
} |
2 changes: 1 addition & 1 deletion
2
artifacts/@openzeppelin/contracts/utils/Address.sol/Address.dbg.json
This file contains 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,4 +1,4 @@ | ||
{ | ||
"_format": "hh-sol-dbg-1", | ||
"buildInfo": "../../../../build-info/5fd328716234c289581a8ec2c341af6c.json" | ||
"buildInfo": "../../../../build-info/11e946ee2480cfa4c23fb74059dc998f.json" | ||
} |
2 changes: 1 addition & 1 deletion
2
artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json
This file contains 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,4 +1,4 @@ | ||
{ | ||
"_format": "hh-sol-dbg-1", | ||
"buildInfo": "../../../../build-info/5fd328716234c289581a8ec2c341af6c.json" | ||
"buildInfo": "../../../../build-info/11e946ee2480cfa4c23fb74059dc998f.json" | ||
} |
2 changes: 1 addition & 1 deletion
2
artifacts/@openzeppelin/contracts/utils/StorageSlot.sol/StorageSlot.dbg.json
This file contains 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,4 +1,4 @@ | ||
{ | ||
"_format": "hh-sol-dbg-1", | ||
"buildInfo": "../../../../build-info/5fd328716234c289581a8ec2c341af6c.json" | ||
"buildInfo": "../../../../build-info/11e946ee2480cfa4c23fb74059dc998f.json" | ||
} |
2 changes: 1 addition & 1 deletion
2
artifacts/@openzeppelin/contracts/utils/Strings.sol/Strings.dbg.json
This file contains 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,4 +1,4 @@ | ||
{ | ||
"_format": "hh-sol-dbg-1", | ||
"buildInfo": "../../../../build-info/5fd328716234c289581a8ec2c341af6c.json" | ||
"buildInfo": "../../../../build-info/11e946ee2480cfa4c23fb74059dc998f.json" | ||
} |
2 changes: 1 addition & 1 deletion
2
artifacts/@openzeppelin/contracts/utils/cryptography/ECDSA.sol/ECDSA.dbg.json
This file contains 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,4 +1,4 @@ | ||
{ | ||
"_format": "hh-sol-dbg-1", | ||
"buildInfo": "../../../../../build-info/5fd328716234c289581a8ec2c341af6c.json" | ||
"buildInfo": "../../../../../build-info/11e946ee2480cfa4c23fb74059dc998f.json" | ||
} |
2 changes: 1 addition & 1 deletion
2
artifacts/@openzeppelin/contracts/utils/math/Math.sol/Math.dbg.json
This file contains 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,4 +1,4 @@ | ||
{ | ||
"_format": "hh-sol-dbg-1", | ||
"buildInfo": "../../../../../build-info/5fd328716234c289581a8ec2c341af6c.json" | ||
"buildInfo": "../../../../../build-info/11e946ee2480cfa4c23fb74059dc998f.json" | ||
} |
This file contains 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,59 @@ | ||
## ERC20SessionKeyValidator | ||
|
||
The `ERC20SessionKeyValidator` is a Solidity smart contract that implements the `IValidator` interface from the `IERC7579Module` contract. It is designed to validate user operations (UserOps) for ERC20 token transfers and approvals based on pre-configured session keys. | ||
|
||
### Features | ||
|
||
- Allows wallet owners to enable and disable session keys for specific ERC20 tokens. | ||
- Supports setting spending limits, validity periods, and pausability for each session key. | ||
- Validates UserOps against the configured session key parameters before execution. | ||
- Provides functions to manage session keys, including rotation and pause/unpause. | ||
- Implements EIP-712 for signature verification. | ||
|
||
### Events | ||
|
||
- `ERC20SKV_SessionKeyEnabled(address sessionKey, address wallet)`: Emitted when a new session key is enabled for a wallet. | ||
- `ERC20SKV_SessionKeyDisabled(address sessionKey, address wallet)`: Emitted when a session key is disabled for a wallet. | ||
|
||
### Errors | ||
|
||
- `ERC20SKV_InvalidSessionKey()`: Thrown when the provided session key is invalid or expired. | ||
- `ERC20SKV_SessionPaused(address sessionKey)`: Thrown when the provided session key is currently paused. | ||
- `ERC20SKV_UnsuportedToken()`: Thrown when the target contract is not the configured token for the session key. | ||
- `ERC20SKV_UnsupportedSelector(bytes4 selectorUsed)`: Thrown when the function selector is not supported by the session key. | ||
- `ERC20SKV_UnsupportedInterface()`: Thrown when the target contract does not support the required interface for the session key. | ||
- `ERC20SKV_SessionKeySpendLimitExceeded()`: Thrown when the requested transfer amount exceeds the spending limit of the session key. | ||
- `ERC20SKV_InsufficientApprovalAmount()`: Thrown when the approval amount is insufficient for the requested transfer. | ||
- `NotImplemented()`: Thrown for unimplemented functions. | ||
|
||
### Structs | ||
|
||
- `SessionData`: Stores the configuration data for a session key, including the token address, interface ID, function selector, spending limit, validity period, and pause status. | ||
|
||
### Functions | ||
|
||
- `enableSessionKey(bytes calldata _sessionData)`: Enables a new session key for the caller's wallet with the provided configuration data. | ||
- `disableSessionKey(address _session)`: Disables the specified session key for the caller's wallet. | ||
- `rotateSessionKey(address _oldSessionKey, bytes calldata _newSessionData)`: Disables the old session key and enables a new one with the provided configuration data. | ||
- `toggleSessionKeyPause(address _sessionKey)`: Toggles the pause status of the specified session key for the caller's wallet. | ||
- `checkSessionKeyPaused(address _sessionKey)`: Checks if the specified session key is currently paused for the caller's wallet. | ||
- `validateSessionKeyParams(address _sessionKey, PackedUserOperation calldata userOp)`: Validates the provided UserOp against the configuration of the specified session key. | ||
- `getAssociatedSessionKeys()`: Returns an array of session keys associated with the caller's wallet. | ||
- `getSessionKeyData(address _sessionKey)`: Returns the configuration data for the specified session key and the caller's wallet. | ||
- `validateUserOp(PackedUserOperation calldata userOp, bytes32 userOpHash)`: Validates the provided UserOp using the EIP-712 signature and session key parameters. | ||
- `isModuleType(uint256 moduleTypeId)`: Checks if the contract is a validator module type. | ||
- `onInstall(bytes calldata data)`: Required by the `IValidator` interface but not implemented. | ||
- `onUninstall(bytes calldata data)`: Required by the `IValidator` interface but not implemented. | ||
- `isValidSignatureWithSender(address sender, bytes32 hash, bytes calldata data)`: Required by the `IValidator` interface but not implemented. | ||
- `isInitialized(address smartAccount)`: Required by the `IValidator` interface but not implemented. | ||
|
||
### Internal Functions | ||
|
||
- `_digest(bytes calldata _data)`: Internal function that extracts the function selector, target contract, recipient, sender, and amount from the provided calldata. | ||
- `_domainSeparator()`: Internal function that calculates the EIP-712 domain separator for signature verification. | ||
- `_domainNameAndVersion()`: Internal function that returns the contract name and version for the EIP-712 domain separator. | ||
|
||
### Usage | ||
|
||
To use the `ERC20SessionKeyValidator` contract, wallet owners can enable session keys with specific configurations for ERC20 token transfers and approvals. The contract will validate UserOps against the configured session key parameters before execution, ensuring that the requested operation is within the allowed limits and validity period. | ||
|
File renamed without changes.
This file contains 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
This file contains 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
Oops, something went wrong.