Blockchain Engineering: EigenLayer, ERC4626 and magic of auto-compounding
This is quick notes I put in the blogpost so someone could find it useful. I don’t have time for a good structured blogpost, I used this as a public note to document challenges and solutions I implemented.
I spent this weekend participating on hackhathon and playing with EigenLayer. We built ERC4626 that abstract staking into EigenLayer Operators and do auto-compounding.
Overall EigenLayer looks so raw and limited as something that could be used for investments and retaking. 3things that I discovered and that wasn’t obvious
- Rewards are not supported yet, so you stake but don’t get rewards, so autocompounding doesn’t work yet at our side as well.
- One address can stake only to one Operator, so you can’t diversify you portfolio. We bypassed this by creating a new smart contract that manage one Operator.
Testnet operators
I also have difficulties with listing Testnet operators.
I need to find the list of available operators with metadata on Holesky, Is the only way to do that to explore AvsDirectoryStorage.sol
Operators are stored in AvsDirectory in the mapping
/// @notice Mapping: AVS => operator => enum of operator status to the AVS
mapping(address => mapping(address => OperatorAVSRegistrationStatus)) public avsOperatorStatus;
But I you can’t iterate over it, it is EVM mapping. But there is an event
emit OperatorAVSRegistrationStatusUpdated(operator, msg.sender, OperatorAVSRegistrationStatus.REGISTERED);
You can see all the events smart-contract emitted on etherscan, but it didn’t display `OperatorAVSRegistrationStatusUpdate` for me.
Then I figured out that these events are emitted on the `AVSDirectory` Proxy contract.
Also, you can use web3.js to get events from RPC
const events = await contract.getPastEvents("OperatorAVSRegistrationStatusUpdated", {
fromBlock: 19492759,
toBlock: "latest",
})
At the end, I learned a lot of stuff and challenges smart-contract developers have. Developing smart contracts requires different approaches for solving problems. And when you understand how EVM and blockchains works, it makes troubleshooting a lot easier. Like when you understand how you computer works and you write software for it.