mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
Fix bugs after testing
This commit is contained in:
parent
b67be72a13
commit
b368121409
|
@ -10,8 +10,8 @@ contract Events {
|
|||
event LogPayback(uint256 indexed safe, bytes32 indexed collateralType, uint256 tokenAmt, uint256 getId, uint256 setId);
|
||||
event LogWithdrawLiquidated(uint256 indexed safe, bytes32 indexed collateralType, uint256 tokenAmt, uint256 getId, uint256 setId);
|
||||
event LogExit(uint256 indexed safe, bytes32 indexed collateralType, uint256 tokenAmt, uint256 getId, uint256 setId);
|
||||
event LogDeposit(uint256 tokenAmt, uint256 getId, uint256 setId);
|
||||
event LogWithdraw(uint256 tokenAmt, uint256 getId, uint256 setId);
|
||||
event LogDepositCoin(uint256 tokenAmt, uint256 getId, uint256 setId);
|
||||
event LogWithdrawCoin(uint256 tokenAmt, uint256 getId, uint256 setId);
|
||||
|
||||
event LogDepositAndBorrow(
|
||||
uint256 indexed safe,
|
||||
|
|
|
@ -70,7 +70,7 @@ abstract contract Helpers is DSMath, Basic {
|
|||
) internal view returns (uint wad) {
|
||||
(, uint rate,,,) = SafeEngineLike(safeEngine).collateralTypes(collateralType);
|
||||
(, uint debt) = SafeEngineLike(safeEngine).safes(collateralType, handler);
|
||||
uint coin = SafeEngineLike(safeEngine).coin(handler);
|
||||
uint coin = SafeEngineLike(safeEngine).coinBalance(handler);
|
||||
|
||||
uint rad = sub(mul(debt, rate), coin);
|
||||
wad = rad / RAY;
|
||||
|
@ -89,7 +89,7 @@ abstract contract Helpers is DSMath, Basic {
|
|||
) internal returns (int deltaDebt)
|
||||
{
|
||||
uint rate = taxCollectorContract.taxSingle(collateralType);
|
||||
uint coin = SafeEngineLike(safeEngine).coin(handler);
|
||||
uint coin = SafeEngineLike(safeEngine).coinBalance(handler);
|
||||
if (coin < mul(amt, RAY)) {
|
||||
deltaDebt = toInt(sub(mul(amt, RAY), coin) / rate);
|
||||
deltaDebt = mul(uint(deltaDebt), rate) < mul(amt, RAY) ? deltaDebt + 1 : deltaDebt;
|
||||
|
|
|
@ -20,7 +20,7 @@ interface ManagerLike {
|
|||
interface SafeEngineLike {
|
||||
function safeRights(address, address) external view returns (uint);
|
||||
function collateralTypes(bytes32) external view returns (uint, uint, uint, uint, uint);
|
||||
function coin(address) external view returns (uint);
|
||||
function coinBalance(address) external view returns (uint);
|
||||
function safes(bytes32, address) external view returns (uint, uint);
|
||||
function modifySAFECollateralization(
|
||||
bytes32,
|
||||
|
@ -45,7 +45,7 @@ interface TokenJoinInterface {
|
|||
|
||||
interface CoinJoinInterface {
|
||||
function safeEngine() external returns (SafeEngineLike);
|
||||
function coin() external returns (TokenInterface);
|
||||
function systemCoin() external returns (TokenInterface);
|
||||
function join(address, uint) external payable;
|
||||
function exit(address, uint) external;
|
||||
}
|
||||
|
|
|
@ -211,7 +211,7 @@ abstract contract GebResolver is Helpers, Events {
|
|||
|
||||
require(_maxDebt >= _amt, "paying-excess-debt");
|
||||
|
||||
coinJoinContract.coin().approve(address(coinJoinContract), _amt);
|
||||
coinJoinContract.systemCoin().approve(address(coinJoinContract), _amt);
|
||||
coinJoinContract.join(handler, _amt);
|
||||
|
||||
managerContract.modifySAFECollateralization(
|
||||
|
@ -219,7 +219,7 @@ abstract contract GebResolver is Helpers, Events {
|
|||
0,
|
||||
_getWipeAmt(
|
||||
safeEngine,
|
||||
SafeEngineLike(safeEngine).coin(handler),
|
||||
SafeEngineLike(safeEngine).coinBalance(handler),
|
||||
handler,
|
||||
collateralType
|
||||
)
|
||||
|
@ -382,7 +382,7 @@ abstract contract GebResolver is Helpers, Events {
|
|||
|
||||
SafeEngineLike safeEngineContract = SafeEngineLike(managerContract.safeEngine());
|
||||
if(_amt == uint(-1)) {
|
||||
_amt = safeEngineContract.coin(handler);
|
||||
_amt = safeEngineContract.coinBalance(handler);
|
||||
_amt = _amt / 10 ** 27;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user