Skip to content

Commit

Permalink
Replace affirmationWithinLimits with withinExecutionLimit on BasicHom…
Browse files Browse the repository at this point in the history
…eBridge
  • Loading branch information
patitonar committed Jul 3, 2019
1 parent 90a7a80 commit e314ee3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 22 deletions.
7 changes: 3 additions & 4 deletions contracts/upgradeable_contracts/BasicHomeBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import "openzeppelin-solidity/contracts/math/SafeMath.sol";
import "openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol";
import "./Validatable.sol";
import "../libraries/Message.sol";
import "./BasicBridge.sol";


contract BasicHomeBridge is EternalStorage, Validatable {
contract BasicHomeBridge is EternalStorage, Validatable, BasicBridge {
using SafeMath for uint256;

event UserRequestForSignature(address recipient, uint256 value);
Expand All @@ -17,7 +18,7 @@ contract BasicHomeBridge is EternalStorage, Validatable {
event CollectedSignatures(address authorityResponsibleForRelay, bytes32 messageHash, uint256 NumberOfCollectedSignatures);

function executeAffirmation(address recipient, uint256 value, bytes32 transactionHash) external onlyValidator {
if (affirmationWithinLimits(value)) {
if (withinExecutionLimit(value)) {
bytes32 hashMsg = keccak256(abi.encodePacked(recipient, value, transactionHash));
bytes32 hashSender = keccak256(abi.encodePacked(msg.sender, hashMsg));
// Duplicated affirmations
Expand Down Expand Up @@ -147,7 +148,5 @@ contract BasicHomeBridge is EternalStorage, Validatable {
return Message.requiredMessageLength();
}

function affirmationWithinLimits(uint256) internal view returns(bool);

function onFailedAffirmation(address, uint256, bytes32) internal;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
pragma solidity 0.4.24;

import "../../libraries/Message.sol";
import "../BasicBridge.sol";
import "../../upgradeability/EternalStorage.sol";
import "../../interfaces/IBurnableMintableERC677Token.sol";
import "../../interfaces/ERC677Receiver.sol";
Expand All @@ -11,7 +10,7 @@ import "./RewardableHomeBridgeErcToErc.sol";
import "../ERC677BridgeForBurnableMintableToken.sol";


contract HomeBridgeErcToErc is ERC677Receiver, EternalStorage, BasicBridge, BasicHomeBridge, ERC677BridgeForBurnableMintableToken, OverdrawManagement, RewardableHomeBridgeErcToErc {
contract HomeBridgeErcToErc is ERC677Receiver, EternalStorage, BasicHomeBridge, ERC677BridgeForBurnableMintableToken, OverdrawManagement, RewardableHomeBridgeErcToErc {

event AmountLimitExceeded(address recipient, uint256 value, bytes32 transactionHash);

Expand Down Expand Up @@ -197,10 +196,6 @@ contract HomeBridgeErcToErc is ERC677Receiver, EternalStorage, BasicBridge, Basi
}
}

function affirmationWithinLimits(uint256 _amount) internal view returns(bool) {
return withinExecutionLimit(_amount);
}

function onFailedAffirmation(address _recipient, uint256 _value, bytes32 _txHash) internal {
address recipient;
uint256 value;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
pragma solidity 0.4.24;

import "../../libraries/Message.sol";
import "../BasicBridge.sol";
import "../../upgradeability/EternalStorage.sol";
import "../../interfaces/IBlockReward.sol";
import "../BasicHomeBridge.sol";
Expand All @@ -10,7 +9,7 @@ import "../OverdrawManagement.sol";
import "./RewardableHomeBridgeErcToNative.sol";


contract HomeBridgeErcToNative is EternalStorage, BasicBridge, BasicHomeBridge, OverdrawManagement, RewardableHomeBridgeErcToNative {
contract HomeBridgeErcToNative is EternalStorage, BasicHomeBridge, OverdrawManagement, RewardableHomeBridgeErcToNative {

event AmountLimitExceeded(address recipient, uint256 value, bytes32 transactionHash);

Expand Down Expand Up @@ -200,10 +199,6 @@ contract HomeBridgeErcToNative is EternalStorage, BasicBridge, BasicHomeBridge,
uintStorage[keccak256(abi.encodePacked("totalBurntCoins"))] = _amount;
}

function affirmationWithinLimits(uint256 _amount) internal view returns(bool) {
return withinExecutionLimit(_amount);
}

function onFailedAffirmation(address _recipient, uint256 _value, bytes32 _txHash) internal {
address recipient;
uint256 value;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
pragma solidity 0.4.24;

import "../../libraries/Message.sol";
import "../BasicBridge.sol";
import "../../upgradeability/EternalStorage.sol";
import "../BasicHomeBridge.sol";
import "./RewardableHomeBridgeNativeToErc.sol";
import "../Sacrifice.sol";


contract HomeBridgeNativeToErc is EternalStorage, BasicBridge, BasicHomeBridge, RewardableHomeBridgeNativeToErc {
contract HomeBridgeNativeToErc is EternalStorage, BasicHomeBridge, RewardableHomeBridgeNativeToErc {

function () public payable {
nativeTransfer();
Expand Down Expand Up @@ -156,10 +155,6 @@ contract HomeBridgeNativeToErc is EternalStorage, BasicBridge, BasicHomeBridge,
return true;
}

function affirmationWithinLimits(uint256 _amount) internal view returns(bool) {
return withinExecutionLimit(_amount);
}

function onFailedAffirmation(address _recipient, uint256 _value, bytes32 _txHash) internal {
revert();
}
Expand Down

0 comments on commit e314ee3

Please sign in to comment.