BasicSpell
The BasicSpell contract is an abstract contract that provides a set of functions to be implemented by its inheriting contracts. This contract is designed to facilitate borrowing, lending, and collateral management functionalities for other contracts in the BlueBerry Protocol
Variables
bank
Type:
IBank
Description: The bank contract that provides borrowing, lending, and collateral management functionalities
werc20
Type:
IWERC20
Description: The wrapped ERC20 contract that is used as collateral for borrowing and lending operations
weth
Type:
address
Description: The address of the WETH contract
Functions
__BasicSpell_init
Initializes the contract by setting the parameters
Parameters
_addStrategy
Adds a strategy to the specific spell
Parameters
setMaxPosSize
Parameters
setCollateralsMaxLTVs
Allows the owner to set the maxLTV values of a specific collateral type for the given strategy
Parameters
_validateMaxLTV
An internal function to ensure that the ltv of a strategy is within the maximum value bounds.
strategyId
(uint256) - The given ID to be checked and validated
_validateMaxPosSize
An internal function to ensure that the max Position Size of a strategy is within the maximum value bounds.
strategyId
(uint256) - The given ID to be checked and validated
_doRefund
Refunds any remaining balance of the specified token to the current bank executor.
Parameters
token
(address): The address of the token to refund
_doCutRewardsFee
Cuts the rewards from the current bank executor to the protocols treasury.
Parameters
token
(address): The address of the token to cut
_doRefundRewards
Cut rewards fee and refund the rewards tokens from spell to the current bank executor
Parameters
token
(address): The address of the token to refund
_doLend
Lends the specified amount of the token to the bank on behalf of the current executor
Parameters
_doWithdraw
Withdraws the specified amount of the token from the bank on behalf of the current executor
Parameters
_doBorrow
Borrows the specified amount of the token from the bank on behalf of the current executor
Parameters
Returns
borrowedAmount
: The number of tokens actually borrowed
_doRepay
Repays the specified amount of the token to the bank on behalf of the current executor
Parameters
_doPutCollateral
This function puts collateral tokens inside the bank
Parameters
_doTakeCollateral
This function takes collateral tokens out of the bank by burning the equivalent amount of wrapped ERC20 tokens (wERC20) using the burn
function of the wERC20 token contract.
Parameters
increasePosition
This function allows for the user to increase their isolated collateral to support their position
Parameters
reducePosition
This function allows for the user to reduce their isolated collateral in a given position
Parameters
receive
This is a fallback function that is used to receive Ether only from the Wrapped Ether (WETH) contract. If the function receives Ether from an address other than the WETH contract, it reverts with an error.
Last updated