A collection of ERC-7579 and smart session modules built by Stackup.
All modules are deployed using the deterministic deployment proxy and have the same address on all chains.
v1.0.0
Contract | Address | Type |
---|---|---|
WebAuthnValidator.sol |
0x6140DB7a66a18A7741ED2687409ef471235b4Df0 |
Stateless validator |
SudoPolicy.sol |
0x8032214D4082714742Ba137eBfbf05e3a9a5bCfC |
Policy |
IntervalSpendingLimitPolicy.sol |
0xAd8508E62BCf4bFBC6b092E5e9e54508c4936555 |
Policy |
The remaining section will assume knowledge on ERC-4337 (Account Abstraction), ERC-7579 (Minimal Modular Smart Accounts), and Smart Sessions. If you are unfamiliar, we recommend the following resources to get started:
A minimal wrapper around webauthn-sol to enable compatibility with smart sessions. This allows sessions to be authenticated directly with an end user's passkey.
A fork of the original SudoPolicy.sol, but with the added support for a IUserOpPolicy
.
See here for details on why this is required.
A fork of SpendingLimitPolicy.sol. The difference is the inclusion of two additional features:
- Efficiently resetting the accrued spend at defined intervals set during initialization.
Daily
: on midnight everyday.Weekly
: on Monday every week.Monthly
: on the first day of every month.
- Ability to track both native and ERC20 tokens.
Note that this policy relies on the
TIMESTAMP
opcode during validation and requires an alternative mempool. This is needed to ensure time intervals work as expected.
This project requires Foundry to be installed. If you're developing with VSCode, we also recommend using the Solidity extension by Nomic Foundation.
Install node_modules
:
pnpm install
Install foundry submodules:
forge install
All smart contracts live under the src directory.
forge build
All tests live under the test directory.
forge test
- Import your modules into the
script/DeployModule.s.sol
file. - Create a
.env
file in the root directory based on the.env.example
file and fill in the variables. - Run the following command:
source .env && forge script script/DeployModule.s.sol:DeployModuleScript --rpc-url $DEPLOYMENT_RPC --broadcast --sender $DEPLOYMENT_SENDER --verify
Your module is now deployed to the blockchain and verified on Etherscan.
If the verification fails, you can manually verify it on Etherscan using the following command:
source .env && forge verify-contract --chain-id [YOUR_CHAIN_ID] --watch --etherscan-api-key $ETHERSCAN_API_KEY [YOUR_MODULE_ADDRESS] src/[PATH_TO_MODULE].sol:[MODULE_CONTRACT_NAME]
This is a read-only script to generate the counterfactual module addresses:
source .env && forge script script/GetModuleAddress.s.sol:GetModuleAddressScript --rpc-url $DEPLOYMENT_RPC
This command connects with a local wallet interface in order to submit and revoke module attestations.
Note that you will need to edit the
CHAIN
and module addresses inscript/registry
to their correct values.
yarn registry:attest
# If a revoke is necessary...
yarn registry:revoke
Distributed under the GPL-3.0 License. See LICENSE for more information.