Skip to content

Commit 04a4e1c

Browse files
committed
natspec
1 parent d19348c commit 04a4e1c

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

packages/ethereum-contracts/contracts/interfaces/superfluid/IYieldBackend.sol

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,40 @@ pragma solidity ^0.8.23;
99
* one -> another could be seen as a composition of one -> no -> another
1010
*
1111
* one -> no means withdraw not in the context of a downgrade.
12+
*
13+
* Contracts implementing this act as a kind of hot-pluggable library,
14+
* using delegatecall to execute its logic on the SuperToken contract.
15+
* This means that underlying tokens are transferred directly between the SuperToken contract and the yield protocol,
16+
* as are yield protocol tokens representing positions in that protocol.
17+
* If an implementation requires to hold state, it shall do so using a namespaced storage layout (EIP-7201).
1218
*/
1319
interface IYieldBackend {
14-
/// Invoked by `SuperToken.enableYieldBackend()` as delegatecall.
20+
/// Invoked by `SuperToken` as delegatecall.
1521
/// Sets up the SuperToken as needed, e.g. by giving required approvals.
1622
function enable() external;
1723

18-
/// Invoked by `SuperToken.disableYieldBackend()` as delegatecall.
24+
/// Invoked by `SuperToken` as delegatecall.
1925
/// Restores the prior state, e.g. by revoking given approvals
2026
function disable() external;
2127

28+
/// Invoked by `SuperToken` as delegatecall.
29+
/// Deposits the given amount of the underlying asset into the yield backend.
2230
function deposit(uint256 amount) external;
31+
/// Invoked by `SuperToken` as delegatecall.
32+
/// Deposits the maximum amount of the underlying asset into the yield backend.
33+
/// Maximum is defined by the underlying asset balance of the SuperToken and the yield backend capacity.
2334
function depositMax() external;
35+
36+
/// Invoked by `SuperToken` as delegatecall.
37+
/// Withdraws the given amount of the underlying asset from the yield backend.
2438
function withdraw(uint256 amount) external;
39+
40+
/// Invoked by `SuperToken` as delegatecall.
41+
/// Withdraws the maximum amount of the underlying asset from the yield backend.
42+
/// Maximum is defined by how much can be withdrawn from the yield backend at that point in time.
2543
function withdrawMax() external;
2644

27-
/// tranfers the deposited asset exceeding the required underlying to the preset treasury account
45+
/// Invoked by `SuperToken` as delegatecall.
46+
/// tranfers the deposited asset exceeding totalSupply of the SuperToken to the preset receiver account
2847
function withdrawSurplus(uint256 totalSupply) external;
2948
}

0 commit comments

Comments
 (0)