Documentation is below the Getting Started section
- SLOC: 378 Lines (
yarn sloc
) - In Scope:
src/EdgelessDeposit.sol
src/StakingManager.sol
src/WrappedToken.sol
src/Constants.sol
src/strategies/*
- Out of Scope:
src/interfaces/*
- just interfacessrc/upgrade-tests/*
- just testing files- Centralization concerns
- Copied files
src/interfaces/*
: IWithdrawalQueueERC721
- Coverage: Over 90% on in scope files https://app.warp.dev/block/ijNP6MzDaIxBrWuhZgYFgb
npm i --force
forge test
The yield generating contracts on Ethereum for Edgeless Network.
Overview: The high level vision of Edgeless is to lower or remove the transaction fees that dApps currently charge and monetize via bridged TVL. Blast and Manta are focused on creating generalizable L2s where the native token is yield bearing and passed through to the initial user. While this is a step in the right direction the ultimate vision should be to remove transaction fees altogether, which is what we are setting out to do. Like Roblox and Epic, Edgeless is able to pool together the revenue that is generated across the ecosystem and redistribute it to app developers based on the value they bring to the ecosystem.
Use Cases: There are many use cases where charging no transaction fee naturally makes sense, social gaming is one of the most exciting, and is one of the key focuses for Edgeless to begin with (think games that Zynga would make: poker, blackjack, slot machines, and Gacha games). For the first time ever you could offer EV neutral or even EV positive games using the infrastructure that Edgeless offers. Game creators do not need to have a house rake or fee on every spin / turn since they can monetize off of the yield (ETH / stables). Other gaming related use cases include daily fantasy sports, season long survivor brackets and PvP games. Second to gaming, there are several DeFi and consumer applications that we believe would be great apps for our ecosystem including perps exchanges and NFT marketplaces.
- The contracts are organized into four distinct groups of contracts. Additionally, there is an integration with a standard bridge designed for Layer 1 (L1).
- Edgeless Deposit Contract: This contract is UUPS Upgradeable by the owner.
- Edgeless Wrapped Ether: An ERC20 representing ETH balance on the L2 with minting exposed to a minter (Edgeless Deposit Contract).
- Lido Contract: This contract is focused on managing the staking of Ethereum, a key component of the marketplace's asset management strategy.
- Eth: Involves minting Wrapped Ether, optional auto-staking through Lido, and bridging the Wrapped Ether to the Edgeless Layer 2
- Lido (Eth): This flow allows the designated staker to request Lido to withdraw a specific balance of Eth, followed by claiming rewards after the withdrawal is finalized.
- Staker Responsibilities: The staker is responsible for setting the AutoStake value, staking Dai and Eth in the bridge, and managing withdrawals from Lido.
- AutoStake Feature: This functionality allows for the automatic staking of deposits to respective platforms.
- Owner's Role in Setting Staker: The owner of the contract has the authority to designate the staker.
- Owner Responsibilities: The owner is tasked with authorizing upgrades to the contract, setting the Layer 1 Bridge, designating the staker, pausing direct bridge deposits, and minting new Wrapped tokens in line with yield or staking rewards.
The following invariants should always be maintained within the contract:
- The balance of Wrapped Eth should always be less than or equal to the total Steth balance combined with the Eth balance.
- If autostaking is not enabled, only the designated staker has the authority to stake Eth and Dai.
- Toggling the AutoStake feature can only be done by the staker.
- Setting the staker, L1Bridge, bridgePause, authorizing upgrades, and minting tokens can only be performed by the owner of the contract.
- If the bridge is paused, users are unable to bridge to L1.
- The mint and burn functions can only be called by the Edgeless Deposit contract.
This is a list of the most frequently needed commands.
Delete the build artifacts and cache directories:
$ forge clean
Compile the contracts:
$ forge build
Get a test coverage report:
$ forge coverage
Format the contracts:
$ forge fmt
Get a gas report:
$ forge test --gas-report
Lint the contracts:
$ npm run lint
Run the tests:
$ forge test
Generate test coverage and output result to the terminal:
$ npm run test:coverage
Generate test coverage with lcov report (you'll have to open the ./coverage/index.html
file in your browser, to do so
simply copy paste the path):
$ npm run test:coverage:report