VaultT1Migrator

Git Source

Inherits: Owned

State Variables

X32

uint256 internal constant X32 = 0xffffffff;

ETH_ADDRESS

address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

VAULT_T1_FACTORY_OLD

IFluidVaultFactory public immutable VAULT_T1_FACTORY_OLD;

VAULT_T1_FACTORY_NEW

IFluidVaultFactory public immutable VAULT_T1_FACTORY_NEW;

FLA

InstaFlashInterface public immutable FLA;

WETH

IWETH9 public immutable WETH;

flashloanConfig

mapping(address => FlashloanConfig) public flashloanConfig;

Functions

constructor

constructor(address owner_, address fla_, address weth_, address oldFactory_, address newFactory_) Owned(owner_);

setFlashloanConfig

function setFlashloanConfig(address token_, uint256 route_, uint256 amount_) public onlyOwner;

spell

function spell(address[] memory targets_, bytes[] memory calldatas_) public onlyOwner;

withdraw

function withdraw(address to_, address[] memory tokens_, uint256[] memory amounts_) public onlyOwner;

onERC721Received

function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data)
    external
    returns (bytes4);

executeOperation

function executeOperation(
    address[] calldata assets,
    uint256[] calldata amounts,
    uint256[] calldata premiums,
    address initiator,
    bytes calldata _data
) external returns (bool);

vaultByNftId

function vaultByNftId(uint256 nftId_) public view returns (uint256 vaultId_, address vault_);

vaultConfig

function vaultConfig(address vault_) public view returns (address supply_, address borrow_);

calculateStorageSlotUintMapping

function calculateStorageSlotUintMapping(uint256 slot_, uint256 key_) public pure returns (bytes32);

getVaultAddress

function getVaultAddress(address vaultFactory_, uint256 vaultId_) public pure returns (address vault_);

receive

receive() external payable;

Events

Migrated

event Migrated(uint256 indexed vaultId, address indexed owner, uint256 indexed nft, uint256 collateral, uint256 debt);

Withdraw

event Withdraw(address indexed to, address indexed token, uint256 amount);

SetFlashloanConfig

event SetFlashloanConfig(address indexed token, uint256 indexed route, uint256 amount);

Errors

FluidVaultT1Migrator__InvalidOperation

error FluidVaultT1Migrator__InvalidOperation();

FluidVaultT1Migrator__NotAllowed

error FluidVaultT1Migrator__NotAllowed();

Structs

FlashloanConfig

struct FlashloanConfig {
    uint256 amount;
    uint256 route;
}

MigratorParams

struct MigratorParams {
    uint256 nftId;
    address owner;
    address supply;
    address borrow;
    uint256 vaultId;
    address vaultFrom;
    address vaultTo;
    uint256 supplyAmount;
    uint256 borrowAmount;
    int256 withdrawAmount;
    int256 paybackAmount;
    uint256 route;
}