diff --git a/PLUGIN_SPECIFICATION.md b/PLUGIN_SPECIFICATION.md index ae5c8711..70bd44f5 100644 --- a/PLUGIN_SPECIFICATION.md +++ b/PLUGIN_SPECIFICATION.md @@ -1,19 +1,25 @@ # Technical Specification -> **Warning** -This documentation is a template and shall be updated. - ## About -This documentation describes the smart contracts and functions supported by the boilerplate plugin. +This documentation describes the smart contracts and functions supported by the Chorus plugin. ## Smart Contracts Smart contracts covered by the plugin shall be described here: -| Network | Version | Smart Contract | Address | -| ---- | --- | ---- | --- | -| NetworkName | VX | ContractName | `0x0000000000000000000000000000000000000000` | +| Network | Smart Contract | Address | +| ---- | ---- | --- | +| Ethereum | Stakewise | `0xe6d8d8aC54461b1C5eD15740EEe322043F696C08` | +| Ethereum | Eigenlayer | `0x39053D51B77DC0d36036Fc1fCc8Cb819df8Ef37A` | +| Ethereum | Symbiotic (wstETH) | `0xc329400492c6ff2438472d4651ad17389fcb843a` | +| Ethereum | Symbiotic (cbETH) | `0xb26ff591f44b04e78de18f43b46f8b70c6676984` | +| Ethereum | Symbiotic (wBETH) | `0x422f5accc812c396600010f224b320a743695f85` | +| Ethereum | Symbiotic (rETH) | `0x03bf48b8a1b37fbead1ecabcf15b98b924ffa5ac` | +| Ethereum | Symbiotic (mETH) | `0x475d3eb031d250070b63fa145f0fcfc5d97c304a` | +| Ethereum | Symbiotic (swETH) | `0x38b86004842d3fa4596f0b7a0b53de90745ab654` | +| Ethereum | Symbiotic (sfrxETH) | `0x5198cb44d7b2e993ebdda9cad3b9a0eaa32769d2` | +| Ethereum | Symbiotic (ETHx) | `0xbdea8e677f9f7c294a4556005c640ee505be6925` | ## Functions @@ -21,4 +27,63 @@ For the smart contracts implemented, the functions covered by the plugin shall b |Contract | Function | Selector | Displayed Parameters | | --- | --- | --- | --- | -|ContractName | FunctionName | `0x00000000`|
type ParameterName
| \ No newline at end of file +|Stakewise | burnOsToken | `0x066055e0`|
uint128 osTokenShares
uint256 timestamp
uint256 exitQueueIndex
| +|Stakewise | claimExitedAssets | `0x8697d2c2`|
address receiver
address referrer
| +|Stakewise | deposit | `0xf9609f08`|
type ParameterName
| +|Stakewise | enterExitQueue | `0x8ceab9aa`|
uint256 shares
address receiver
| +|Stakewise | mintOsToken | `0x201b9eb5`|
address receiver
uint256 osTokenShares
address referrer
| +|Stakewise | redeem | `0x7bde82f2`|
uint256 shares
address receiver
| +|Stakewise | redeemOsToken | `0x43e82a79`|
uint256 osTokenShares
address owner
address receiver
| +||||| +|Eigenlayer | delegateTo | `0xeea9064b`|
address operator
SignatureWithExpiry approverSignatureAndExpiry
bytes32 approverSalt
| +|Eigenlayer | increaseDelegatedShares | `0x28a573ae`|
address staker
address strategy
uint256 shares
| +|Eigenlayer | decreaseDelegatedShares | `0x132d4967`|
address staker
address strategy
uint256 shares
| +|Eigenlayer | completeQueuedWithdrawal | `0x60d7faed`|
Withdrawal withdrawal
IERC20[] tokens
uint256 middlewareTimesIndex
bool receiveAsTokens
| +|Eigenlayer | queueWithdrawals | `0x0dd8dd02`|
QueuedWithdrawalParams[] queuedWithdrawalParams
| +|Eigenlayer | undelegate | `0xda8be864`|
address staker
| +||||| +|Symbiotic | deposit | `0x47e7ef24`|
address recipient
uint256 amount
| +|Symbiotic | deposit | `0xc5758489`|
address recipient
uint256 amount
uint256 deadline
bytes32 v
bytes32 r
bytes32 s
| +|Symbiotic | issueDebt | `0x7715be0b`|
address recipient
uint256 amount
| +|Symbiotic | withdraw | `0xf3fef3a3`|
address recipient
uint256 amount
| + +## Structs + +```solidity +struct SignatureWithExpiry { + // the signature itself, formatted as a single bytes object + bytes signature; + // the expiration timestamp (UTC) of the signature + uint256 expiry; + } +``` + +```solidity +struct Withdrawal { + // The address that originated the Withdrawal + address staker; + // The address that the staker was delegated to at the time that the Withdrawal was created + address delegatedTo; + // The address that can complete the Withdrawal + will receive funds when completing the withdrawal + address withdrawer; + // Nonce used to guarantee that otherwise identical withdrawals have unique hashes + uint256 nonce; + // Block number when the Withdrawal was created + uint32 startBlock; + // Array of strategies that the Withdrawal contains + IStrategy[] strategies; + // Array containing the amount of shares in each Strategy in the `strategies` array + uint256[] shares; + } +``` + +```solidity +struct QueuedWithdrawalParams { + // Array of strategies that the QueuedWithdrawal contains + IStrategy[] strategies; + // Array containing the amount of shares in each Strategy in the `strategies` array + uint256[] shares; + // The address of the withdrawer + address withdrawer; + } +``` diff --git a/README.md b/README.md index 5fda776d..1ca52d1f 100644 --- a/README.md +++ b/README.md @@ -1,69 +1,20 @@ # Opus plugin for Stakewise vaults and Eigenlayer contracts -This repository contains code for the Opus plugin for stakewise and Eigenlayer -contracts. +This repository contains code for the Opus plugin for stakewise, Eigenlayer and +Symbiotic contracts. -## Implemented functions +## Smart Contracts and functions -### Stakewise +The implemented Smart Contracts and functions can be found in +[PLUGIN_SPECIFICATION.md](./PLUGIN_SPECIFICATION.md) -- burnOsToken(uint128 osTokenShares) -- claimExitedTokens(uint256 positionTicket, uint256 timestamp, uint256 exitQueueIndex) -- deposit(address receiver, address referrer) -- enterExitQueue(uint256 shares, address receiver) -- liquidateOsToken(uint256 osTokenShares, address owner, address receiver) -- mintOsToken(address receiver, uint256 osTokenShares, address referrer) -- redeem(uint256 shares, address receiver) -- redeemOsToken(uint256 osTokenShares, address owner, address receiver) - -### Eigenlayer - -- function delegateTo(address operator, IDelegationManager.SignatureWithExpiry memory approverSignatureAndExpiry, bytes32 approverSalt) -- function increaseDelegatedShares(address staker, address strategy, uint256 shares) -- function decreaseDelegatedShares(address staker, address strategy, uint256 shares) -- function completeQueuedWithdrawal(Withdrawal withdrawal, IERC20[] tokens, uint256 middlewareTimesIndex, bool receiveAsTokens) -- function queueWithdrawals(QueuedWithdrawalParams[] queuedWithdrawalParams) - -#### Structs - -```solidity -struct Withdrawal { - // The address that originated the Withdrawal - address staker; - // The address that the staker was delegated to at the time that the Withdrawal was created - address delegatedTo; - // The address that can complete the Withdrawal + will receive funds when completing the withdrawal - address withdrawer; - // Nonce used to guarantee that otherwise identical withdrawals have unique hashes - uint256 nonce; - // Block number when the Withdrawal was created - uint32 startBlock; - // Array of strategies that the Withdrawal contains - IStrategy[] strategies; - // Array containing the amount of shares in each Strategy in the `strategies` array - uint256[] shares; - } -``` - -```solidity -struct QueuedWithdrawalParams { - // Array of strategies that the QueuedWithdrawal contains - IStrategy[] strategies; - // Array containing the amount of shares in each Strategy in the `strategies` array - uint256[] shares; - // The address of the withdrawer - address withdrawer; - } -``` ## Testing -For testing, we use the [Zemu](https://github.com/Zondax/zemu) for simulating a Ledger device, -to run the tests make sure your node version is `>21.7` and run: +For testing, we use the [Ragger](https://github.com/LedgerHQ/ragger) for +simulating a Ledger device, to run the tests, use the Ledger plugin on VSCode or +run them with: ```bash -npm install -npm run test +pytest ./tests --device ``` - -These will run all tests matching `tests/src/<*.test.js>` \ No newline at end of file