core staking contracts
WrappedSDToken Contract: Wrapped Liquid Staking Tokens
WrappedSDToken wraps rebasing liquid staking tokens (such as stLINK) with a normal ERC20 token.
ERC20 Functions
Section titled “ERC20 Functions”All standard ERC20 functions are implemented for WrappedSDToken
View Functions
Section titled “View Functions”sdToken
Section titled “sdToken”Returns the underlying staking receipt token that this contract wraps
function sdToken() external view returns (address)Return Values
Section titled “Return Values”| Name | Type | Description |
|---|---|---|
| sdToken | address | Address of staking receipt token |
getWrappedByUnderlying
Section titled “getWrappedByUnderlying”Returns the amount of wrapped tokens that corresponds an amount of unwrapped tokens
function getWrappedByUnderlying(uint256 _amount) external view returns (uint256)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| _amount | uint256 | Amount of unwrapped tokens |
Return Values
Section titled “Return Values”| Name | Type | Description |
|---|---|---|
| wrappedAmount | uint256 | Amount of corresponding wrapped tokens |
getUnderlyingByWrapped
Section titled “getUnderlyingByWrapped”Returns the amount of unwrapped tokens that corresponds to an amount of wrapped tokens
function getUnderlyingByWrapped(uint256 _amount) external view returns (uint256)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| _amount | uint256 | Amount of wrapped tokens |
Return Values
Section titled “Return Values”| Name | Type | Description |
|---|---|---|
| unwrappedAmount | uint256 | Corresponding amount of unwrapped tokens |
Write Functions
Section titled “Write Functions”onTokenTransfer
Section titled “onTokenTransfer”ERC677 implementation that proxies wrapping
function onTokenTransfer(address _sender, uint256 _value, bytes) externalParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| _sender | address | Sender of the token transfer |
| _value | uint256 | Value of the token transfer |
| bytes |
Wraps tokens
function wrap(uint256 _amount) externalParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| _amount | uint256 | Amount of unwrapped tokens to wrap |
unwrap
Section titled “unwrap”Unwraps tokens
function unwrap(uint256 _amount) externalParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| _amount | uint256 | Amount of wrapped tokens to unwrap |
transferAndCall
Section titled “transferAndCall”Transfers tokens to an address and calls onTokenTransfer with additional data if the recipient is a contract
function transferAndCall(address _to, uint256 _value, bytes _data) external returns (bool)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| _to | address | Address to send the tokens to |
| _value | uint256 | Value of token transfer |
| _data | bytes | Calldata included in the transfer |