Hermes smart contracts manage token delegation and staking, particularly designed for 1inch token staking with support for sub-delegation of voting power.
The Hermes smart contracts consists of three main contracts that work together to enable flexible token staking and voting power delegation:
- HermesProxyFactory: Creates and manages Hermes contract instances
- Hermes: Handles Envoys and lead delegation
- Envoy: Manages token staking and sub-delegation of voting power
HermesProxyFactory
↓
Hermes
↓
Envoy(s)
HermesProxyFactory
deploys and funds new Hermes contracts- Each
Hermes
contract can manage multipleEnvoy
contracts Envoy
contracts handle individual staking and sub-delegations
- CREATE2-based proxy deployment for deterministic addresses
- Support for 1inch token staking
- Hierarchical delegation structure with lead delegatee and sub-delegators
- Early withdrawal options with configurable loss parameters
- Maximum limits for sub-delegators and staking duration
- Safe token handling using OpenZeppelin's SafeERC20
The entry point for creating new Hermes instances. It handles:
- Deployment of new Hermes contracts
- Initial funding of contracts with tokens
- Token recall functionality
- Address calculation for deployed contracts
The main contract managing delegation relationships. Features include:
- Sub-delegation management
- Token staking control
- Envoy contract deployment
- Multi-delegation support
- Recall mechanisms for staked tokens
Handles individual sub-delegations with features for:
- Token staking with 1inch protocol
- Snapshot delegation management
- Early withdrawal calculations
- Token recall functions
Tokens can be recalled through several methods:
- Standard recall:
recall(address envoy, address to)
- Early recall with loss parameters:
recallEarly(address envoy, address to, uint256 minReturn, uint256 maxLoss)
- Recall all delegations:
recallAll(address to)
- All contracts use OpenZeppelin's SafeERC20 for token operations
- Maximum limits for sub-delegators and durations
- Early withdrawal protections with configurable loss parameters
The contracts have been tested on the Optimism Sepolia testnet and are ready for deployment on the Ethereum mainnet depending on the audit results.
- Fake 1inch Token (1INCH) - 0xd44390c5f4e3558be11bbdeb9c3193b6f4dff8c4
- HermesProxyFactory - 0x6f60e583e17721ecdfdab5f4251726774af6fa10
Transactions
LGPL-3.0-only
Anoy Roy Chowdhury - [email protected]