@owlprotocol/contracts-account-abstraction
Version:
ERC4337 Account Abstraction support for deploying relevant smart contracts and interacting with UserOps.
352 lines (350 loc) • 15.7 kB
text/typescript
import { SolcMetadata } from "@owlprotocol/viem-utils";
export const IStakeManager: SolcMetadata = {
compiler: {
version: "0.8.23+commit.f704f362",
},
language: "Solidity",
output: {
abi: [
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "account",
type: "address",
},
{
indexed: false,
internalType: "uint256",
name: "totalDeposit",
type: "uint256",
},
],
name: "Deposited",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "account",
type: "address",
},
{
indexed: false,
internalType: "uint256",
name: "totalStaked",
type: "uint256",
},
{
indexed: false,
internalType: "uint256",
name: "unstakeDelaySec",
type: "uint256",
},
],
name: "StakeLocked",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "account",
type: "address",
},
{
indexed: false,
internalType: "uint256",
name: "withdrawTime",
type: "uint256",
},
],
name: "StakeUnlocked",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "account",
type: "address",
},
{
indexed: false,
internalType: "address",
name: "withdrawAddress",
type: "address",
},
{
indexed: false,
internalType: "uint256",
name: "amount",
type: "uint256",
},
],
name: "StakeWithdrawn",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "account",
type: "address",
},
{
indexed: false,
internalType: "address",
name: "withdrawAddress",
type: "address",
},
{
indexed: false,
internalType: "uint256",
name: "amount",
type: "uint256",
},
],
name: "Withdrawn",
type: "event",
},
{
inputs: [
{
internalType: "uint32",
name: "_unstakeDelaySec",
type: "uint32",
},
],
name: "addStake",
outputs: [],
stateMutability: "payable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address",
},
],
name: "balanceOf",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address",
},
],
name: "depositTo",
outputs: [],
stateMutability: "payable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address",
},
],
name: "getDepositInfo",
outputs: [
{
components: [
{
internalType: "uint256",
name: "deposit",
type: "uint256",
},
{
internalType: "bool",
name: "staked",
type: "bool",
},
{
internalType: "uint112",
name: "stake",
type: "uint112",
},
{
internalType: "uint32",
name: "unstakeDelaySec",
type: "uint32",
},
{
internalType: "uint48",
name: "withdrawTime",
type: "uint48",
},
],
internalType: "struct IStakeManager.DepositInfo",
name: "info",
type: "tuple",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "unlockStake",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address payable",
name: "withdrawAddress",
type: "address",
},
],
name: "withdrawStake",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address payable",
name: "withdrawAddress",
type: "address",
},
{
internalType: "uint256",
name: "withdrawAmount",
type: "uint256",
},
],
name: "withdrawTo",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
],
devdoc: {
kind: "dev",
methods: {
"addStake(uint32)": {
params: {
_unstakeDelaySec: "- The new lock duration before the deposit can be withdrawn.",
},
},
"balanceOf(address)": {
params: {
account: "- The account to query.",
},
returns: {
_0: "- The deposit (for gas payment) of the account.",
},
},
"depositTo(address)": {
params: {
account: "- The account to add to.",
},
},
"getDepositInfo(address)": {
params: {
account: "- The account to query.",
},
returns: {
info: " - Full deposit information of given account.",
},
},
"withdrawStake(address)": {
params: {
withdrawAddress: "- The address to send withdrawn value.",
},
},
"withdrawTo(address,uint256)": {
params: {
withdrawAddress: "- The address to send withdrawn value.",
withdrawAmount: "- The amount to withdraw.",
},
},
},
version: 1,
},
userdoc: {
kind: "user",
methods: {
"addStake(uint32)": {
notice: "Add to the account's stake - amount and delay any pending unstake is first cancelled.",
},
"balanceOf(address)": {
notice: "Get account balance.",
},
"depositTo(address)": {
notice: "Add to the deposit of the given account.",
},
"getDepositInfo(address)": {
notice: "Get deposit info.",
},
"unlockStake()": {
notice: "Attempt to unlock the stake. The value can be withdrawn (using withdrawStake) after the unstake delay.",
},
"withdrawStake(address)": {
notice: "Withdraw from the (unlocked) stake. Must first call unlockStake and wait for the unstakeDelay to pass.",
},
"withdrawTo(address,uint256)": {
notice: "Withdraw from the deposit.",
},
},
notice: 'Manage deposits and stakes. Deposit is just a balance used to pay for UserOperations (either by a paymaster or an account). Stake is value locked for at least "unstakeDelay" by the staked entity.',
version: 1,
},
},
settings: {
compilationTarget: {
"@account-abstraction/contracts/interfaces/IStakeManager.sol": "IStakeManager",
},
evmVersion: "paris",
libraries: {},
metadata: {
bytecodeHash: "ipfs",
useLiteralContent: true,
},
optimizer: {
enabled: true,
runs: 1000000,
},
remappings: [],
viaIR: true,
},
sources: {
"@account-abstraction/contracts/interfaces/IStakeManager.sol": {
content:
"// SPDX-License-Identifier: GPL-3.0-only\npragma solidity >=0.7.5;\n\n/**\n * Manage deposits and stakes.\n * Deposit is just a balance used to pay for UserOperations (either by a paymaster or an account).\n * Stake is value locked for at least \"unstakeDelay\" by the staked entity.\n */\ninterface IStakeManager {\n event Deposited(address indexed account, uint256 totalDeposit);\n\n event Withdrawn(\n address indexed account,\n address withdrawAddress,\n uint256 amount\n );\n\n // Emitted when stake or unstake delay are modified.\n event StakeLocked(\n address indexed account,\n uint256 totalStaked,\n uint256 unstakeDelaySec\n );\n\n // Emitted once a stake is scheduled for withdrawal.\n event StakeUnlocked(address indexed account, uint256 withdrawTime);\n\n event StakeWithdrawn(\n address indexed account,\n address withdrawAddress,\n uint256 amount\n );\n\n /**\n * @param deposit - The entity's deposit.\n * @param staked - True if this entity is staked.\n * @param stake - Actual amount of ether staked for this entity.\n * @param unstakeDelaySec - Minimum delay to withdraw the stake.\n * @param withdrawTime - First block timestamp where 'withdrawStake' will be callable, or zero if already locked.\n * @dev Sizes were chosen so that deposit fits into one cell (used during handleOp)\n * and the rest fit into a 2nd cell (used during stake/unstake)\n * - 112 bit allows for 10^15 eth\n * - 48 bit for full timestamp\n * - 32 bit allows 150 years for unstake delay\n */\n struct DepositInfo {\n uint256 deposit;\n bool staked;\n uint112 stake;\n uint32 unstakeDelaySec;\n uint48 withdrawTime;\n }\n\n // API struct used by getStakeInfo and simulateValidation.\n struct StakeInfo {\n uint256 stake;\n uint256 unstakeDelaySec;\n }\n\n /**\n * Get deposit info.\n * @param account - The account to query.\n * @return info - Full deposit information of given account.\n */\n function getDepositInfo(\n address account\n ) external view returns (DepositInfo memory info);\n\n /**\n * Get account balance.\n * @param account - The account to query.\n * @return - The deposit (for gas payment) of the account.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * Add to the deposit of the given account.\n * @param account - The account to add to.\n */\n function depositTo(address account) external payable;\n\n /**\n * Add to the account's stake - amount and delay\n * any pending unstake is first cancelled.\n * @param _unstakeDelaySec - The new lock duration before the deposit can be withdrawn.\n */\n function addStake(uint32 _unstakeDelaySec) external payable;\n\n /**\n * Attempt to unlock the stake.\n * The value can be withdrawn (using withdrawStake) after the unstake delay.\n */\n function unlockStake() external;\n\n /**\n * Withdraw from the (unlocked) stake.\n * Must first call unlockStake and wait for the unstakeDelay to pass.\n * @param withdrawAddress - The address to send withdrawn value.\n */\n function withdrawStake(address payable withdrawAddress) external;\n\n /**\n * Withdraw from the deposit.\n * @param withdrawAddress - The address to send withdrawn value.\n * @param withdrawAmount - The amount to withdraw.\n */\n function withdrawTo(\n address payable withdrawAddress,\n uint256 withdrawAmount\n ) external;\n}\n",
keccak256: "0xbe5ca9e7f254d031687419e7b96ef48c9c63e9398bbe992dc72ffc6dc14e0a04",
license: "GPL-3.0-only",
},
},
version: 1,
};