mirror of
https://github.com/Instadapp/smart-contract.git
synced 2024-07-29 22:08:07 +00:00
bridge almost done
This commit is contained in:
parent
6886c863df
commit
17d0894bcc
|
@ -45,11 +45,17 @@ interface ComptrollerInterface {
|
|||
|
||||
interface CTokenInterface {
|
||||
function borrow(uint borrowAmount) external returns (uint);
|
||||
function exchangeRateCurrent() external returns (uint);
|
||||
|
||||
function transfer(address, uint) external returns (bool);
|
||||
function transferFrom(address, address, uint) external returns (bool);
|
||||
}
|
||||
|
||||
interface BridgeInterface {
|
||||
function makerToCompound(uint, uint, uint) external returns (uint);
|
||||
function compoundToMaker(uint, uint, uint) external;
|
||||
}
|
||||
|
||||
|
||||
|
||||
contract DSMath {
|
||||
|
@ -175,4 +181,26 @@ contract CompoundHelper is MakerHelper {
|
|||
cDaiContract.transfer(getBridgeAddress());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
contract InstaBridge is CompoundHelper {
|
||||
|
||||
function makerToCompound(uint cdpId, uint ethCol, uint daiDebt) public {
|
||||
give(cdpId, getBridgeAddress());
|
||||
BridgeInterface bridge = BridgeInterface(getBridgeAddress());
|
||||
uint daiAmt = bridge.makerToCompound(cdpId, ethCol, daiDebt);
|
||||
// setApproval(getDaiAddress(), daiAmt, getBridgeAddress());
|
||||
bridge.takeDebtBack(daiAmt);
|
||||
}
|
||||
|
||||
function compoundToMaker(uint cdpId, uint ethCol, uint daiDebt) public {
|
||||
if (cdpId != 0) {
|
||||
give(cdpId, getBridgeAddress());
|
||||
}
|
||||
BridgeInterface bridge = BridgeInterface(getBridgeAddress());
|
||||
// setApproval(getCEthAddress(), daiAmt, getBridgeAddress());
|
||||
uint daiAmt = bridge.compoundToMaker(cdpId, ethCol, daiDebt);
|
||||
}
|
||||
|
||||
}
|
|
@ -388,7 +388,7 @@ contract Bridge is CompoundResolver {
|
|||
give(cdpId, msg.sender);
|
||||
}
|
||||
|
||||
function compoundToMaker(uint cdpId, uint ethCol, uint daiDebt) public payable isUserWallet returns (uint daiAmt) {
|
||||
function compoundToMaker(uint cdpId, uint ethCol, uint daiDebt) public payable isUserWallet {
|
||||
payUsersDebt(daiDebt);
|
||||
takeCETH(ethCol);
|
||||
redeemUnderlying(cEth, ethCol);
|
||||
|
|
Loading…
Reference in New Issue
Block a user