Skip to content

Commit

Permalink
fix lint, tests
Browse files Browse the repository at this point in the history
  • Loading branch information
0xbuidlman committed Nov 21, 2019
1 parent 2ed5033 commit 8fe691c
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 6 deletions.
15 changes: 9 additions & 6 deletions contracts/helpers/ValidatorsOperations.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ contract ValidatorsOperations is Initializable {
howManyValidatorsDecide = 1;
}

// PUBLIC METHODS
modifier existValidator(address wallet) {
require(isExistValidator(wallet), "Address is not Validator");
_;
}

// PUBLIC METHODS
/**
* @dev Allows validators to change their mind by cancelling votesMaskByOperation operations
Expand Down Expand Up @@ -84,7 +90,7 @@ contract ValidatorsOperations is Initializable {
* @param newValidators defines array of addresses of new validators
* @param newHowManyValidatorsDecide defines how many validators can decide
*/
function changeValidatorsWithHowMany(address[] memory newValidators, uint256 newHowManyValidatorsDecide) internal {
function changeValidatorsWithHowMany(address[] memory newValidators, uint256 newHowManyValidatorsDecide) public {
require(newValidators.length > 0, "changeValidatorsWithHowMany: validators array is empty");
require(newValidators.length < 256, "changeValidatorsWithHowMany: validators count is greater then 255");
require(newHowManyValidatorsDecide > 0, "changeValidatorsWithHowMany: newHowManyValidatorsDecide equal to 0");
Expand Down Expand Up @@ -122,11 +128,6 @@ contract ValidatorsOperations is Initializable {
return validatorsIndices[wallet] > 0;
}

modifier existValidator(address wallet) {
require(isExistValidator(wallet), "Address is not Validator");
_;
}

function validatorsCount() public view returns(uint) {
return validators.length;
}
Expand Down Expand Up @@ -299,4 +300,6 @@ contract ValidatorsOperations is Initializable {
delete allOperationsIndicies[operation];
delete operationsByValidatorIndex[operation];
}


}
69 changes: 69 additions & 0 deletions types/truffle-contracts/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,29 @@ export interface BridgeInstance extends Truffle.ContractInstance {
): Promise<number>;
};

changeValidatorsWithHowMany: {
(
newValidators: (string | BigNumber)[],
newHowManyValidatorsDecide: number | BigNumber | string,
txDetails?: Truffle.TransactionDetails
): Promise<Truffle.TransactionResponse>;
call(
newValidators: (string | BigNumber)[],
newHowManyValidatorsDecide: number | BigNumber | string,
txDetails?: Truffle.TransactionDetails
): Promise<void>;
sendTransaction(
newValidators: (string | BigNumber)[],
newHowManyValidatorsDecide: number | BigNumber | string,
txDetails?: Truffle.TransactionDetails
): Promise<string>;
estimateGas(
newValidators: (string | BigNumber)[],
newHowManyValidatorsDecide: number | BigNumber | string,
txDetails?: Truffle.TransactionDetails
): Promise<number>;
};

getGuestAddress(
host: string | BigNumber,
txDetails?: Truffle.TransactionDetails
Expand Down Expand Up @@ -1394,6 +1417,29 @@ export interface ValidatorsOperationsInstance extends Truffle.ContractInstance {
): Promise<number>;
};

changeValidatorsWithHowMany: {
(
newValidators: (string | BigNumber)[],
newHowManyValidatorsDecide: number | BigNumber | string,
txDetails?: Truffle.TransactionDetails
): Promise<Truffle.TransactionResponse>;
call(
newValidators: (string | BigNumber)[],
newHowManyValidatorsDecide: number | BigNumber | string,
txDetails?: Truffle.TransactionDetails
): Promise<void>;
sendTransaction(
newValidators: (string | BigNumber)[],
newHowManyValidatorsDecide: number | BigNumber | string,
txDetails?: Truffle.TransactionDetails
): Promise<string>;
estimateGas(
newValidators: (string | BigNumber)[],
newHowManyValidatorsDecide: number | BigNumber | string,
txDetails?: Truffle.TransactionDetails
): Promise<number>;
};

cancelAllPending: {
(txDetails?: Truffle.TransactionDetails): Promise<
Truffle.TransactionResponse
Expand Down Expand Up @@ -1478,6 +1524,29 @@ export interface ValidatorsOperationsMockInstance
): Promise<number>;
};

changeValidatorsWithHowMany: {
(
newValidators: (string | BigNumber)[],
newHowManyValidatorsDecide: number | BigNumber | string,
txDetails?: Truffle.TransactionDetails
): Promise<Truffle.TransactionResponse>;
call(
newValidators: (string | BigNumber)[],
newHowManyValidatorsDecide: number | BigNumber | string,
txDetails?: Truffle.TransactionDetails
): Promise<void>;
sendTransaction(
newValidators: (string | BigNumber)[],
newHowManyValidatorsDecide: number | BigNumber | string,
txDetails?: Truffle.TransactionDetails
): Promise<string>;
estimateGas(
newValidators: (string | BigNumber)[],
newHowManyValidatorsDecide: number | BigNumber | string,
txDetails?: Truffle.TransactionDetails
): Promise<number>;
};

howManyValidatorsDecide(
txDetails?: Truffle.TransactionDetails
): Promise<BigNumber>;
Expand Down

0 comments on commit 8fe691c

Please sign in to comment.