Wrapped SMART Token
wrappedSmartToken
Inherits: UnbuttonToken, UUPSUpgradeable, OwnableUpgradeable, ReentrancyGuardUpgradeable, FlashloanSpecifics, BaseContract
State Variables
sellingToken
isWrappedX
timeout
SCALING_FACTOR
signers
This is the signers address of RP api's that generate encoded params for rebalance
currentDiscountRates
Functions
constructor
riskInitialize
initialize
_authorizeUpgrade
flashLoan
Allows user to take flashloans from the wrapper
This function is guarded by the nonReentrant
modifiers. we offer unwanted tokens (sellingToken) in exchange of underlying tokens
Parameters
receiver
address
The address of the receiver.
amount
uint256
The amount of underlying assets to flashloan.
encodedData
bytes
signature
bytes
params
bytes
The parameters for the flashloan. Used by the receiver contract(Aave's interface)
setTimeout
setDiscountRate
setSigners
getIsWrappedX
getTimeout
getDiscountRate
getSigners
calculateUserShare
refundUnwantedTokens
getConversionRate
verifyAndDecode
Verifies the provided signature and decodes the encoded data into ScheduledRebalance
struct.
It recovers the address from the Ethereum signed message hash and the provided signature
. If the recovered address doesn't match the signersAddress
, it reverts the transaction. If the signature is valid, it decodes the encodedData
into a ScheduledRebalance
struct and returns it.
Parameters
signature
bytes
The signature to be verified.
encodedData
bytes
The data to be decoded into a ScheduledRebalance
struct.
Returns
<none>
PriceFeed
data A ScheduledRebalance
struct containing the decoded data.
burn
Burns wrapper tokens from {msg.sender} and transfers the underlying tokens back.
Parameters
amount
uint256
The amount of wrapper tokens to burn.
Returns
<none>
uint256
The amount of underlying tokens withdrawn.
burnTo
Burns wrapper tokens from {msg.sender} and transfers the underlying tokens to the specified beneficiary.
Parameters
to
address
The beneficiary account.
amount
uint256
The amount of wrapper tokens to burn.
Returns
<none>
uint256
The amount of underlying tokens withdrawn.
burnAll
Burns all wrapper tokens from {msg.sender} and transfers the underlying tokens back.
Returns
<none>
uint256
The amount of underlying tokens withdrawn.
burnAllTo
Burns all wrapper tokens from {msg.sender} and transfers the underlying tokens back.
Parameters
to
address
The beneficiary account.
Returns
<none>
uint256
The amount of underlying tokens withdrawn.
withdraw
Burns wrapper tokens from {msg.sender} and transfers the underlying tokens back.
Parameters
uAmount
uint256
The amount of underlying tokens to withdraw.
Returns
<none>
uint256
The amount of wrapper tokens burnt.
withdrawTo
Burns wrapper tokens from {msg.sender} and transfers the underlying tokens back to the specified beneficiary.
Parameters
to
address
The beneficiary account.
uAmount
uint256
The amount of underlying tokens to withdraw.
Returns
<none>
uint256
The amount of wrapper tokens burnt.
withdrawAll
Burns all wrapper tokens from {msg.sender} and transfers the underlying tokens back.
Returns
<none>
uint256
The amount of wrapper tokens burnt.
withdrawAllTo
Burns all wrapper tokens from {msg.sender} and transfers the underlying tokens back.
Parameters
to
address
The beneficiary account.
Returns
<none>
uint256
The amount of wrapper tokens burnt.
Errors
WrappedSmartToken__Not_Implemented
WrappedSmartToken__PriceFeedOutdated
WrappedSmartToken__InvalidSigner
WrappedSmartToken__InvalidDiscount
Structs
PriceFeed
DiscountRates
Last updated