Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #331 from keep-network/update-distribution-interfaces
Browse files Browse the repository at this point in the history
Updated references to keep-ecdsa contracts implementing distribution functions.
  • Loading branch information
nkuba committed Nov 6, 2019
2 parents acb17b0 + 4f45e9b commit b72a0e4
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 26 deletions.
5 changes: 2 additions & 3 deletions implementation/contracts/deposit/DepositRedemption.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {BytesLib} from "@summa-tx/bitcoin-spv-sol/contracts/BytesLib.sol";
import {ValidateSPV} from "@summa-tx/bitcoin-spv-sol/contracts/ValidateSPV.sol";
import {CheckBitcoinSigs} from "@summa-tx/bitcoin-spv-sol/contracts/CheckBitcoinSigs.sol";
import {DepositUtils} from "./DepositUtils.sol";
import {IBondedECDSAKeep} from "../external/IBondedECDSAKeep.sol";
import {IECDSAKeep} from "@keep-network/keep-ecdsa/contracts/api/IECDSAKeep.sol";
import {DepositStates} from "./DepositStates.sol";
import {OutsourceDepositLogging} from "./OutsourceDepositLogging.sol";
Expand Down Expand Up @@ -34,10 +33,10 @@ library DepositRedemption {
address _tbtcTokenAddress = _d.TBTCToken;
TBTCToken _tbtcToken = TBTCToken(_tbtcTokenAddress);

IBondedECDSAKeep _keep = IBondedECDSAKeep(_d.keepAddress);
IECDSAKeep _keep = IECDSAKeep(_d.keepAddress);

_tbtcToken.approve(_d.keepAddress, DepositUtils.signerFee());
_keep.distributeERC20ToKeepGroup(_d.keepAddress, _tbtcTokenAddress, DepositUtils.signerFee());
_keep.distributeERC20ToMembers(_tbtcTokenAddress, DepositUtils.signerFee());
}

/// @notice Approves digest for signing by a keep
Expand Down
6 changes: 4 additions & 2 deletions implementation/contracts/deposit/DepositUtils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {BytesLib} from "@summa-tx/bitcoin-spv-sol/contracts/BytesLib.sol";
import {TBTCConstants} from "./TBTCConstants.sol";
import {ITBTCSystem} from "../interfaces/ITBTCSystem.sol";
import {IERC721} from "openzeppelin-solidity/contracts/token/ERC721/IERC721.sol";
import {IECDSAKeep} from "@keep-network/keep-ecdsa/contracts/api/IECDSAKeep.sol";
import {IBondedECDSAKeep} from "../external/IBondedECDSAKeep.sol";
import {TBTCToken} from "../system/TBTCToken.sol";

Expand Down Expand Up @@ -379,7 +380,8 @@ library DepositUtils {
/// @return true if successful, otherwise revert
function pushFundsToKeepGroup(Deposit storage _d, uint256 _ethValue) public returns (bool) {
require(address(this).balance >= _ethValue, "Not enough funds to send");
IBondedECDSAKeep _keep = IBondedECDSAKeep(_d.keepAddress);
return _keep.distributeEthToKeepGroup.value(_ethValue)(_d.keepAddress);
IECDSAKeep _keep = IECDSAKeep(_d.keepAddress);
_keep.distributeETHToMembers.value(_ethValue)();
return true;
}
}
9 changes: 0 additions & 9 deletions implementation/contracts/external/IBondedECDSAKeep.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@ interface IBondedECDSAKeep {
bytes calldata _preimage
) external returns (bool _isFraud);

// Allow sending funds to a keep group
// Expected: increment their existing ETH bond
function distributeEthToKeepGroup(address _keepAddress) external payable returns (bool);

// Allow sending tokens to a keep group
// Useful for sending signers their TBTC
// The Keep contract should call transferFrom on the token contract
function distributeERC20ToKeepGroup(address _keepAddress, address _asset, uint256 _value) external returns (bool);

// returns the amount of the keep's ETH bond in wei
function checkBondAmount(address _keepAddress) external view returns (uint256);

Expand Down
6 changes: 3 additions & 3 deletions implementation/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion implementation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"author": "James Prestwich",
"license": "UNLICENSED",
"dependencies": {
"@keep-network/keep-ecdsa": "^0.1.1",
"@keep-network/keep-ecdsa": "^0.1.2",
"bn-chai": "^1.0.1",
"bn.js": "^4.11.8",
"@summa-tx/bitcoin-spv-sol": "^2.1.0",
Expand Down
17 changes: 9 additions & 8 deletions implementation/test/contracts/keep/ECDSAKeepStub.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ contract ECDSAKeepStub is IECDSAKeep, IBondedECDSAKeep {
emit SignatureRequested(_digest);
}

function distributeETHToMembers() external payable {

}

function distributeERC20ToMembers(address _asset, uint256 _value) external {

}


// Functions implemented for IBondedECDSAKeep interface.

function submitSignatureFraud(
Expand All @@ -59,14 +68,6 @@ contract ECDSAKeepStub is IECDSAKeep, IBondedECDSAKeep {
return success;
}

function distributeEthToKeepGroup(address _keepAddress) external payable returns (bool){
return success;
}

function distributeERC20ToKeepGroup(address _keepAddress, address _asset, uint256 _value) external returns (bool){
return success;
}

function checkBondAmount(address _keepAddress) external view returns (uint256){
return bondAmount;
}
Expand Down

0 comments on commit b72a0e4

Please sign in to comment.