mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
update
This commit is contained in:
parent
fa6886e033
commit
e56ca991e7
|
@ -24,32 +24,35 @@ contract Helpers is DSMath, Basic {
|
|||
function _deposit(Metadata memory data, uint256 _amount) internal {
|
||||
if (data.version == 2)
|
||||
masterChefV2.deposit(data.poolId, _amount, address(this));
|
||||
else
|
||||
masterChef.deposit(data.poolId, _amount);
|
||||
else masterChef.deposit(data.poolId, _amount);
|
||||
}
|
||||
|
||||
function _withdraw(Metadata memory data, uint256 _amount) internal {
|
||||
if (data.version == 2)
|
||||
masterChefV2.withdraw(data.poolId, _amount, address(this));
|
||||
else
|
||||
masterChef.withdraw(data.poolId, _amount);
|
||||
else masterChef.withdraw(data.poolId, _amount);
|
||||
}
|
||||
|
||||
function _harvest(Metadata memory data) internal {
|
||||
masterChefV2.harvest(data.poolId, address(this));
|
||||
}
|
||||
|
||||
function _withdrawAndHarvest(Metadata memory data, uint256 _amount) internal {
|
||||
function _withdrawAndHarvest(Metadata memory data, uint256 _amount)
|
||||
internal
|
||||
{
|
||||
if (data.version == 2)
|
||||
masterChefV2.withdrawAndHarvest(data.poolId, _amount, address(this));
|
||||
masterChefV2.withdrawAndHarvest(
|
||||
data.poolId,
|
||||
_amount,
|
||||
address(this)
|
||||
);
|
||||
else _withdraw(data, _amount);
|
||||
}
|
||||
|
||||
function _emergencyWithdraw(Metadata memory data) internal {
|
||||
if (data.version == 2)
|
||||
masterChefV2.emergencyWithdraw(data.poolId, address(this));
|
||||
else
|
||||
masterChef.emergencyWithdraw(data.poolId, address(this));
|
||||
else masterChef.emergencyWithdraw(data.poolId, address(this));
|
||||
}
|
||||
|
||||
function _getPoolId(address tokenA, address tokenB)
|
||||
|
@ -87,8 +90,14 @@ contract Helpers is DSMath, Basic {
|
|||
returns (uint256 lpAmount, uint256 rewardsAmount)
|
||||
{
|
||||
if (data.version == 2)
|
||||
(lpAmount, rewardsAmount) = masterChefV2.userInfo(data.poolId, address(this));
|
||||
(lpAmount, rewardsAmount) = masterChefV2.userInfo(
|
||||
data.poolId,
|
||||
address(this)
|
||||
);
|
||||
else
|
||||
(lpAmount, rewardsAmount) = masterChef.userInfo(data.poolId, address(this));
|
||||
(lpAmount, rewardsAmount) = masterChef.userInfo(
|
||||
data.poolId,
|
||||
address(this)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,12 +18,19 @@ interface IERC20 {
|
|||
|
||||
function balanceOf(address account) external view returns (uint256);
|
||||
|
||||
function allowance(address owner, address spender) external view returns (uint256);
|
||||
function allowance(address owner, address spender)
|
||||
external
|
||||
view
|
||||
returns (uint256);
|
||||
|
||||
function approve(address spender, uint256 amount) external returns (bool);
|
||||
|
||||
event Transfer(address indexed from, address indexed to, uint256 value);
|
||||
event Approval(address indexed owner, address indexed spender, uint256 value);
|
||||
event Approval(
|
||||
address indexed owner,
|
||||
address indexed spender,
|
||||
uint256 value
|
||||
);
|
||||
|
||||
/// @notice EIP 2612
|
||||
function permit(
|
||||
|
@ -42,22 +49,24 @@ interface IMasterChef {
|
|||
|
||||
function updatePool(uint256 pid) external returns (PoolInfo memory);
|
||||
|
||||
function poolInfo(uint256 pid) external view returns (address, uint256, uint256, uint256);
|
||||
function poolInfo(uint256 pid)
|
||||
external
|
||||
view
|
||||
returns (
|
||||
address,
|
||||
uint256,
|
||||
uint256,
|
||||
uint256
|
||||
);
|
||||
|
||||
function userInfo(uint256 _pid, address _user)
|
||||
external
|
||||
view
|
||||
returns (uint256, uint256);
|
||||
|
||||
function deposit(
|
||||
uint256 pid,
|
||||
uint256 amount
|
||||
) external;
|
||||
function deposit(uint256 pid, uint256 amount) external;
|
||||
|
||||
function withdraw(
|
||||
uint256 pid,
|
||||
uint256 amount
|
||||
) external;
|
||||
function withdraw(uint256 pid, uint256 amount) external;
|
||||
|
||||
function emergencyWithdraw(uint256 pid, address to) external;
|
||||
}
|
||||
|
|
|
@ -202,7 +202,7 @@ abstract contract SushipswapIncentiveResolver is Helpers, Events {
|
|||
require(data.poolId != uint256(-1), "pool-does-not-exist");
|
||||
(uint256 lpAmount, uint256 rewardsAmount) = _getUserInfo(data);
|
||||
_emergencyWithdraw(data);
|
||||
_eventName = "LogEmergencyWithdraw(address,addressuint256,uint256,uint256,uint256)";
|
||||
_eventName = "LogEmergencyWithdraw(address,address,uint256,uint256,uint256,uint256)";
|
||||
_eventParam = abi.encode(
|
||||
token1,
|
||||
token2,
|
||||
|
|
Loading…
Reference in New Issue
Block a user