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

Commit

Permalink
Merge branch 'master' into no-oracle
Browse files Browse the repository at this point in the history
  • Loading branch information
prestwich authored Nov 12, 2019
2 parents 5f8dd7b + 513cb2a commit 55951fc
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 49 deletions.
44 changes: 22 additions & 22 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -298,25 +298,25 @@ workflows:
context: keep-dev
requires:
- setup_github_package_registry
# - build_initcontainer:
# filters:
# branches:
# only: master
# context: keep-dev
# requires:
# - migrate_contracts
# - publish_images:
# filters:
# branches:
# only: master
# context: keep-dev
# requires:
# - migrate_contracts
# - build_initcontainer
# - publish_contract_data:
# filters:
# branches:
# only: master
# context: keep-dev
# requires:
# - migrate_contracts
- build_initcontainer:
filters:
branches:
only: master
context: keep-dev
requires:
- migrate_contracts
- publish_images:
filters:
branches:
only: master
context: keep-dev
requires:
- migrate_contracts
- build_initcontainer
- publish_contract_data:
filters:
branches:
only: master
context: keep-dev
requires:
- migrate_contracts
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
2 changes: 1 addition & 1 deletion implementation/scripts/circleci-migrate-contracts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ssh utilitybox << EOF
cd /tmp/$BUILD_TAG/implementation
# TODO: Migrations fail with truffle version specified in package.json file. That's why we install dependencies manually here, bug: https://github.com/keep-network/tbtc/issues/231
npm install @keep-network/[email protected].1
npm install @keep-network/[email protected].2
npm install @summa-tx/[email protected]
npm install [email protected]
npm install [email protected]
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 55951fc

Please sign in to comment.