mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
removed errors
This commit is contained in:
parent
824f64d537
commit
3b87e1717d
|
@ -5,14 +5,19 @@ import {TokenInterface} from "../../common/interfaces.sol";
|
||||||
import {Helpers} from "./helpers.sol";
|
import {Helpers} from "./helpers.sol";
|
||||||
import {Events} from "./events.sol";
|
import {Events} from "./events.sol";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title Universe finance
|
||||||
|
* @dev Maximising uniswap v3 returns
|
||||||
|
*/
|
||||||
abstract contract UniverseFinanceConnect is Helpers, Events {
|
abstract contract UniverseFinanceConnect is Helpers, Events {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice Deposit in Universe Vault by Adapter
|
* @notice Deposit in Universe Vault by Adapter
|
||||||
|
* @dev Deposit in universe vault
|
||||||
* @param universeVault Universe Official Vault Address
|
* @param universeVault Universe Official Vault Address
|
||||||
* @param amountA Amount of tokenA
|
* @param amountA Amount of tokenA
|
||||||
* @param amountB Amount of tokenB
|
* @param amountB Amount of tokenB
|
||||||
* @param getIds ID to retrieve amountA and amountB
|
* @param getIds ID to retrieve amountA and amountB
|
||||||
|
* @param setIds ID to store amountA and amountB
|
||||||
*/
|
*/
|
||||||
function deposit(
|
function deposit(
|
||||||
address universeVault,
|
address universeVault,
|
||||||
|
@ -20,23 +25,39 @@ abstract contract UniverseFinanceConnect is Helpers, Events {
|
||||||
uint256 amountB,
|
uint256 amountB,
|
||||||
uint256[] calldata getIds,
|
uint256[] calldata getIds,
|
||||||
uint256[] calldata setIds
|
uint256[] calldata setIds
|
||||||
) external returns (string memory _eventName, bytes memory _eventParam){
|
)
|
||||||
|
external
|
||||||
|
payable
|
||||||
|
returns (string memory _eventName, bytes memory _eventParam)
|
||||||
|
{
|
||||||
amountA = getUint(getIds[0], amountA);
|
amountA = getUint(getIds[0], amountA);
|
||||||
amountB = getUint(getIds[1], amountB);
|
amountB = getUint(getIds[1], amountB);
|
||||||
_approve(universeVault, amountA, amountB);
|
_approve(universeVault, amountA, amountB);
|
||||||
(uint256 share0, uint256 share1) = _deposit(universeVault, amountA, amountB);
|
(uint256 share0, uint256 share1) = _deposit(
|
||||||
|
universeVault,
|
||||||
|
amountA,
|
||||||
|
amountB
|
||||||
|
);
|
||||||
setUint(setIds[0], share0);
|
setUint(setIds[0], share0);
|
||||||
setUint(setIds[1], share1);
|
setUint(setIds[1], share1);
|
||||||
// EVENT
|
// EVENT
|
||||||
_eventName = "LogDeposit(address,uint256,uint256,uint256,uint256)";
|
_eventName = "LogDeposit(address,uint256,uint256,uint256,uint256)";
|
||||||
_eventParam = abi.encode(universeVault, amountA, amountB, share0, share1);
|
_eventParam = abi.encode(
|
||||||
|
universeVault,
|
||||||
|
amountA,
|
||||||
|
amountB,
|
||||||
|
share0,
|
||||||
|
share1
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice Withdraw Token0 & Token1 From Universe Vault
|
* @notice Withdraw Token0 & Token1 From Universe Vault
|
||||||
|
* @dev Withdraw supplied token0 and token1 from universe vault
|
||||||
* @param universeVault Universe Official Vault Address
|
* @param universeVault Universe Official Vault Address
|
||||||
* @param share0 Amount of uToken0.
|
* @param share0 Amount of uToken0.
|
||||||
* @param share1 Amount of uToken1.
|
* @param share1 Amount of uToken1.
|
||||||
|
* @param getIds ID to retrieve amount of output token
|
||||||
* @param setIds stores the amount of output tokens
|
* @param setIds stores the amount of output tokens
|
||||||
*/
|
*/
|
||||||
function withdraw(
|
function withdraw(
|
||||||
|
@ -45,17 +66,24 @@ abstract contract UniverseFinanceConnect is Helpers, Events {
|
||||||
uint256 share1,
|
uint256 share1,
|
||||||
uint256[] calldata getIds,
|
uint256[] calldata getIds,
|
||||||
uint256[] calldata setIds
|
uint256[] calldata setIds
|
||||||
) external returns (string memory _eventName, bytes memory _eventParam){
|
)
|
||||||
|
external
|
||||||
|
payable
|
||||||
|
returns (string memory _eventName, bytes memory _eventParam)
|
||||||
|
{
|
||||||
share0 = getUint(getIds[0], share0);
|
share0 = getUint(getIds[0], share0);
|
||||||
share1 = getUint(getIds[1], share1);
|
share1 = getUint(getIds[1], share1);
|
||||||
(uint256 _amtA, uint256 _amtB) = _withdraw(universeVault, share0, share1);
|
(uint256 _amtA, uint256 _amtB) = _withdraw(
|
||||||
|
universeVault,
|
||||||
|
share0,
|
||||||
|
share1
|
||||||
|
);
|
||||||
setUint(setIds[0], _amtA);
|
setUint(setIds[0], _amtA);
|
||||||
setUint(setIds[1], _amtB);
|
setUint(setIds[1], _amtB);
|
||||||
// EVENT
|
// EVENT
|
||||||
_eventName = "LogWithdraw(address,uint256,uint256,uint256,uint256)";
|
_eventName = "LogWithdraw(address,uint256,uint256,uint256,uint256)";
|
||||||
_eventParam = abi.encode(universeVault, _amtA, _amtB, share0, share1);
|
_eventParam = abi.encode(universeVault, _amtA, _amtB, share0, share1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
contract ConnectV2UniverseFinance is UniverseFinanceConnect {
|
contract ConnectV2UniverseFinance is UniverseFinanceConnect {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user