FluidBuyback ​
Inherits:ReentrancyGuard, Events, UUPSUpgradeable
Functions ​
constructor ​
solidity
constructor() ;initialize ​
initializes the contract with owner_ as owner and rebalancers_ as rebalancers and build the buyback DSA
solidity
function initialize(address owner_, address[] memory rebalancers_) public initializer validAddress(owner_);Parameters
| Name | Type | Description |
|---|---|---|
owner_ | address | the owner of the contract |
rebalancers_ | address[] | the rebalancers of the contract |
_authorizeUpgrade ​
UUPS Upgrade authorization - only owner can authorize upgrades
solidity
function _authorizeUpgrade(address) internal override onlyOwner;renounceOwnership ​
override renounce ownership as it could leave the contract in an unwanted state if called by mistake.
solidity
function renounceOwnership() public view override onlyOwner;swap ​
swaps sellAmount_ of tokenIn_ for tokenOut_
solidity
function swap(
address tokenIn_,
address tokenOut_,
uint256 sellAmount_,
uint256 minBuyAmount_,
string[] memory swapConnectors_,
bytes[] memory swapCalldatas_
) public onlyRebalancer nonReentrant returns (uint256 buyAmount_);Parameters
| Name | Type | Description |
|---|---|---|
tokenIn_ | address | the token to sell |
tokenOut_ | address | the token to buy |
sellAmount_ | uint256 | the amount of tokenIn_ to sell |
minBuyAmount_ | uint256 | the minimum amount of tokenOut_ to buy |
swapConnectors_ | string[] | the connectors to use for the swap |
swapCalldatas_ | bytes[] | the calldatas to use for the swap |
Returns
| Name | Type | Description |
|---|---|---|
buyAmount_ | uint256 | the amount of tokenOut_ bought |
collectFluidTokensToTreasury ​
collects amount_ of Fluid tokens to the treasury - only rebalancers can collect Fluid tokens
solidity
function collectFluidTokensToTreasury(uint256 amount_) public onlyRebalancer nonReentrant;Parameters
| Name | Type | Description |
|---|---|---|
amount_ | uint256 | the amount of Fluid tokens to collect |
collectTokensToTreasury ​
collects amount_ of token_ to the treasury - only owner can collect tokens
solidity
function collectTokensToTreasury(address token_, uint256 amount_) public onlyOwner nonReentrant;Parameters
| Name | Type | Description |
|---|---|---|
token_ | address | the token to collect |
amount_ | uint256 | the amount of token_ to collect |
updateRebalancer ​
updates the rebalancer status - only owner can update the rebalancer status
solidity
function updateRebalancer(address rebalancer_, bool isActive_) public onlyOwner nonReentrant;Parameters
| Name | Type | Description |
|---|---|---|
rebalancer_ | address | the rebalancer to update |
isActive_ | bool | the status of the rebalancer |
receive ​
solidity
receive() external payable;
