mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
updated all the functions other adjust
This commit is contained in:
parent
0a2735cad2
commit
6211c526d8
|
@ -38,6 +38,7 @@ contract Events {
|
||||||
uint lqtyGain,
|
uint lqtyGain,
|
||||||
address frontendTag,
|
address frontendTag,
|
||||||
uint getDepositId,
|
uint getDepositId,
|
||||||
|
uint setDepositId,
|
||||||
uint setEthGainId,
|
uint setEthGainId,
|
||||||
uint setLqtyGainId
|
uint setLqtyGainId
|
||||||
);
|
);
|
||||||
|
@ -45,6 +46,7 @@ contract Events {
|
||||||
uint amount,
|
uint amount,
|
||||||
uint ethGain,
|
uint ethGain,
|
||||||
uint lqtyGain,
|
uint lqtyGain,
|
||||||
|
uint getWithdrawId,
|
||||||
uint setWithdrawId,
|
uint setWithdrawId,
|
||||||
uint setEthGainId,
|
uint setEthGainId,
|
||||||
uint setLqtyGainId
|
uint setLqtyGainId
|
||||||
|
@ -52,7 +54,7 @@ contract Events {
|
||||||
event LogStabilityMoveEthGainToTrove(address indexed borrower, uint amount);
|
event LogStabilityMoveEthGainToTrove(address indexed borrower, uint amount);
|
||||||
|
|
||||||
/* Staking */
|
/* Staking */
|
||||||
event LogStake(address indexed borrower, uint amount, uint getStakeId, uint setEthGainId, uint setLusdGainId);
|
event LogStake(address indexed borrower, uint amount, uint setStakeId, uint getStakeId, uint setEthGainId, uint setLusdGainId);
|
||||||
event LogUnstake(address indexed borrower, uint amount, uint setUnstakeId, uint setEthGainId, uint setLusdGainId);
|
event LogUnstake(address indexed borrower, uint amount, uint getUnstakeId, uint setUnstakeId, uint setEthGainId, uint setLusdGainId);
|
||||||
event LogClaimStakingGains(address indexed borrower, uint ethGain, uint lusdGain, uint setEthGainId, uint setLusdGainId);
|
event LogClaimStakingGains(address indexed borrower, uint ethGain, uint lusdGain, uint setEthGainId, uint setLusdGainId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ interface StabilityPoolLike {
|
||||||
function withdrawETHGainToTrove(address _upperHint, address _lowerHint) external;
|
function withdrawETHGainToTrove(address _upperHint, address _lowerHint) external;
|
||||||
function getDepositorETHGain(address _depositor) external view returns (uint);
|
function getDepositorETHGain(address _depositor) external view returns (uint);
|
||||||
function getDepositorLQTYGain(address _depositor) external view returns (uint);
|
function getDepositorLQTYGain(address _depositor) external view returns (uint);
|
||||||
|
function getCompoundedLUSDDeposit(address _depositor) external view returns (uint);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface StakingLike {
|
interface StakingLike {
|
||||||
|
@ -61,6 +62,7 @@ interface StakingLike {
|
||||||
function unstake(uint _LQTYamount) external;
|
function unstake(uint _LQTYamount) external;
|
||||||
function getPendingETHGain(address _user) external view returns (uint);
|
function getPendingETHGain(address _user) external view returns (uint);
|
||||||
function getPendingLUSDGain(address _user) external view returns (uint);
|
function getPendingLUSDGain(address _user) external view returns (uint);
|
||||||
|
function stakes(address owner) external view returns (uint);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface CollateralSurplusLike {
|
interface CollateralSurplusLike {
|
||||||
|
|
|
@ -282,11 +282,14 @@ abstract contract LiquityResolver is Events, Helpers {
|
||||||
uint amount,
|
uint amount,
|
||||||
address frontendTag,
|
address frontendTag,
|
||||||
uint getDepositId,
|
uint getDepositId,
|
||||||
|
uint setDepositId,
|
||||||
uint setEthGainId,
|
uint setEthGainId,
|
||||||
uint setLqtyGainId
|
uint setLqtyGainId
|
||||||
) external payable returns (string memory _eventName, bytes memory _eventParam) {
|
) external payable returns (string memory _eventName, bytes memory _eventParam) {
|
||||||
amount = getUint(getDepositId, amount);
|
amount = getUint(getDepositId, amount);
|
||||||
|
|
||||||
|
amount = amount == uint(-1) ? lusdToken.balanceOf(address(this)) : amount;
|
||||||
|
|
||||||
uint ethGain = stabilityPool.getDepositorETHGain(address(this));
|
uint ethGain = stabilityPool.getDepositorETHGain(address(this));
|
||||||
uint lqtyBalanceBefore = lqtyToken.balanceOf(address(this));
|
uint lqtyBalanceBefore = lqtyToken.balanceOf(address(this));
|
||||||
|
|
||||||
|
@ -295,11 +298,12 @@ abstract contract LiquityResolver is Events, Helpers {
|
||||||
uint lqtyBalanceAfter = lqtyToken.balanceOf(address(this));
|
uint lqtyBalanceAfter = lqtyToken.balanceOf(address(this));
|
||||||
uint lqtyGain = sub(lqtyBalanceAfter, lqtyBalanceBefore);
|
uint lqtyGain = sub(lqtyBalanceAfter, lqtyBalanceBefore);
|
||||||
|
|
||||||
|
setUint(setDepositId, amount);
|
||||||
setUint(setEthGainId, ethGain);
|
setUint(setEthGainId, ethGain);
|
||||||
setUint(setLqtyGainId, lqtyGain);
|
setUint(setLqtyGainId, lqtyGain);
|
||||||
|
|
||||||
_eventName = "LogStabilityDeposit(address,uint256,uint256,uint256,address,uint256,uint256,uint256)";
|
_eventName = "LogStabilityDeposit(address,uint256,uint256,uint256,address,uint256,uint256,uint256,uint256)";
|
||||||
_eventParam = abi.encode(address(this), amount, ethGain, lqtyGain, frontendTag, getDepositId, setEthGainId, setLqtyGainId);
|
_eventParam = abi.encode(address(this), amount, ethGain, lqtyGain, frontendTag, getDepositId, setDepositId, setEthGainId, setLqtyGainId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -312,10 +316,15 @@ abstract contract LiquityResolver is Events, Helpers {
|
||||||
*/
|
*/
|
||||||
function stabilityWithdraw(
|
function stabilityWithdraw(
|
||||||
uint amount,
|
uint amount,
|
||||||
|
uint getWithdrawId,
|
||||||
uint setWithdrawId,
|
uint setWithdrawId,
|
||||||
uint setEthGainId,
|
uint setEthGainId,
|
||||||
uint setLqtyGainId
|
uint setLqtyGainId
|
||||||
) external returns (string memory _eventName, bytes memory _eventParam) {
|
) external returns (string memory _eventName, bytes memory _eventParam) {
|
||||||
|
amount = getUint(getWithdrawId, amount);
|
||||||
|
|
||||||
|
amount = amount == uint(-1) ? StabilityPoolLike.getCompoundedLUSDDeposit(address(this)) : amount;
|
||||||
|
|
||||||
uint ethGain = stabilityPool.getDepositorETHGain(address(this));
|
uint ethGain = stabilityPool.getDepositorETHGain(address(this));
|
||||||
uint lqtyBalanceBefore = lqtyToken.balanceOf(address(this));
|
uint lqtyBalanceBefore = lqtyToken.balanceOf(address(this));
|
||||||
|
|
||||||
|
@ -328,8 +337,8 @@ abstract contract LiquityResolver is Events, Helpers {
|
||||||
setUint(setEthGainId, ethGain);
|
setUint(setEthGainId, ethGain);
|
||||||
setUint(setLqtyGainId, lqtyGain);
|
setUint(setLqtyGainId, lqtyGain);
|
||||||
|
|
||||||
_eventName = "LogStabilityWithdraw(address,uint256,uint256,uint256,uint256,uint256,uint256)";
|
_eventName = "LogStabilityWithdraw(address,uint256,uint256,uint256,uint256,uint256,uint256,uint256)";
|
||||||
_eventParam = abi.encode(address(this), amount, ethGain, lqtyGain, setWithdrawId, setEthGainId, setLqtyGainId);
|
_eventParam = abi.encode(address(this), amount, ethGain, lqtyGain, getWithdrawId, setWithdrawId, setEthGainId, setLqtyGainId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -362,19 +371,23 @@ abstract contract LiquityResolver is Events, Helpers {
|
||||||
function stake(
|
function stake(
|
||||||
uint amount,
|
uint amount,
|
||||||
uint getStakeId,
|
uint getStakeId,
|
||||||
|
uint setStakeId,
|
||||||
uint setEthGainId,
|
uint setEthGainId,
|
||||||
uint setLusdGainId
|
uint setLusdGainId
|
||||||
) external returns (string memory _eventName, bytes memory _eventParam) {
|
) external returns (string memory _eventName, bytes memory _eventParam) {
|
||||||
|
amount = getUint(getStakeId, amount);
|
||||||
|
amount = amount == uint(-1) ? lqtyToken.balanceOf(address(this)) : amount;
|
||||||
|
|
||||||
uint ethGain = staking.getPendingETHGain(address(this));
|
uint ethGain = staking.getPendingETHGain(address(this));
|
||||||
uint lusdGain = staking.getPendingLUSDGain(address(this));
|
uint lusdGain = staking.getPendingLUSDGain(address(this));
|
||||||
|
|
||||||
amount = getUint(getStakeId, amount);
|
|
||||||
staking.stake(amount);
|
staking.stake(amount);
|
||||||
|
setUint(setStakeId, amount);
|
||||||
setUint(setEthGainId, ethGain);
|
setUint(setEthGainId, ethGain);
|
||||||
setUint(setLusdGainId, lusdGain);
|
setUint(setLusdGainId, lusdGain);
|
||||||
|
|
||||||
_eventName = "LogStake(address,uint256,uint256,uint256,uint256)";
|
_eventName = "LogStake(address,uint256,uint256,uint256,uint256,uint256)";
|
||||||
_eventParam = abi.encode(address(this), amount, getStakeId, setEthGainId, setLusdGainId);
|
_eventParam = abi.encode(address(this), amount, getStakeId, setStakeId, setEthGainId, setLusdGainId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -387,20 +400,24 @@ abstract contract LiquityResolver is Events, Helpers {
|
||||||
*/
|
*/
|
||||||
function unstake(
|
function unstake(
|
||||||
uint amount,
|
uint amount,
|
||||||
uint setStakeId,
|
uint getUnstakeId,
|
||||||
|
uint setUnstakeId,
|
||||||
uint setEthGainId,
|
uint setEthGainId,
|
||||||
uint setLusdGainId
|
uint setLusdGainId
|
||||||
) external returns (string memory _eventName, bytes memory _eventParam) {
|
) external returns (string memory _eventName, bytes memory _eventParam) {
|
||||||
|
amount = getUint(getUnstakeId, amount);
|
||||||
|
amount = amount == uint(-1) ? staking.stakes(address(this)) : amount;
|
||||||
|
|
||||||
uint ethGain = staking.getPendingETHGain(address(this));
|
uint ethGain = staking.getPendingETHGain(address(this));
|
||||||
uint lusdGain = staking.getPendingLUSDGain(address(this));
|
uint lusdGain = staking.getPendingLUSDGain(address(this));
|
||||||
|
|
||||||
staking.unstake(amount);
|
staking.unstake(amount);
|
||||||
setUint(setStakeId, amount);
|
setUint(setUnstakeId, amount);
|
||||||
setUint(setEthGainId, ethGain);
|
setUint(setEthGainId, ethGain);
|
||||||
setUint(setLusdGainId, lusdGain);
|
setUint(setLusdGainId, lusdGain);
|
||||||
|
|
||||||
_eventName = "LogUnstake(address,uint256,uint256,uint256,uint256)";
|
_eventName = "LogUnstake(address,uint256,uint256,uint256,uint256,uint256)";
|
||||||
_eventParam = abi.encode(address(this), amount, setStakeId, setEthGainId, setLusdGainId);
|
_eventParam = abi.encode(address(this), amount, getUnstakeId, setUnstakeId, setEthGainId, setLusdGainId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user