diff --git a/contracts/helpers/ValidatorsOperations.sol b/contracts/helpers/ValidatorsOperations.sol index fafba7f..519e288 100644 --- a/contracts/helpers/ValidatorsOperations.sol +++ b/contracts/helpers/ValidatorsOperations.sol @@ -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 @@ -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"); @@ -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; } @@ -299,4 +300,6 @@ contract ValidatorsOperations is Initializable { delete allOperationsIndicies[operation]; delete operationsByValidatorIndex[operation]; } + + } \ No newline at end of file diff --git a/types/truffle-contracts/index.d.ts b/types/truffle-contracts/index.d.ts index e326676..68bb99d 100644 --- a/types/truffle-contracts/index.d.ts +++ b/types/truffle-contracts/index.d.ts @@ -117,6 +117,29 @@ export interface BridgeInstance extends Truffle.ContractInstance { ): Promise; }; + changeValidatorsWithHowMany: { + ( + newValidators: (string | BigNumber)[], + newHowManyValidatorsDecide: number | BigNumber | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + call( + newValidators: (string | BigNumber)[], + newHowManyValidatorsDecide: number | BigNumber | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + newValidators: (string | BigNumber)[], + newHowManyValidatorsDecide: number | BigNumber | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + newValidators: (string | BigNumber)[], + newHowManyValidatorsDecide: number | BigNumber | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + getGuestAddress( host: string | BigNumber, txDetails?: Truffle.TransactionDetails @@ -1394,6 +1417,29 @@ export interface ValidatorsOperationsInstance extends Truffle.ContractInstance { ): Promise; }; + changeValidatorsWithHowMany: { + ( + newValidators: (string | BigNumber)[], + newHowManyValidatorsDecide: number | BigNumber | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + call( + newValidators: (string | BigNumber)[], + newHowManyValidatorsDecide: number | BigNumber | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + newValidators: (string | BigNumber)[], + newHowManyValidatorsDecide: number | BigNumber | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + newValidators: (string | BigNumber)[], + newHowManyValidatorsDecide: number | BigNumber | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + cancelAllPending: { (txDetails?: Truffle.TransactionDetails): Promise< Truffle.TransactionResponse @@ -1478,6 +1524,29 @@ export interface ValidatorsOperationsMockInstance ): Promise; }; + changeValidatorsWithHowMany: { + ( + newValidators: (string | BigNumber)[], + newHowManyValidatorsDecide: number | BigNumber | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + call( + newValidators: (string | BigNumber)[], + newHowManyValidatorsDecide: number | BigNumber | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + sendTransaction( + newValidators: (string | BigNumber)[], + newHowManyValidatorsDecide: number | BigNumber | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + estimateGas( + newValidators: (string | BigNumber)[], + newHowManyValidatorsDecide: number | BigNumber | string, + txDetails?: Truffle.TransactionDetails + ): Promise; + }; + howManyValidatorsDecide( txDetails?: Truffle.TransactionDetails ): Promise;