Skip to content

Commit

Permalink
Merge branch 'develop' into arbitrary-message-bridging-#73
Browse files Browse the repository at this point in the history
# Conflicts:
#	contracts/upgradeable_contracts/BasicBridge.sol
  • Loading branch information
patitonar committed Jul 17, 2019
2 parents 14c7846 + e8217f1 commit 3f2aec5
Show file tree
Hide file tree
Showing 30 changed files with 64 additions and 64 deletions.
4 changes: 2 additions & 2 deletions contracts/ERC677BridgeToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ contract ERC677BridgeToken is
uint8 _decimals)
public DetailedERC20(_name, _symbol, _decimals) {}

function setBridgeContract(address _bridgeContract) onlyOwner public {
function setBridgeContract(address _bridgeContract) onlyOwner external {
require(isContract(_bridgeContract));
bridgeContract = _bridgeContract;
}
Expand All @@ -45,7 +45,7 @@ contract ERC677BridgeToken is
return true;
}

function getTokenInterfacesVersion() public pure returns(uint64 major, uint64 minor, uint64 patch) {
function getTokenInterfacesVersion() external pure returns(uint64 major, uint64 minor, uint64 patch) {
return (2, 1, 0);
}

Expand Down
4 changes: 2 additions & 2 deletions contracts/ERC677BridgeTokenRewardable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ contract ERC677BridgeTokenRewardable is ERC677BridgeToken {
uint8 _decimals
) public ERC677BridgeToken(_name, _symbol, _decimals) {}

function setBlockRewardContract(address _blockRewardContract) onlyOwner public {
function setBlockRewardContract(address _blockRewardContract) onlyOwner external {
require(isContract(_blockRewardContract));
blockRewardContract = _blockRewardContract;
}

function setStakingContract(address _stakingContract) onlyOwner public {
function setStakingContract(address _stakingContract) onlyOwner external {
require(isContract(_stakingContract));
stakingContract = _stakingContract;
}
Expand Down
6 changes: 3 additions & 3 deletions contracts/interfaces/IBlockReward.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ pragma solidity 0.4.24;

interface IBlockReward {
function addExtraReceiver(uint256 _amount, address _receiver) external;
function mintedTotally() public view returns (uint256);
function mintedTotallyByBridge(address _bridge) public view returns(uint256);
function mintedTotally() external view returns (uint256);
function mintedTotallyByBridge(address _bridge) external view returns(uint256);
function bridgesAllowedLength() external view returns(uint256);
function addBridgeTokenFeeReceivers(uint256 _amount) external;
function addBridgeNativeFeeReceivers(uint256 _amount) external;
function blockRewardContractId() public pure returns(bytes4);
function blockRewardContractId() external pure returns(bytes4);
}
6 changes: 3 additions & 3 deletions contracts/interfaces/IBridgeValidators.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pragma solidity 0.4.24;


interface IBridgeValidators {
function isValidator(address _validator) public view returns(bool);
function requiredSignatures() public view returns(uint256);
function owner() public view returns(address);
function isValidator(address _validator) external view returns(bool);
function requiredSignatures() external view returns(uint256);
function owner() external view returns(address);
}
14 changes: 7 additions & 7 deletions contracts/interfaces/IRewardableValidators.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ pragma solidity 0.4.24;


interface IRewardableValidators {
function isValidator(address _validator) public view returns(bool);
function requiredSignatures() public view returns(uint256);
function owner() public view returns(address);
function validatorList() public view returns (address[]);
function getValidatorRewardAddress(address _validator) public view returns(address);
function validatorCount() public view returns (uint256);
function getNextValidator(address _address) public view returns (address);
function isValidator(address _validator) external view returns(bool);
function requiredSignatures() external view returns(uint256);
function owner() external view returns(address);
function validatorList() external view returns (address[]);
function getValidatorRewardAddress(address _validator) external view returns(address);
function validatorCount() external view returns (uint256);
function getNextValidator(address _address) external view returns (address);
}
2 changes: 1 addition & 1 deletion contracts/interfaces/IUpgradeabilityOwnerStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ pragma solidity 0.4.24;


interface IUpgradeabilityOwnerStorage {
function upgradeabilityOwner() public view returns (address);
function upgradeabilityOwner() external view returns (address);
}
4 changes: 2 additions & 2 deletions contracts/upgradeability/OwnedUpgradeabilityProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ contract OwnedUpgradeabilityProxy is UpgradeabilityOwnerStorage, UpgradeabilityP
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferProxyOwnership(address newOwner) public onlyUpgradeabilityOwner {
function transferProxyOwnership(address newOwner) external onlyUpgradeabilityOwner {
require(newOwner != address(0));
emit ProxyOwnershipTransferred(upgradeabilityOwner(), newOwner);
setUpgradeabilityOwner(newOwner);
Expand All @@ -58,7 +58,7 @@ contract OwnedUpgradeabilityProxy is UpgradeabilityOwnerStorage, UpgradeabilityP
* @param data represents the msg.data to bet sent in the low level call. This parameter may include the function
* signature of the implementation to be called with the needed payload
*/
function upgradeToAndCall(uint256 version, address implementation, bytes data) payable public onlyUpgradeabilityOwner {
function upgradeToAndCall(uint256 version, address implementation, bytes data) payable external onlyUpgradeabilityOwner {
upgradeTo(version, implementation);
require(address(this).call.value(msg.value)(data));
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/upgradeability/UpgradeabilityStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ contract UpgradeabilityStorage {
* @dev Tells the version name of the current implementation
* @return string representing the name of the current version
*/
function version() public view returns (uint256) {
function version() external view returns (uint256) {
return _version;
}

Expand Down
6 changes: 3 additions & 3 deletions contracts/upgradeable_contracts/BaseBridgeValidators.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ contract BaseBridgeValidators is EternalStorage, Ownable {
}

function getBridgeValidatorsInterfacesVersion()
public
external
pure
returns (uint64 major, uint64 minor, uint64 patch)
{
return (2, 2, 0);
}

function validatorList() public view returns (address[]) {
function validatorList() external view returns (address[]) {
address [] memory list = new address[](validatorCount());
uint256 counter = 0;
address nextValidator = getNextValidator(F_ADDR);
Expand Down Expand Up @@ -97,7 +97,7 @@ contract BaseBridgeValidators is EternalStorage, Ownable {
return boolStorage[keccak256(abi.encodePacked("isInitialized"))];
}

function deployedAtBlock() public view returns (uint256) {
function deployedAtBlock() external view returns (uint256) {
return uintStorage[keccak256(abi.encodePacked("deployedAtBlock"))];
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/upgradeable_contracts/BaseFeeManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ contract BaseFeeManager is EternalStorage, FeeTypes {

function distributeFeeFromSignatures(uint256 _fee) external;

function getFeeManagerMode() public pure returns(bytes4);
function getFeeManagerMode() external pure returns(bytes4);

function random(uint256 _count) public view returns(uint256) {
return uint256(blockhash(block.number.sub(1))) % _count;
Expand Down
12 changes: 6 additions & 6 deletions contracts/upgradeable_contracts/BasicBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,31 @@ contract BasicBridge is EternalStorage, Validatable, Ownable, Upgradeable, Claim
event GasPriceChanged(uint256 gasPrice);
event RequiredBlockConfirmationChanged(uint256 requiredBlockConfirmations);

function getBridgeInterfacesVersion() public pure returns(uint64 major, uint64 minor, uint64 patch) {
function getBridgeInterfacesVersion() external pure returns(uint64 major, uint64 minor, uint64 patch) {
return (2, 2, 0);
}

function setGasPrice(uint256 _gasPrice) public onlyOwner {
function setGasPrice(uint256 _gasPrice) external onlyOwner {
require(_gasPrice > 0);
uintStorage[keccak256(abi.encodePacked("gasPrice"))] = _gasPrice;
emit GasPriceChanged(_gasPrice);
}

function gasPrice() public view returns(uint256) {
function gasPrice() external view returns(uint256) {
return uintStorage[keccak256(abi.encodePacked("gasPrice"))];
}

function setRequiredBlockConfirmations(uint256 _blockConfirmations) public onlyOwner {
function setRequiredBlockConfirmations(uint256 _blockConfirmations) external onlyOwner {
require(_blockConfirmations > 0);
uintStorage[keccak256(abi.encodePacked("requiredBlockConfirmations"))] = _blockConfirmations;
emit RequiredBlockConfirmationChanged(_blockConfirmations);
}

function requiredBlockConfirmations() public view returns(uint256) {
function requiredBlockConfirmations() external view returns(uint256) {
return uintStorage[keccak256(abi.encodePacked("requiredBlockConfirmations"))];
}

function deployedAtBlock() public view returns(uint256) {
function deployedAtBlock() external view returns(uint256) {
return uintStorage[keccak256(abi.encodePacked("deployedAtBlock"))];
}

Expand Down
4 changes: 2 additions & 2 deletions contracts/upgradeable_contracts/BasicHomeBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ contract BasicHomeBridge is EternalStorage, Validatable, BasicTokenBridge {
return boolStorage[keccak256(abi.encodePacked("affirmationsSigned", _withdrawal))];
}

function signature(bytes32 _hash, uint256 _index) public view returns (bytes) {
function signature(bytes32 _hash, uint256 _index) external view returns (bytes) {
bytes32 signIdx = keccak256(abi.encodePacked(_hash, _index));
return bytesStorage[keccak256(abi.encodePacked("signatures", signIdx))];
}
Expand All @@ -124,7 +124,7 @@ contract BasicHomeBridge is EternalStorage, Validatable, BasicTokenBridge {
bytesStorage[keccak256(abi.encodePacked("messages", _hash))] = _message;
}

function message(bytes32 _hash) public view returns (bytes) {
function message(bytes32 _hash) external view returns (bytes) {
return bytesStorage[keccak256(abi.encodePacked("messages", _hash))];
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/upgradeable_contracts/BridgeValidators.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ contract BridgeValidators is BaseBridgeValidators {
address[] _initialValidators,
address _owner
)
public
external
returns (bool)
{
require(!isInitialized());
Expand Down
2 changes: 1 addition & 1 deletion contracts/upgradeable_contracts/Ownable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ contract Ownable is EternalStorage {
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner the address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
function transferOwnership(address newOwner) external onlyOwner {
require(newOwner != address(0));
setOwner(newOwner);
}
Expand Down
4 changes: 2 additions & 2 deletions contracts/upgradeable_contracts/RewardableBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ contract RewardableBridge is Ownable, FeeTypes {
return fee;
}

function getFeeManagerMode() public view returns(bytes4) {
function getFeeManagerMode() external view returns(bytes4) {
bytes4 mode;
bytes memory callData = abi.encodeWithSignature("getFeeManagerMode()");
address feeManager = feeManagerContract();
Expand All @@ -43,7 +43,7 @@ contract RewardableBridge is Ownable, FeeTypes {
return addressStorage[keccak256(abi.encodePacked("feeManagerContract"))];
}

function setFeeManagerContract(address _feeManager) public onlyOwner {
function setFeeManagerContract(address _feeManager) external onlyOwner {
require(_feeManager == address(0) || isContract(_feeManager));
addressStorage[keccak256(abi.encodePacked("feeManagerContract"))] = _feeManager;
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/upgradeable_contracts/RewardableValidators.sol
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ contract RewardableValidators is BaseBridgeValidators {
emit ValidatorRemoved(_validator);
}

function getValidatorRewardAddress(address _validator) public view returns (address) {
function getValidatorRewardAddress(address _validator) external view returns (address) {
return addressStorage[keccak256(abi.encodePacked("validatorsRewards", _validator))];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ contract BasicForeignBridgeErcToErc is BasicForeignBridge {
setInitialize();
}

function getBridgeMode() public pure returns(bytes4 _data) {
function getBridgeMode() external pure returns(bytes4 _data) {
return bytes4(keccak256(abi.encodePacked("erc-to-erc-core")));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import "../BlockRewardFeeManager.sol";

contract FeeManagerErcToErcPOSDAO is BlockRewardFeeManager {

function getFeeManagerMode() public pure returns(bytes4) {
function getFeeManagerMode() external pure returns(bytes4) {
return bytes4(keccak256(abi.encodePacked("manages-both-directions")));
}

function blockRewardContract() public view returns(address) {
function blockRewardContract() external view returns(address) {
return _blockRewardContract();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ contract ForeignBridgeErc677ToErc677 is ERC677Bridge, BasicForeignBridgeErcToErc
uint256 _homeDailyLimit,
uint256 _homeMaxPerTx,
address _owner
) public returns(bool) {
) external returns(bool) {
require(_minPerTx > 0 && _maxPerTx > _minPerTx && _dailyLimit > _maxPerTx);

_initialize(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ contract ForeignBridgeErcToErc is BasicForeignBridgeErcToErc {
uint256 _homeDailyLimit,
uint256 _homeMaxPerTx,
address _owner
) public returns(bool) {
) external returns(bool) {
_initialize(
_validatorContract,
_erc20token,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ contract HomeBridgeErcToErc is ERC677Receiver, EternalStorage, BasicHomeBridge,
uint256 _foreignDailyLimit,
uint256 _foreignMaxPerTx,
address _owner
) public
) external
returns(bool)
{
_initialize (
Expand Down Expand Up @@ -59,7 +59,7 @@ contract HomeBridgeErcToErc is ERC677Receiver, EternalStorage, BasicHomeBridge,
address _feeManager,
uint256 _homeFee,
uint256 _foreignFee
) public
) external
returns(bool)
{
_rewardableInitialize (
Expand Down Expand Up @@ -152,7 +152,7 @@ contract HomeBridgeErcToErc is ERC677Receiver, EternalStorage, BasicHomeBridge,
IBurnableMintableERC677Token(erc677token()).claimTokens(_token, _to);
}

function getBridgeMode() public pure returns(bytes4 _data) {
function getBridgeMode() external pure returns(bytes4 _data) {
return bytes4(keccak256(abi.encodePacked("erc-to-erc-core")));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ contract HomeBridgeErcToErcPOSDAO is HomeBridgeErcToErc {
uint256 _homeFee,
uint256 _foreignFee,
address _blockReward
) public
) external
returns(bool)
{
_rewardableInitialize (
Expand Down Expand Up @@ -59,7 +59,7 @@ contract HomeBridgeErcToErcPOSDAO is HomeBridgeErcToErc {
return blockReward;
}

function setBlockRewardContract(address _blockReward) public onlyOwner {
function setBlockRewardContract(address _blockReward) external onlyOwner {
address feeManager = feeManagerContract();
_setBlockRewardContract(feeManager, _blockReward);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import "../ValidatorsFeeManager.sol";

contract FeeManagerErcToNative is ValidatorsFeeManager {

function getFeeManagerMode() public pure returns(bytes4) {
function getFeeManagerMode() external pure returns(bytes4) {
return bytes4(keccak256(abi.encodePacked("manages-both-directions")));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "../BlockRewardFeeManager.sol";

contract FeeManagerErcToNativePOSDAO is BlockRewardFeeManager {

function getFeeManagerMode() public pure returns(bytes4) {
function getFeeManagerMode() external pure returns(bytes4) {
return bytes4(keccak256(abi.encodePacked("manages-both-directions")));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ contract ForeignBridgeErcToNative is BasicForeignBridge {
uint256 _homeDailyLimit,
uint256 _homeMaxPerTx,
address _owner
) public returns(bool) {
) external returns(bool) {
require(!isInitialized());
require(isContract(_validatorContract));
require(_requiredBlockConfirmations != 0);
Expand All @@ -38,7 +38,7 @@ contract ForeignBridgeErcToNative is BasicForeignBridge {
return isInitialized();
}

function getBridgeMode() public pure returns(bytes4 _data) {
function getBridgeMode() external pure returns(bytes4 _data) {
return bytes4(keccak256(abi.encodePacked("erc-to-native-core")));
}

Expand Down
Loading

0 comments on commit 3f2aec5

Please sign in to comment.